EtheaDev / SVGIconImageList

Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
Apache License 2.0
321 stars 93 forks source link

AV error after setting SVGText in TSVGIconImage #227

Open birbilis opened 2 years ago

birbilis commented 2 years ago

Got this even though icon was set ok (think I got it one or twice, not sure if IDE issue or not) image

birbilis commented 2 years ago

Btw, I was trying to set that image again (accidentally in the screenshot above I was trying to set it at my base TStoryItem class instead of at the descendent TImageStoryItem, those are from https://github.com/zoomicon/READCOM_App). I noticed if I set the SVGText to the Glyph object I have there (of TSVGIconImage type) at a descendent frame (say in TAudioStoryItem) upon pressing Save in Delphi for the TFrame file, it clears the SVG from the display (and loses it). Not sure if it's something I'm doing wrong in my base frame constructor, it was working till recently and think it broke (lost the SVG images at descendent frames) upon updating your library from GetIt.

So, have you tried if your TSVGIconImage stores its SVGText state ok when it is used with Frame inheritance (aka set at a descendent frame)?

birbilis commented 2 years ago

so if I edit my .fmx of the inherited frame (TAudioStoryItem, descending from TStoryItem) by hand and open it, shows OK, but pressing save again it replaces SVGText with ''. The ancestor (the TStoryItem) has Glyph's SVGText as '' instead (the property editor doesn't seem to be able to set an empty string/file). So load when using frame inheritance works, but save somehow fails (instantly replaces SVGText with '')

inherited AudioStoryItem: TAudioStoryItem Size.Width = 232.000000000000000000 Size.Height = 204.000000000000000000 OnClick = FrameClick inherited Glyph: TSVGIconImage Opacity = 0.300000011920929000 Size.Width = 232.000000000000000000 Size.Height = 204.000000000000000000 SVGText = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'#10'<svg xmln' + 's:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http:' + '//www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xm' + 'lns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.o' + 'rg/dc/elements/1.1/" id="Layer_1" enable-background="new 0 0 100' + ' 100" xml:space="preserve" viewBox="0 0 100 100" version="1.1" y' + '="0px" x="0px">'#10' '#10''#10 end inherited Border: TRectangle Size.Width = 232.000000000000000000 Size.Height = 204.000000000000000000 end object MediaPlayer: TMediaPlayerEx FileName = '' Muted = False AutoPlaying = False Looping = False Left = 26 Top = 50 end end

birbilis commented 2 years ago

update: also just noticed that if I save an even deeper descendent frame than the one where I set the SVGText property of the TSVGIconImage that had been inherited from parent frame, it saves ok. It only fails (clears the SVGText) if I press Save in the frame that defined the SVGText (as I said that is a descendent frame of the one where TSVGIconImage component was defined)

If I add by hand in the .fmx file the SVGText it works ok.

Also note before I had that SVGText in the child Multires bitmap and it was saving ok, but after upgrade to new version it lost that data. You may be missing some call to "inherited" if you define persisted content programmatically / on-the-fly

carloBarazzetta commented 1 year ago

Is this problem also present? I don't use Android apps as extensively as you do, so I can't reproduce the problem...

birbilis commented 1 year ago

Not related to Android, but to frame inheritance. You may have forgotten to call inherited if you’ve overriden the persistence calls