Recent

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

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • 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: 233
    • 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: 4219
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/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018