SaveImage() and depths < 24 bits
Posted: Tue Mar 28, 2006 5:15 pm
his error is still not solved.
PB4 can now create images in 8 bit,
the images is correctly converted,
but PB4 cannot save them in the format
given in CreateImage.
see this example code and the size of the saved' bitmap
and btw, try with 4 or 2 as depth 
PB4 can now create images in 8 bit,
the images is correctly converted,
but PB4 cannot save them in the format
given in CreateImage.
see this example code and the size of the saved' bitmap

Code: Select all
Procedure MakeDesktopScreenshot(ImageNr,x,y,Width,Height,depth)
hImage = CreateImage(ImageNr,Width,Height,depth)
hDC = StartDrawing(ImageOutput(ImageNr))
DeskDC = GetDC_(GetDesktopWindow_())
BitBlt_(hDC,0,0,Width,Height,DeskDC,x,y,#SRCCOPY)
StopDrawing()
ReleaseDC_(GetDesktopWindow_(),DeskDC)
ProcedureReturn hImage
EndProcedure
ScreenWidth = GetSystemMetrics_(#SM_CXSCREEN)
ScreenHeight = GetSystemMetrics_(#SM_CYSCREEN)
ColorDepth = GetDeviceCaps_(GetDC_(0),#BITSPIXEL)
Debug ColorDepth
;t1=GetTickCount_()
MakeDesktopScreenshot(0, 0, 0, ScreenWidth, ScreenHeight,8)
;t2=GetTickCount_()
SaveImage(0, "C:\DesktopScreenshot.bmp");save always as screendepth
;t3=GetTickCount_()
;MessageRequester("Info",Str(t2-t1)+":"+Str(t3-t2),0)
