Wrong Result for GetRgnbox on Linux
Issue #192
resolved
The Values for the rect are wrong for right and bottom (each has added the twofold of left and top).
It is only on linux, on mac it is ok.
procedure TForm55.FormPaint(Sender: TObject); var Rgn: HRgn; Box: TRect; begin //Rgn := CreateRoundRectRgn(10, 10, 200, 150, 30, 30);
Rgn := CreateRectRgn(50, 50, 200, 150); try GetRgnBox(Rgn, Box);
Showmessage (Box.left.ToString + ' ' + Box.top.ToString + ' ' + box.right.tostring + ' ' + box.bottom.tostring);
// on Windows and mac you see: 50,50,200,150 // on Linux you see 50,50,300,250
Canvas.Brush.Color := clGreen;
SelectClipRgn(Canvas.Handle, Rgn);
//FillRgn(Canvas.Handle, Rgn, Canvas.Brush.Handle);
canvas.fillrect (clientrect);
SelectClipRgn(Canvas.Handle, HRgn (nil));
finally DeleteObject(Rgn); end;
Rgn := CreateEllipticRgnIndirect(Rect(220, 220, 320, 320)); try Canvas.Brush.Color := clRed; ExtSelectClipRgn(Canvas.Handle, Rgn, RGN_AND);
Canvas.Draw(220, 220, Image1.Picture.Graphic);
finally DeleteObject(Rgn); end; end;
The Region-functions are heavy in use here, hope you can fix it
Comments (2)
-
reporter -
repo owner - changed status to resolved
Fixed at 1.11
- Log in to comment
Additional Info: It seems that allready the creation of the region (CreateRectRgn) is wrong, because if I made a internal fix of the resulting rect, an use of
bitmap.canvas.fillrect (rect), than it is ok,
but
FillRgn(Canvas.Handle, Rgn, Canvas.Brush.Handle)
use the wrong area.
So I assume not the GetRgnBox is wrong, but the creation of the region.