Commit Graph

26 Commits

Author SHA1 Message Date
Matthias Melcher
44c874b731
Use FL_OVERRIDE for all overridden virtual methods (#611)
FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
2022-12-30 19:14:36 +01:00
Matthias Melcher
12da87ba0c
Adding length checks for in-memory image data (see #542) (#592)
SVG is now decompressed in memory
Bitmap invalid array length handling to return an error
RGB Image data reader to return error if image data is too short
FLUID: Add size argument to bitmap and JPEG data
2022-12-17 16:01:35 +01:00
ManoloFLTK
7f8f7c5b85 Add support of .svgz image files to fluid
The  prototype of the public Fl_SVG_Image constructor is expanded
to allow construction from in-memory, gzip'ed binary data.
2022-11-15 10:09:01 +01:00
Albrecht Schlosser
10537b7143 Make Fl_Image::copy() 'const', including all derived classes
Copying an image does not (and must not) change the original object,
hence copy() should always be 'const'.

This is *necessary* if the given Fl_Image object is 'const'.
2022-04-13 16:50:30 +02:00
Albrecht Schlosser
6ac305a508 Remove compiler warnings '-Wextra-semi' (see also PR #266)
I compiled with `-Wextra-semi -Werror=extra-semi` on Linux and Windows
(cross-compiled on Linux) and removed all "extra semicolon" warnings
I could find. I didn't check on macOS (yet).

Note: Linux configured with and w/o Pango but not w/o Xft. Compilation
with other options (e.g. Cairo) might still emit such warnings.
2021-08-27 14:52:43 +02:00
ManoloFLTK
f56d43c9f6 Rename private member function with trailing underscore. 2020-11-19 15:59:48 +01:00
ManoloFLTK
18ae6c84eb Remove unnecessary friend declaration in class Fl_SVG_Image 2020-11-14 10:06:51 +01:00
ManoloFLTK
a4bacf83c4 Fix for issue #155 - continued
Restores proper separation of what is in libfltk and what is in libfltk_images
2020-11-12 14:50:57 +01:00
ManoloFLTK
231159e16c Fix for issue #155 - continued
The issue lies in details how floating point scaled coordinates are converted
to integer values and its impact on the drawing of large SVG images.
This commit fixes the X11 platform.
The macOS platform is immune because drawing uses floating point
coordinates.
The Windows platform still needs fixing.
2020-11-12 07:46:12 +01:00
Albrecht Schlosser
f09e17c3c5 Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files

The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
2020-07-06 20:28:20 +02:00
ManoloFLTK
46b89686df Allow using an Fl_SVG_Image object as window icon.
Fix for issue #90: Setting an svg image as a window icon causes a segfault.
2020-06-15 19:05:47 +02:00
Albrecht Schlosser
3d00b8db4c Improve Fl_SVG_Image docs
- add 'can_expand' optional parameter to scale()
- don't expose name and e-mail of the nanosvg author in docs
- format example code according to the FLTK coding style
- fix (some) trailing spaces

FTR: all examples compile and work well with current FLTK 1.4.
2020-06-07 16:57:40 +02:00
ManoloFLTK
6105a95202 Doc: make clear that nanosvg doesn't render image elements. 2020-03-28 07:13:11 +01:00
ManoloFLTK
4a58bf4dc2 Add example "Fitting an SVG image to a resizable Fl_Box" to doc of Fl_SVG_Image. 2019-08-27 18:38:56 +02:00
Manolo Gouy
b8a50851fd Fix Fl_Image::copy() and its versions for derived image classes following the introduction of Fl_Image::scale()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-23 17:03:24 +00:00
Manolo Gouy
916b44e361 New member function Fl_Image::scale(int width, int height) to set the FLTK size of an image.
Each image has now two sizes implemented as follows:
   - the pixel size is stored in private members pixel_w_ and pixel_h_
    with public accessors pixel_w() and pixel_h()
   - the FLTK size is stored in private members w_ and h_ and read by w() and h()
   - when the image is constructed, the two sizes have the same value
   - the protected w(int) and h(int) member functions set both FLTK and pixel sizes.
   - the public scale(int, int) member function is essentially nothing but
   set the FLTK size and don't change the pixel size.
   - when the image is drawn, its FLTK size determines how big it is drawn, its pixel
   size determines how much data are available to draw it.

FLTK 1.3.4 with FL_ABI_VERSION=10304 contained an equivalent member function
but only for the Fl_Shared_Image class.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12776 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-19 17:43:18 +00:00
Manolo Gouy
b4521fd1bf Add necessary inline implementation of Fl_SVG_Image::copy(void).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12620 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-01-04 15:45:59 +00:00
Manolo Gouy
3d53e5b496 Doxygen doc: minor rewording for the Fl_SVG_Image class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12539 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-03 09:04:56 +00:00
Manolo Gouy
839f52bc18 Fix for STR#3421: Fl_SVG_Image crashes if passed an svg file that is a static const char* string
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-31 16:56:23 +00:00
Manolo Gouy
db83933f58 Remove the Fl_SVG_Image::fl_gzopen() member function that is less useful with the new fl_open_ext() function.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12491 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-13 07:17:01 +00:00
Albrecht Schlosser
63420dd956 Fix name clash with zlib gzopen on (64-bit) Linux.
Compilation error message:

src/Fl_SVG_Image.cxx:80:21: error: out-of-line definition of 'gzopen64' does
not match any declaration in 'Fl_SVG_Image'; did you mean 'gzopen'?
void* Fl_SVG_Image::gzopen(const char *fname) {
                    ^~~~~~
                    gzopen
/usr/include/zlib.h:1709:20: note: expanded from macro 'gzopen'
#    define gzopen gzopen64
                   ^

The culprit was the macro defined in zlib.h (above).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-05 18:32:52 +00:00
Manolo Gouy
0b797d704c Fl_SVG_Image class: add support for compressed .svgz image files.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12477 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-04 16:26:51 +00:00
Manolo Gouy
8e558595e6 Make virtual member function Fl_Image::draw_scaled(int X, int Y, int W, int H) protected rather than private.
Consequently, remove the trailing _ from its name reserved for private class members.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12433 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-09-09 12:35:06 +00:00
Manolo Gouy
dd9f32c3f5 Fix typo in documentation of Fl_SVG_Image.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12419 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-09-04 08:30:19 +00:00
Manolo Gouy
d6349e180a Set svn:keywords
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12415 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-09-03 13:20:52 +00:00
Manolo Gouy
1a28d85dc3 Add new Fl_SVG_Image class to support scalable vector graphics images using the (modified) nanosvg software.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-09-03 13:14:25 +00:00