Commit Graph

92 Commits

Author SHA1 Message Date
ManoloFLTK
95b5623b96 Fix for issue #427 - continued. 2022-04-13 11:13:05 +02:00
ManoloFLTK
bfae813c4e Fix for issue #427: Problems with data_w, data_h, w, h of Fl_Image. 2022-04-12 15:06:21 +02:00
YX
e9b1c2fed0 Add const to Fl_Image::fail() (PR #415) 2022-03-26 17:55:13 +01:00
Albrecht Schlosser
4bcd5c467b Improve documentation of Fl_Image::copy()
Mention the new Fl_Image::release() method to delete all types of
images.
2022-03-20 15:52:08 +01:00
ManoloFLTK
5a7a70b895 Remove compiler warnings about unused parameters (issue #307) 2021-12-09 08:09:51 +01:00
Albrecht Schlosser
cc0657d7a7 Improve documentation of Fl_Image (Issue #272)
Try to explain what count() returns and what data() contains which
can be different by image type.
2021-09-09 17:53:54 +02:00
Albrecht Schlosser
41266df7ae Remove unnecessary system includes from public headers
Add includes of system headers in the implementation files
where necessary.
2021-03-21 00:42:28 +01:00
ManoloFLTK
f56d43c9f6 Rename private member function with trailing underscore. 2020-11-19 15:59:48 +01:00
ManoloFLTK
2931c29689 Replace virtual Fl_RGB_Image::cache_size() by virtual Fl_Image::cache_size() 2020-11-17 11:23:35 +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
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
1dd4929585 Add two virtual methods to class Fl_Image
(1) The new virtual method Fl_Image::release() which is equivalent to
  'delete this' automatically extends to Fl_Shared_Image::release()
  which makes the latter method virtual.

  This new method in the base class makes Fl_Image::release() callable
  on all objects derived from Fl_Image.

(2) Add virtual method Fl_Shared_Image *Fl_Image::as_shared_image()

  This new method can be used to detect whether an Fl_Image instance
  is an Fl_Shared_Image or not.
2020-06-06 06:27:47 +02:00
ManoloFLTK
325c4b8666 New public static variable bool Fl_Image::register_images_done
Allows an app to detect whether fl_register_images() was called or not.
2020-01-30 18:54:18 +01:00
ManoloFLTK
bb5ef3b1d0 Doxygen: rewording for more clarity. 2019-04-14 09:54:55 +02:00
ManoloFLTK
65916c106e Remove Fl_Image::as_rgb_image() virtual member function.
It's not used in the library, so its utility remains to be proven.
2019-02-06 17:22:28 +01:00
Manolo Gouy
458d063643 Image classes: memorise the width and the height of the cached form of the image to support GUI scaling
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12811 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-28 13:00:12 +00:00
Manolo Gouy
77cc7b147a Documentation: give more detail for Fl_Image::w(int W) and Fl_Image::h(int H)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12802 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-26 08:20:17 +00: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
9f9631e685 Rename Fl_Image::pixel_w() and pixel_h() to Fl_Image::data_w() and data_h().
The docs of class Fl_Image and of Fl_Image::scale() are beefed up.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-22 16:38:38 +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
Albrecht Schlosser
322208b855 Add missing Fl_Labeltype and Fl_Boxtype definitions.
Some labeltypes and boxtypes were missing a #define for the enum
without a leading underscore and the corresponding setup function
to initialize the internal table of boxtypes and labeltypes, for
instance _FL_MULTI_LABEL. This is now fixed so (hopefully) all boxtypes
and labeltypes can and _should_ be used w/o leading underscore.

Note: if there are still boxtypes or labeltypes that can't be used w/o
leading underscore this should be considered a bug and is to be fixed ASAP.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12443 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-09-11 18:54:10 +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
eae09e7fa0 Create virtual Fl_Image::draw_scaled_(int X, int Y, int W, int H) and its implementations for image classes.
This allows to use the virtual function mechanism to adapt scaled image drawing both to the
image type and the graphics driver type.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12410 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-08-30 15:49:58 +00:00
Manolo Gouy
9fc2d43102 Improve Doxygen comments related to image drawing
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12407 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-08-30 08:59:50 +00:00
Manolo Gouy
f48750b0f4 Introduce HiDPI + rescaling support for the X11 platform (+ partial support for WIN32)
Corresponds to STR #3320
1) HiDPI support consists in detecting the adequate scaling factor for the screen on which
FLTK maps a window, and scaling all FLTK units by this factor. FLTK tries to detect the correct
value of this factor at startup (see more details below). Environment variable
FLTK_SCALING_FACTOR can also be used to set this value.
2) Rescaling support consists in changing the scaling factor of all FLTK windows
in reply to ctrl/+/-/0/ keystrokes.

More details for the various platforms :

- X11: Support is very advanced. Some details need still to be improved.
Automatic detection of the correct starting value of the scaling factor works well
with the gnome desktop. The present code contains no support for this on
other desktops.  FLTK_SCALING_FACTOR provides a workaround.

-WIN32: Support is incomplete at this point, although many test
applications have partial or complete HiDPI and scaling support.
The current value of the system's scaling factor is correctly detected
at application startup. Apps respond to changes of this value in real time.
Support needs to define the FLTK_HIDPI_SUPPORT preprocessor variable
at compile time. This way, standard builds produce a code with the
default WIN32 HiDPI support, that is, where all graphics goes to an internal
buffer that gets enlarged by the system and then mapped to the HiDPI
display. To experiment with (or develop) the new HiDPI support requires
a modified build procedure in which  FLTK_HIDPI_SUPPORT is defined
at compile time. When the support will be complete, the requirement for the
definition of this preprocessor variable will be removed. The present commit
contains support for a single scaling factor. Eventually, per-screen scaling
factors should be implemented, as done for X11.

- MacOS: this commit does not give new HiDPI for this platform.
Eventually, window rescaling in reply to command/+/-/0/ is desirable.
Per-screen scaling factor makes no sense on this platform because
the OS itself takes care of the difference between the resolutions of
traditional and retina displays.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12239 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-05-17 11:54:18 +00:00
Manolo Gouy
d3f1a3c167 Replace declarations such as "friend class Fl_Xlib_Graphics_Driver;" by platform-independent declarations.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12076 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-11-02 21:08:15 +00:00
Manolo Gouy
3ae2b1d74e Add virtual Fl_RGB_Image* Fl_Image::as_rgb_image() to detect whether an Fl_Image is derived from Fl_RGB_Image
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12061 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-10-30 07:26:13 +00:00
Albrecht Schlosser
e3670dfda6 Fix inconsistent interpretation of ld() in image handling (STR #3308).
Documentation has been fixed and clarified, and ld() handling is now
consistent in Fl_(RGB_)Image, their subclasses and fl_draw_image()
and similar functions.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12029 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-10-14 16:35:52 +00:00
Manolo Gouy
f551d538f2 Add Doxygen comments for the Fl_RGB_Image::alloc_array and ::array public attributes.
Also, document what is the value of alloc_array after construction of an Fl_RGB_Image object.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11897 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-27 14:16:32 +00:00
Matthias Melcher
41e22f2f39 Move ifdef's in RGB_Image into driver system.
- change image caching variable types to uintptr_t
- added driver function to uncache image data
- cleaning up (Xlib and GDI will likely throw syntax errors. Trying to fix ASAP)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11138 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-09 18:25:02 +00:00
Matthias Melcher
b1520373ae Created pseudo code for all FL_PORTED section so that FLTK compiles and links (Xcode, hello, other C flags: -D FL_PORTING -U __APPLE__ -U __APPLE_QUARTZ__)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@10993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-04 23:09:32 +00:00
Matthias Melcher
acf6c881d3 Updated platform specific #if's to report unimplemented code when compiling with FL_PORTING defined and WIN32 and __APPLE__ undefined>
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@10989 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-03 22:54:29 +00:00
Greg Ercolano
42b4db0801 Moved docs for fail() from prototype in Fl_Image.H -> implementation in Fl_Image.cxx.
Also added coded example to assist app programmers in usage. (Matt: feel free to modify
the example code as needed)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10734 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-05-24 18:19:24 +00:00
Greg Ercolano
9632e422d3 Fixes these errors on Linux:
../FL/Fl_Image.H:58: error: ISO C++ forbids initialization of member 'ERR_NO_IMAGE'
../FL/Fl_Image.H:58: error: making 'ERR_NO_IMAGE' static



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10733 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-05-24 17:19:57 +00:00
Matthias Melcher
0539009c67 STR #2873: new function Fl_Image::fail() that returns 0, ERR_NO_IMAGE, ERR_FORMAT, or ERR_FILE_ACCESS to make life easier when loading images.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10732 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-05-23 23:42:26 +00:00
Greg Ercolano
1c7daeca63 Doc clarifications for Fl_Image methods:
> inactive()
	> desaturate()
	> color_average()



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10725 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-28 20:51:32 +00:00
Manolo Gouy
1c3163f206 More detailed Doxygen doc of Fl_Shared_Image::scale() and Fl_Image::draw(X,Y,W,H,cx,cy).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10618 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-03-12 08:59:14 +00:00
Manolo Gouy
dbde470f8d Added Fl_Shared_Image::scale(width, height) to support scaled image drawing (STR #3185).
Useful for printing, PostScript or PDF output, or retina displays.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10615 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-03-10 21:06:22 +00:00
Albrecht Schlosser
8c91c679e0 Fix doxygen warning.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10379 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-10-14 13:32:59 +00:00
Albrecht Schlosser
d24a6b2633 Move RGB image scaling algorithm methods in base class Fl_Image.
See also discussion in fltk.coredev of Sept 07, 2014 and later
with subject "Fixing the nearest-neighbour scaling".


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10377 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-10-14 11:53:51 +00:00
Manolo Gouy
1e2f990177 Added Doxygen comments for enum Fl_RGB_Scaling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10374 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-10-13 11:25:36 +00:00
Lauri Kasanen
e521c16ab3 Tweak the scaling() comment
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10269 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-03 19:24:42 +00:00
Lauri Kasanen
cce4cece01 Add bilinear scaling support. STRs #2869 and #3062.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10268 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-03 11:00:56 +00:00
Pierre Ossman
ed7983f5b5 Add ability to convert a Fl_Pixmap into a Fl_RGB_Image.
This is very convenient as a lot of other functions only accept
a Fl_RGB_Image. Adding this functionality also required a bit
of spring cleaning in the the drawing routines. STR #2659.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10192 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-06-12 13:28:04 +00:00
Manolo Gouy
cff8941836 Fix STR#2881: the new static function Fl_RGB_Image::max_size(size) allows to control the maximum
memory size allowed when creating an Fl_RGB_Image.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9709 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-11-09 16:02:08 +00:00
Greg Ercolano
adf9aff218 Removed errant D=0 docs that were not relevant to Fl_RGB_Image (thanks manolo).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9595 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-06-13 17:47:03 +00:00
Greg Ercolano
8116b1d6cb Improved docs for Fl_RGB_Image() ctor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9594 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-06-13 13:13:40 +00:00
Greg Ercolano
4f4a8fc3c7 Modifications to all LGPL headers for STR #2685.
(to clarify static exception LGPL by changing license references)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8864 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-07-19 04:49:30 +00:00
Manolo Gouy
d4ad141d4d Reorganization of the Doxygen docs of some Fl_Image class functions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8338 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-01-30 09:24:40 +00:00