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? "'Matthias Melcher' via fltk.general" 05:13 Apr 18  
 

ggar...@gmail.com schrieb am Mittwoch, 17. April 2024 um 22:40:40 UTC+2:

Yes.  I get the options and I added the image, but the output is an Fl_RGB_Image() not an Fl_SVG_Image() without having touched any of the options.  I am using a pretty recent branch on Linux:

Scale     - Width/Height  set to 0,0
Storage   - compressed: ticked
          - bind to widget: off
 

If your source image is a sag, then FLUID will store it internally as an svg. If the source is compressed, it will be stored compressed. When the image is drawn for the first time, the SVG is interpreted and the RGB data is cached for fast rendering. If your hardware supports that, the cache will be stored at the original resolution, and the image will be scaled when it is rendered, keeping full quality for HiDPI displays.That way, you can scale the output image. The SVG data is only interpreted once unless you explicitly call `uncache()` on your image.

The code generated by FLUID for a "compressed" (I should rename that to "original format") SVG is something like:

#include <FL/Fl_SVG_Image.H>

static const char idata_checker[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ... ";
static Fl_Image *image_checker() {
  static Fl_Image *image = NULL;
  if (!image)
    image = new Fl_SVG_Image("checker.svg", idata_checker);
  return image;
}

BTW... have you thought of adding a version switch to fluid?  So it becomes easier to know if I am using the same version as yours?

It's only really an issue with unreleased code. FLUID releases in 1.3 follow the FLTK release scheme and the About box shows the version. I should try to add the GitHub tag or a running "build" number to prereleases. Open for suggestions.
 

--
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/ff0232a9-9a23-410f-9f8d-7e7cc68c7883n%40googlegroups.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'.