FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Pixmap.H
1//
2// Pixmap header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2017 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Pixmap widget . */
19
20#ifndef Fl_Pixmap_H
21#define Fl_Pixmap_H
22# include "Fl_Image.H"
23
24 class Fl_Widget;
25 struct Fl_Menu_Item;
26
27// Older C++ compilers don't support the explicit keyword... :(
28# if defined(__sgi) && !defined(_COMPILER_VERSION)
29# define explicit
30# endif // __sgi && !_COMPILER_VERSION
31
36 class FL_EXPORT Fl_Pixmap : public Fl_Image {
37 friend class Fl_Graphics_Driver;
38 void copy_data();
39 void delete_data();
40 void set_data(const char * const *p);
41
42 protected:
43 void measure();
44
45 public:
46
47 int alloc_data; // Non-zero if data was allocated
48
49 private:
50 // for internal use
51 fl_uintptr_t id_;
52 fl_uintptr_t mask_;
53 int cache_w_, cache_h_; // size of pixmap when cached
54
55 public:
56
58 explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
60 explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
62 explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
64 explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
65 virtual ~Fl_Pixmap();
66 Fl_Image *copy(int W, int H) const FL_OVERRIDE;
67 Fl_Image *copy() const { return Fl_Image::copy(); }
68 void color_average(Fl_Color c, float i) FL_OVERRIDE;
69 void desaturate() FL_OVERRIDE;
70 void draw(int X, int Y, int W, int H, int cx=0, int cy=0) FL_OVERRIDE;
71 void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
72 void label(Fl_Widget*w) FL_OVERRIDE;
73 void label(Fl_Menu_Item*m) FL_OVERRIDE;
74 void uncache() FL_OVERRIDE;
75 int cache_w() {return cache_w_;}
76 int cache_h() {return cache_h_;}
77};
78
79#endif
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Image.H
Fl_Image, Fl_RGB_Image classes.
Fl_Image
Base class for image caching, scaling and drawing.
Definition Fl_Image.H:60
Fl_Image::draw
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image to the current drawing surface with a bounding box.
Definition Fl_Image.cxx:62
Fl_Image::desaturate
virtual void desaturate()
The desaturate() method converts an image to grayscale.
Definition Fl_Image.cxx:144
Fl_Image::color_average
virtual void color_average(Fl_Color c, float i)
The color_average() method averages the colors in the image with the provided FLTK color value.
Definition Fl_Image.cxx:132
Fl_Image::w
int w() const
Returns the current image drawing width in FLTK units.
Definition Fl_Image.H:131
Fl_Image::copy
Fl_Image * copy() const
Creates a copy of the image in the same size.
Definition Fl_Image.H:266
Fl_Image::label
virtual void label(Fl_Widget *w)
This method is an obsolete way to set the image attribute of a widget or menu item.
Definition Fl_Image.cxx:163
Fl_Image::h
int h() const
Returns the current image drawing height in FLTK units.
Definition Fl_Image.H:137
Fl_Image::uncache
virtual void uncache()
If the image has been cached for display, delete the cache data.
Definition Fl_Image.cxx:59
Fl_Pixmap
The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency.
Definition Fl_Pixmap.H:36
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(char *const *D)
The constructors create a new pixmap from the specified XPM data.
Definition Fl_Pixmap.H:58
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(uchar *const *D)
The constructors create a new pixmap from the specified XPM data.
Definition Fl_Pixmap.H:60
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(const uchar *const *D)
The constructors create a new pixmap from the specified XPM data.
Definition Fl_Pixmap.H:64
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(const char *const *D)
The constructors create a new pixmap from the specified XPM data.
Definition Fl_Pixmap.H:62
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
fl_uintptr_t
opaque fl_uintptr_t
An unsigned integral type large enough to store a pointer or an unsigned long value.
Definition platform_types.h:36