Lazarus

Programming => General => Topic started by: Saylo_49 on May 20, 2019, 03:06:00 am

Title: Vectorial Shaped Picture
Post by: Saylo_49 on May 20, 2019, 03:06:00 am
Hello
I am looking for a kind of graphical component that drop a Vectorial shape on the form (something like a circle that look perfectly like a circle when drawn or maximized without showing huge pixels arround like the actual TShape component in the LCL)

And has the ability to insert a picture inside the shape

Title: Re: Vectorial Shaped Picture
Post by: jamie on May 20, 2019, 03:32:10 am
You could look into using WMF or EMF graphic formats.

Those are vector graphic formats and it requires you to call a series of Canvas.Functions as you normally do now
that performs the images.

You can lookup "Metafile" functions.

First thing you do is use
"CreateEnhMetaFile" with the needed parameters.
   That creates the Device Context, rectangle to draw in etc..
 Using the Canvas functions you can write to this file...
 when done, you have created a vector image..

 To show it, call "PlayEnhMetaFile" and it spits it out on a canvas for you.

 Don't get thrown off with the FILE language.. It can be a memory file too..

Look around for a "Tmetafile" and "TmetaFileCanvas"
Title: Re: Vectorial Shaped Picture
Post by: avra on May 20, 2019, 09:37:25 am
Hello
I am looking for a kind of graphical component that drop a Vectorial shape on the form
You could take a look at these SVG topics:
https://forum.lazarus.freepascal.org/index.php/topic,36910.msg250008.html
https://forum.lazarus.freepascal.org/index.php/topic,43620.msg305590.html
or examine if some of these libraries can do the work:
zcad, pl_Graphics32VPR, CADSys, luipack, aggpas, fpvectorial, bgrabitmap, cef4delphi, codebot
Title: Re: Vectorial Shaped Picture
Post by: wp on May 20, 2019, 11:10:08 am
Did you look at the demo ShapedControls in folder "examples" of your Lazarus installation? Based on this demo I created the attached project which does not require any third-party components. You can change the size of the form, and the circle will never show enlarged pixels.