Link to home
Start Free TrialLog in
Avatar of DigitalNam
DigitalNamFlag for Namibia

asked on

Delphi XE10 Round Image

Hi all,

I have searched everywhere and maybe I am looking in the wrong places but does anybody perhaps have code to make a jpg or png image round? I am getting my image from DevExpress webcam control and want to make image round show in image and save to DB.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DigitalNam

ASKER

Thank you for the info Geert, I had a look at some samples after some links you suggested. I can now make a round image, but I need to anti alias the border and make the center of the image a circle because the sample of the image I make round takes the left top corner.

This is the code that I have. Can you perhaps give your input and point me in the right direction again please.

procedure TForm1.Button1Click(Sender: TObject);
var
  bmp : TBitmap;
  frgn : HRGN;
begin
  bmp := TBitmap.Create;
  fRgn := CreateEllipticRgn (10, 10, 200, 200);
  try
    bmp.LoadFromFile('d:\devtest.bmp');
    Canvas.Brush.Bitmap := bmp;
    PaintRgn(Canvas.Handle,frgn);
    FrameRgn(Canvas.Handle,frgn,Canvas.Brush.Handle,2,2);
  finally
//    Canvas.Brush.Bitmap := null;
    bmp.Free;
  end;
end;

Open in new window