Recent

Author Topic: Vectorial Shaped Picture  (Read 367 times)

Saylo_49

  • New Member
  • *
  • Posts: 34
Vectorial Shaped Picture
« 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

Lazarus 2.0.2 - FPC 3.0.4 - Win32

jamie

  • Hero Member
  • *****
  • Posts: 2166
Re: Vectorial Shaped Picture
« Reply #1 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"
« Last Edit: May 20, 2019, 03:36:10 am by jamie »
Number 1 at blue screen app creations!

avra

  • Hero Member
  • *****
  • Posts: 1736
    • Additional info
Re: Vectorial Shaped Picture
« Reply #2 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
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

wp

  • Hero Member
  • *****
  • Posts: 6485
Re: Vectorial Shaped Picture
« Reply #3 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.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10