|
|
OK, this version works for the compressed data node approach.
Checking for errors and freeing the malloc'd buffer is left as an
exercise for the reader...
=========== test3.fl ==============
# data file for the Fltk User Interface Designer (fluid)
version 1.0400
header_name {.h}
code_name {.cxx}
decl {\#include <FL/Fl_SVG_Image.H>} {public global
}
decl {\#include <FL/Fl_Box.H>} {public global
}
decl {\#include <stdlib.h>} {private local
}
decl {\#include <zlib.h>} {private local
}
data svg3 {private local filename {Scrub.svg} compressed
}
class svg_rsz {open : {public Fl_Box}
} {
Function {svg_rsz(Fl_SVG_Image *svg2, int X, int Y, int W, int H,
const char* L=0) : Fl_Box(X,Y,W,H,L)} {
comment Constructor open
} {
code {svg = svg2;
svg->resize(w(),h());
image(svg);} {}
}
Function {resize(int x, int y, int w, int h)} {
comment {A resize method} open return_type void
} {
code {Fl_Box::resize(x,y,w,h);
svg->resize(this->w(),this->h());} {}
}
decl {Fl_SVG_Image *svg;} {private local
}
}
Function {} {open
} {
code {unsigned char *svg3U = (unsigned char *)::malloc(svg3_size);
fltk_z_uLongf u_sz = (fltk_z_uLongf)svg3_size;
if (uncompress(svg3U, &u_sz, svg3, sizeof(svg3)) != Z_OK)
{
/* error */
}} {}
code {Fl_SVG_Image *svg2 = new Fl_SVG_Image(NULL, (char *)svg3U);} {selected
}
code {svg_rsz *boxA = NULL;} {}
Fl_Window main_win {open
private xywh {882 285 249 221} type Double resizable
code0 {boxA = new svg_rsz(svg2, 15, 15, 180, 180);} visible
} {}
}
===============================
--
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/CAGFM6dYOFBjn-4_XmyX3XPivOf0meVtD7KaFwxUEx0FFZrfttg%40mail.gmail.com.
[ Direct Link to Message ] | |
|
| |