I would like to get an image from a window and convert it into TIF black&white format.
import HWND and change color depth are done (no message error)
but i don't manage to save bitmap into TIF file (error=GFL_ERROR_BAD_FORMAT_INDEX).
I tried other formats to test => same error.
what's wrong with my code ?
Code: Select all
GFL_ERROR err;
GFL_BITMAP *bitmap;
GFL_RECT rct;
rct.x=rectSel.left; // WINAPI RECT rectSel : global var
rct.y=rectSel.top;
rct.w=rectSel.right-rectSel.left;
rct.h=rectSel.bottom-rectSel.top;
err = gflImportFromHWND (hwnd, &rct, &bitmap);
if (err) goto errato;
GFL_BITMAP *bitmapOut;
err = gflChangeColorDepth (bitmap, &bitmap,GFL_MODE_TO_BINARY, GFL_MODE_HALTONE90_DITHER);
if (err) goto errato;
GFL_SAVE_PARAMS sp;
gflGetDefaultSaveParams(&sp);
sp.Flags = GFL_SAVE_REPLACE_EXTENSION;
sp.FormatIndex = gflGetFormatIndexByName("tiff");
err = gflSaveBitmap("sortie.tif", bitmap, &sp);
if (err) goto errato;
return TRUE;
errato:;
if (err) exit(err) ;