Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
> The compression itself isn't wrong... > The problem is in the TIFF headers. > I already submitted the problem with the "Response Problem" option on the site. Ok, let me check. > I'm trying to work with the HDC soon, if I get time for it. The feature isn't not very important > for use in our application, it's only for a nicer looking selection... I just tried to create test application at Delphi with the following DoubleBufferPaint event handler, and it worked perfectly: Code:procedure TForm1.TiffViewerDoubleBufferPaint(ASender: TObject;
Hdc: Cardinal);
var X1, Y1, X2, Y2: Integer;
objGraphics: IGraphics;
begin
if (TiffViewer.SelectionWidth > 0) and (TiffViewer.SelectionHeight > 0) then
begin
objGraphics := CoGraphics.Create;
//'Attach graphics object to temporary device context
//'which is used for double buffer painting
objGraphics.hdc := Hdc;
objGraphics.Engine := DrawingEngineGdiplus;
objGraphics.Antialiasing := False;
objGraphics.Brush.PrimaryColor := $80FF0000;
//'To shade a part of image which should be cropped,
// 'we will draw four semi-transparent rectangles.
//'Draw top part
// 'Convert bitmap coordinates to control and draw a top rectangle
TiffViewer.BitmapToControlCoords(0, 0, X1, Y1);
TiffViewer.BitmapToControlCoords(TiffViewer.Bitmap.Data.Width, TiffViewer.SelectionTop, X2, Y2);
objGraphics.DrawRectangle(X1, Y1, X2 - X1, Y2 - Y1, True, False, 0);
// 'Draw bottom part
// 'Convert bitmap coordinates to control and draw a bottom rectangle
TiffViewer.BitmapToControlCoords(0, TiffViewer.SelectionTop + TiffViewer.SelectionHeight, X1, Y1);
TiffViewer.BitmapToControlCoords(TiffViewer.Bitmap.Data.Width, TiffViewer.Bitmap.Data.Height, X2, Y2);
objGraphics.DrawRectangle(X1, Y1, X2 - X1, Y2 - Y1, True, False, 0);
// 'Draw left part
// 'Convert bitmap coordinates to control and draw a left rectangle
TiffViewer.BitmapToControlCoords(0, TiffViewer.SelectionTop, X1, Y1);
TiffViewer.BitmapToControlCoords(TiffViewer.SelectionLeft, TiffViewer.SelectionTop + TiffViewer.SelectionHeight, X2, Y2);
objGraphics.DrawRectangle(X1, Y1, X2 - X1, Y2 - Y1, True, False, 0);
// 'Draw right part
// 'Convert bitmap coordinates to control and draw a right rectangle
TiffViewer.BitmapToControlCoords(TiffViewer.SelectionLeft + TiffViewer.SelectionWidth, TiffViewer.SelectionTop, X1, Y1);
TiffViewer.BitmapToControlCoords(TiffViewer.Bitmap.Data.Width, TiffViewer.SelectionTop + TiffViewer.SelectionHeight, X2, Y2);
objGraphics.DrawRectangle(X1, Y1, X2 - X1, Y2 - Y1, True, False, 0);
end;
end;
Hope this helps. Edited by user Thursday, December 20, 2007 6:42:29 PM(UTC)
| Reason: Not specified
|