Re: CopyImage for IMAGE_BITMAP still not right, next Try
"Uwe Bonnes" <bon(a)elektron.ikp.physik.tu-darmstadt.de> wrote:
if ((res = CreateBitmapIndirect(&bm))) { - char *buf = HeapAlloc( GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight ); + LONG size = GetBitmapBits( hnd, 0, NULL ); + char *buf = HeapAlloc( GetProcessHeap(), 0, size ); GetBitmapBits( hnd, bm.bmWidthBytes * bm.bmHeight, buf ); - SetBitmapBits( res, bm.bmWidthBytes * bm.bmHeight, buf ); + SetBitmapBits( res, size, buf );
This doesn't look right. You need to call GetBitmapBits the second time with "size" returned from a previous GetBitmapBits call, just like you do in SetBitmapBits. -- Dmitry.
"Dmitry" == Dmitry Timoshkov <dmitry(a)baikal.ru> writes:
Dmitry> "Uwe Bonnes" <bon(a)elektron.ikp.physik.tu-darmstadt.de> wrote: >> if ((res = CreateBitmapIndirect(&bm))) { - char *buf = HeapAlloc( >> GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight ); + LONG size = >> GetBitmapBits( hnd, 0, NULL ); + char *buf = HeapAlloc( >> GetProcessHeap(), 0, size ); GetBitmapBits( hnd, bm.bmWidthBytes * >> bm.bmHeight, buf ); - SetBitmapBits( res, bm.bmWidthBytes * >> bm.bmHeight, buf ); + SetBitmapBits( res, size, buf ); Dmitry> This doesn't look right. You need to call GetBitmapBits the Dmitry> second time with "size" returned from a previous GetBitmapBits Dmitry> call, just like you do in SetBitmapBits. If I do that, I get an X Error: X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 73 (X_GetImage) Serial number of failed request: 34307 Current serial number in output stream: 34307 The bitmap in question in Avrstudio from Atmel is a four bit one. With the code above, serveral errors like: err:x11drv:X11DRV_CreateBitmap Trying to make bitmap with planes=1, bpp=4 err:x11drv:X11DRV_CreateBitmap Trying to make bitmap with planes=1, bpp=4 err:x11drv:X11DRV_CreateBitmap Trying to make bitmap with planes=1, bpp=4 err:x11drv:X11DRV_CreateBitmap Trying to make bitmap with planes=1, bpp=4 are produced. B.t.w. to get Avrstudio to run until that error happens, start it like env WINEDLLOVERRIDES=msvcrt,msxml3,ole32,oleaut32,rpcrt4,urlmon=n /spare/bon/wine/wine/wine AvrStudio4/AVRStudio.exe Bye -- Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
participants (2)
-
Dmitry Timoshkov -
Uwe Bonnes