Recent

Author Topic: BGRAsvg: Image to big  (Read 4087 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
BGRAsvg: Image to big
« on: March 04, 2021, 12:24:00 am »
Hi!

BGRAsvg: Image to big ???

And I thought they are scalable .....

Just a very simple code to load a svg and draw it on a Canvas2D.
The file is a carddeck file from AisleRiot and is loaded without problems in InkScape.

The error message appears at

Code: Pascal  [Select][+][-]
  1. svg.StretchDraw(tmp.Canvas2D, .......
  2.  


Can anybody tell me what's going on???

Thanx
Winni

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRAsvg: Image to big
« Reply #1 on: March 06, 2021, 09:58:05 pm »
Can you look at the stack trace?

That might be related to text rendering. Maybe using vectorized text renderer would solve this.
Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRAsvg: Image to big
« Reply #2 on: March 06, 2021, 10:41:55 pm »

Hi!

I will look later in the night. Just busy.

The source is simple:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button8Click(Sender: TObject);
  2. const svgfile= './bonded.svg';
  3. var svg: TBGRASVG;
  4.     tmp: TBGRAbitmap;
  5. begin
  6. svg := TBGRAsvg.create(svgfile);
  7. tmp := TBGRAbitmap.create (Image1.width,image1.height,cssWhite);
  8. svg.StretchDraw(tmp.Canvas2D,0,0,image1.width,image1.height,false); // <=== Crash
  9. svg.free;
  10. tmp.draw(Image1.Canvas,0,0,true);
  11. tmp.free;
  12. end;
  13.  

The bonded cardset svg in the attachment

Thanx
Winni

Grrrr! This software does not allow svg files to be attached!
Allways 20 years behind the state of art!

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRAsvg: Image to big
« Reply #3 on: March 07, 2021, 12:52:52 am »
Hi!

Interesting: Debugger crash on   svg.StretchDraw(tmp.Canvas2D,  ....

See attachment

Winni

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRAsvg: Image to big
« Reply #4 on: March 07, 2021, 08:17:07 am »
Have you enabled debugging in BGRABitmap?

I cannot reproduce the error. Though I suggest to add:
Code: Pascal  [Select][+][-]
  1.     tmp.FontRenderer := TBGRAVectorizedFontRenderer.Create;  

Note that this SVG contains elements that are not rendered yet by BGRASVG.
Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRAsvg: Image to big
« Reply #5 on: March 07, 2021, 03:31:48 pm »
Hi and thanx!

Assigning the fontrenderer did the trick: No crash anymore.

But as you said: Not all elements are rendered until now.
Instead of a carddeck only two rectangles are shown.

Bur anyway: One step forward.

Winni

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRAsvg: Image to big
« Reply #6 on: March 07, 2021, 05:00:28 pm »
You're welcome.

Improving SVG support is on my todo list, when I have enough spare time.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018