commit alpha tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@28953 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-11-04 12:09:15 +00:00
parent 1cacaf1c5f
commit 19c1a931bb
3 changed files with 32 additions and 20 deletions

View file

@ -1,8 +1,14 @@
2009-11-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source\winlib\WIN32GState.m: Fixes for read image.
* Source\win32\WIN32Server.m: Use layered window for alpha.
2009-11-03 Fred Kiefer <FredKiefer@gmx.de> 2009-11-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/cairo/CairoGState.m: Set the fill or stroke colour * Source/cairo/CairoGState.m: Set the fill or stroke colour
immediatly before the drawing. immediatly before the drawing.
* Source/art/ARTGState.m (-setColor:state:): Handle stroke colour correctly. * Source/art/ARTGState.m (-setColor:state:): Handle stroke colour
correctly.
2009-11-03 Fred Kiefer <FredKiefer@gmx.de> 2009-11-03 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -480,7 +480,7 @@ NSLog(@"Callback");
estyle = WS_EX_TOOLWINDOW; estyle = WS_EX_TOOLWINDOW;
} }
return estyle; return estyle;
} }
- (void) resizeBackingStoreFor: (HWND)hwnd - (void) resizeBackingStoreFor: (HWND)hwnd
@ -868,7 +868,7 @@ NSLog(@"Callback");
type, style, screen); type, style, screen);
NSDebugLLog(@"WTrace", @" device frame: %d, %d, %d, %d", NSDebugLLog(@"WTrace", @" device frame: %d, %d, %d, %d",
r.left, r.top, r.right - r.left, r.bottom - r.top); r.left, r.top, r.right - r.left, r.bottom - r.top);
hwnd = CreateWindowEx(estyle, hwnd = CreateWindowEx(estyle | WS_EX_LAYERED,
"GNUstepWindowClass", "GNUstepWindowClass",
"GNUstepWindow", "GNUstepWindow",
wstyle, wstyle,
@ -882,6 +882,8 @@ NSLog(@"Callback");
(void*)type); (void*)type);
NSDebugLLog(@"WTrace", @" num/handle: %d", hwnd); NSDebugLLog(@"WTrace", @" num/handle: %d", hwnd);
SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
[self _setWindowOwnedByServer: (int)hwnd]; [self _setWindowOwnedByServer: (int)hwnd];
return (int)hwnd; return (int)hwnd;
} }

View file

@ -1176,7 +1176,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
RECT rcClient; RECT rcClient;
DWORD dwBmpSize; DWORD dwBmpSize;
HANDLE hDIB; HANDLE hDIB;
LPBITMAPINFOHEADER lpbi; LPBITMAPV4HEADER lpbi;
if (window == NULL) if (window == NULL)
{ {
@ -1274,25 +1274,29 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
dwBmpSize = bmpCopied.bmWidth * 4 * bmpCopied.bmHeight; dwBmpSize = bmpCopied.bmWidth * 4 * bmpCopied.bmHeight;
hDIB = GlobalAlloc(GHND, dwBmpSize + sizeof(BITMAPINFOHEADER)); hDIB = GlobalAlloc(GHND, dwBmpSize + sizeof(BITMAPV4HEADER));
lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB); lpbi = (LPBITMAPV4HEADER)GlobalLock(hDIB);
lpbi->biSize = sizeof(BITMAPINFOHEADER); lpbi->bV4Size = sizeof(BITMAPV4HEADER);
lpbi->biWidth = bmpCopied.bmWidth; lpbi->bV4V4Compression = BI_BITFIELDS;
lpbi->biHeight = bmpCopied.bmHeight; lpbi->bV4BlueMask = 0x000000FF;
lpbi->biPlanes = 1; lpbi->bV4GreenMask = 0x0000FF00;
lpbi->biBitCount = 32; lpbi->bV4RedMask = 0x00FF0000;
lpbi->biCompression = BI_RGB; lpbi->bV4AlphaMask = 0xFF000000;
lpbi->biSizeImage = 0; lpbi->bV4Width = bmpCopied.bmWidth;
lpbi->biXPelsPerMeter = 0; lpbi->bV4Height = bmpCopied.bmHeight;
lpbi->biYPelsPerMeter = 0; lpbi->bV4Planes = 1;
lpbi->biClrUsed = 0; lpbi->bV4BitCount = 32;
lpbi->biClrImportant = 0; lpbi->bV4SizeImage = 0;
bits = (unsigned char *)lpbi + sizeof(BITMAPINFOHEADER); lpbi->bV4XPelsPerMeter = 0;
lpbi->bV4YPelsPerMeter = 0;
lpbi->bV4ClrUsed = 0;
lpbi->bV4ClrImportant = 0;
bits = (unsigned char *)lpbi + sizeof(BITMAPV4HEADER);
// Gets the "bits" from the bitmap and copies them into a buffer // Gets the "bits" from the bitmap and copies them into a buffer
// which is pointed to by lpbi // which is pointed to by lpbi
if (GetDIBits(hdcMemDC, hbitmap, 0, (UINT)bmpCopied.bmHeight, bits, if (GetDIBits(hdcMemDC, hbitmap, 0, (UINT)bmpCopied.bmHeight, bits,
(BITMAPINFO *)lpbi, DIB_RGB_COLORS) == 0) (BITMAPINFOHEADER *)lpbi, DIB_RGB_COLORS) == 0)
{ {
NSLog(@"GetDIBits failed for window %d in GSReadRect. Error %d", NSLog(@"GetDIBits failed for window %d in GSReadRect. Error %d",
(int)window, GetLastError()); (int)window, GetLastError());
@ -1322,7 +1326,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
cdata[i+0] = bits[i+2]; cdata[i+0] = bits[i+2];
cdata[i+1] = bits[i+1]; cdata[i+1] = bits[i+1];
cdata[i+2] = bits[i+0]; cdata[i+2] = bits[i+0];
cdata[i+3] = 0xFF; cdata[i+3] = bits[i+3];
i += 4; i += 4;
} }