FLTK logo

Re: [fltk.general] Re: FLUID: how can I have SVG icons embedded in the code?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: FLUID: how can I have SVG icons embedded in the code? imm 03:17 Apr 19  
 
On Fri, 19 Apr 2024 at 11:06, 'Matthias Melcher' wrote:
>
> --- Using the Inline Data node:
>
> If you use the Inline Data node, you can choose binary, text, or compressed. Inline Data does not know what kind of data you store, so you have to choose the right type, and FLUID does not know how you will use the data later. You are using it for and svg, but FLUID does not know that. If your svg is uncompressed XML, you should choose text. If it is a compressed svgz, you should choose binary. If you select "compress", the FLUID will compress the data for you using zlib, but that is completely unrelated to the type of data. You have to uncompress it before you can use it:
>
> For example you have an Inline Data node that you want to store in the program code compressed, named AppLicense. FLUID will generate three const values for you:
> unsigned char AppLicense[], an array holding the compressed data, the implicit sizeof(AppLicense), holding the size of the compressed array, and int AppLicense_size, the size of the original uncompressed array. To use the data that FLUID stores compressed, you can sod something like:
>
>     int uncompressed_size = AppLicense_size;
>
>     unsigned char *AppLicenseUncompressed = (unsigned char *)::malloc(uncompressed_size);
>
>     if (uncompress(AppLicenseUncompressed, &uncompressed_size, AppLicense, sizeof(AppLicense)) != Z_OK) {
>
>       /* error */
>
>     }
>

OK, so for the Inline Data node I have to uncompress the node myself... OK.
I had though that the :

Fl_SVG_Image::Fl_SVG_Image(const char * name, const unsigned char *
svg_data, size_t length)

method would do that for me, so that is what I used in my fluid file.

The docs say: "This constructor loads the SVG image from a block of
memory. This version is commonly used for compressed binary data, but
the reader recognizes if the data is uncompressed, and reads it as a
text block." so I was hopeful this would Just Work, but in testing it
does not. I'll try unpacking the data manually...

Though probably the raw text is fine for me anyway, TBH...

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6da_Hp_Bs3cf9zf7BovgDe2Y%2B%2BuP7KzpPZOczM9%3Dm4THjg%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.