Que tal señores alguien a trabajado con Tiff multipaginas,he leido el tema de escafandra para leer tiff con gdi pero solo lee la primera imagen como hago para que lea las otras?
Tiff multipage
Started by
luvac
, Jun 10 2014 10:24 AM
2 replies to this topic
#1
Posted 10 June 2014 - 10:24 AM
#3
Posted 11 June 2014 - 05:41 PM
Prueba con esta función que acabo de escribir:
Ejemplo de uso:
Saludos.
delphi
type function GdiplusStartup(var GdiToken: DWORD; Startup, Output: PBYTE): DWORD; stdcall external 'gdiplus'; function GdipCreateBitmapFromFile(lpFileName: PWCHAR; var GBitmap: THANDLE): DWORD; stdcall external 'gdiplus'; function GdipCreateHBITMAPFromBitmap(GBitmap: THANDLE; var hBitmap: HBITMAP; BKColor: DWORD): DWORD; stdcall external 'gdiplus'; procedure GdiplusShutdown(GdiToken: DWORD); stdcall external 'gdiplus'; function GdipImageGetFrameDimensionsList(image: THANDLE; var dimensionIDs: TGUID; count: DWORD): DWORD; stdcall external 'gdiplus'; function GdipImageGetFrameCount(image: THANDLE; var dimensionID: TGUID; var count: DWORD): DWORD; stdcall external 'gdiplus'; function GdipImageSelectActiveFrame(image: THANDLE; var dimensionID: TGUID; frameIndex: DWORD): DWORD; stdcall external 'gdiplus'; implementation function CreateHBITMAPFromFilePage(cFileName: PCHAR; Index: DWORD): HBITMAP; var FileName: array of WCHAR; size: integer; gdiplusToken: DWORD; GdiPlusStartupInput: array[0..2] of int64; GBitmap: THANDLE; DimensionID: TGUID; Frames: DWORD; begin Result:= 0; // Pasamos a Unicode SetLength(FileName, lstrlen(cFileName)+1); size:= lstrlen(cFileName)*sizeof(WCHAR)+1; MultiByteToWideChar(CP_ACP, 0, cFileName, -1, @FileName[0], size); // Inicializamos GDI+. GdiPlusStartupInput[0]:= 1; GdiPlusStartupInput[1]:= 0; if GdiplusStartup(gdiplusToken, @GdiPlusStartupInput, nil) = 0 then begin GdipCreateBitmapFromFile(PWCHAR(FileName), GBitmap); GdipImageGetFrameDimensionsList(GBitmap, dimensionID, 1); GdipImageGetFrameCount(GBitmap, dimensionID, Frames); GdipImageSelectActiveFrame(GBitmap, dimensionID, Index mod Frames); GdipCreateHBITMAPFromBitmap(GBitmap, Result, 0); // Cerramos GDI+ GdiplusShutdown(gdiplusToken); end; end;
Ejemplo de uso:
delphi
Image1.Picture.Bitmap.Handle:= CreateHBITMAPFromFilePage('Fax1.TIF', 4);
Saludos.