Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image not drawn completly #254

Closed
jfudickar opened this issue Mar 12, 2023 · 13 comments
Closed

Image not drawn completly #254

jfudickar opened this issue Mar 12, 2023 · 13 comments

Comments

@jfudickar
Copy link

jfudickar commented Mar 12, 2023

Have a look at this SVG file (generated from plantuml).
In the legend at the end there are empty coloured rectangles which are not drawn in delphi :
grafik
but drawn when showing the file in the edge browser:
spacex_launch_latest compact

Regards
Jens

@carloBarazzetta
Copy link
Contributor

Please attach the SVG file...

@jfudickar
Copy link
Author

It must be attached somehow, because I dragged it in.
Try the right mouse click on the big image and save as.

@jfudickar
Copy link
Author

@carloBarazzetta
Copy link
Contributor

carloBarazzetta commented Mar 12, 2023

I've notice that the problems are in those 4 lines: adding an 'X' instead of three spaces shows the X with correct background color...
<text fill="#000000" filter="url(#bz2wwsoabm0qe0)" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="12" x="826.5" y="1801.0332">X</text> <text fill="#000000" filter="url(#bz2wwsoabm0qe1)" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="12" x="945.5" y="1801.0332">X</text> <text fill="#000000" filter="url(#bz2wwsoabm0qe2)" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="12" x="1032.5" y="1801.0332">X</text> <text fill="#000000" filter="url(#bz2wwsoabm0qe3)" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="12" x="1102.5" y="1801.0332">X</text>
Maybe an incorrect use of background text color for spaces, in Image32 SVG Library of Angus:
https://github.com/AngusJohnson/Image32

@jfudickar
Copy link
Author

Will you raise a ticket there?
I can't work with the X :-)

@AngusJohnson
Copy link

Hi Jens. I can confirm there is a bug in Image32's SVG reader, but I can't see an easy fix.
While I've only had a quick look so far, the issue seems to be related to getting the correct bounds of the floodfill filter element.

@jfudickar
Copy link
Author

Hi Angus, I have not a real problem with it.
The delphi implementation is only a "nice to have" of my json2puml project.
Most of the people will work with the svg file directly.
But I wanted to mention it :-)

@AngusJohnson
Copy link

Here's a 'quick and dirty' solution ...

In TShapeElement.Draw() in Img32.SVG.Reader @ line ~2100

    //get special effects bounds
    if Assigned(clipPathEl) then
    begin
      ....
    end
    else if Assigned(maskEl) then
    begin
      ....
    end else
    begin
      clipRec := drawDat.bounds;
      // add this //////////////////
      if clipRec.IsEmpty and
        (drawDat.fontInfo.textLength > 0) and
        (self is TSubtextElement) then
      begin
        clipRec.Left := fParent.elRectWH.left.rawVal;
        clipRec.Bottom := fParent.elRectWH.top.rawVal;
        clipRec.Right := clipRec.Left + drawDat.fontInfo.textLength;
        clipRec.Top := clipRec.Bottom - drawDat.fontInfo.size;
      end;
      //////////////////////////////

@jfudickar
Copy link
Author

Yes seems to fix it.
Nice.
And thanks!!!

@jfudickar
Copy link
Author

After upgrading to v4 the problem is back :-(

@jfudickar
Copy link
Author

Adding the line fixes it again !

@carloBarazzetta
Copy link
Contributor

Oh, sorry, but I've aligned Image32 source code of @AngusJohnson retrieved from His Gitub repo, probably it was not updated...

@AngusJohnson
Copy link

I've just updated the Image32 repository and the fix above has been included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants