How Can I copy an ellipse or polygon shape from one bitmap to another Bitmap. BitBlt is only useful for copying Rectangles.
I currently use GDI but If it is easier to use GDI+, I can use it. I only need a general guidance to show me the right direction.
You could select an elliptic/polygon clip region into the target device context and then use BitBlt as usual.
var
Rgn: HRGN;
Points: array[0..2] of TPoint;
begin
//Rgn := CreateEllipticRgn(0, 0, 100, 100);
Points[0] := Point(0, 0);
Points[1] := Point(50, 50);
Points[2] := Point(50, 0);
Rgn := CreatePolygonRgn(Points, 3, WINDING);
SaveDC(Canvas.Handle);
SelectClipRgn(Canvas.Handle, Rgn);
DeleteObject(Rgn); // SelectClipRgn copies the region
BitBlt(Canvas.Handle, 0, 0, 100, 100, BmpDC, 0, 0, SRCCOPY);
RestoreDC(Canvas.Handle, -1);
end;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.