Recent

Author Topic: [Solved] How to paint SVG file on canvas?  (Read 2350 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1121
    • UVviewsoft
[Solved] How to paint SVG file on canvas?
« on: December 20, 2018, 06:52:34 pm »
For ex, I have SVG file or StringList with its text. I want to paint it on canvas at (x,y) with given sizes (nx,ny).
How to do it?
« Last Edit: December 20, 2018, 07:38:07 pm by Alextp »

mr-highball

  • Full Member
  • ***
  • Posts: 206
    • Highball Github
Re: How to paint SVG file on canvas?
« Reply #1 on: December 20, 2018, 06:59:13 pm »
bgrabitmap would probably be what you want: https://github.com/bgrabitmap/bgrabitmap

(load from stream/file)
https://github.com/bgrabitmap/bgrabitmap/blob/ecdea28344839d2cae597c6ca4e90c29bf692eba/bgrabitmap/bgrasvg.pas#L139

there's a Draw method which works with a TBGRACanvas2D, but the canvas probably has some "ToBitmap" method or the like

lucamar

  • Hero Member
  • *****
  • Posts: 3027
Re: [Solved] How to paint SVG file on canvas?
« Reply #2 on: December 20, 2018, 07:56:53 pm »
A list of libraries with SVG reading/writing/rendering, taken from the wiki page: Graphics libraries
Also, from FPC Package list
  • librsvg (in {FPC source}/packages/librsvg)

And I'm sure there are more somewhere out there :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018