You are not logged in.
Pages: 1
I use SynGdiPlus.pas and SynPdf.pas to create PDF files. And I need the ability to rotate images.
Can you add to the TGDIPlusFull the rest of gdiplus.dll functions, such as
CreateBitmapFromScan0, BitmapLockBits and BitmapUnlockBits?
Offline
How do you generate SynPdf files?
Are you using SynGdiPlus to create a bitmap content, then render this bitmap using SynPdf?
If it is the case, it does make sense.
I've added CreateBitmapFromScan0, BitmapLockBits and BitmapUnlockBits methods to TGDIPlusFull.
See http://synopse.info/fossil/info/f09f1b0174
Offline
Images acquired from scanner.
Then the images can be reordered and rotated.
To rotate an images, I use SynGdiPlus.
procedure RotateImage(const ASrcImage: THandle; var ADstImage: THandle);
var
LWidth: Cardinal;
LHeight: Cardinal;
LBrush: THandle;
LGraphics: THandle;
begin
Gdip.GetImageWidth(ASrcImage, LWidth);
Gdip.GetImageHeight(ASrcImage, LHeight);
CheckGdipStatus(Gdip.CreateBitmapFromScan0(LHeight, LWidth, 0, PixelFormat24bppRGB, nil, ADstImage));
try
CheckGdipStatus(Gdip.CreateFromImage(ADstImage, LGraphics));
try
CheckGdipStatus(Gdip.CreateSolidFill($FFFFFFFF, LBrush));
try
CheckGdipStatus(Gdip.FillRectangle(LGraphics, LBrush, 0, 0, LHeight, LWidth));
finally
Gdip.DeleteBrush(LBrush);
end;
Gdip.RotateTransform(LGraphics, 90);
Gdip.TranslateTransform(LGraphics, LHeight, 0, 1);
CheckGdipStatus(Gdip.DrawImageRect(LGraphics, ASrcImage, 0, 0, LWidth, LHeight));
finally
Gdip.DeleteGraphics(LGraphics);
end;
except
Gdip.DisposeImage(ADstImage);
ADstImage := 0;
raise;
end;
end;
BitmapLockBits and BitmapUnlockBits used to create black and white images.
P.S.
I join to the wishes expressed in the PDF Engine topic about adding reading PDF files. In order to be able to add or replace scanned pages.
Last edited by Chaa (2011-03-28 02:39:03)
Offline
Pages: 1