FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Bitmap.H
1//
2// Bitmap 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_Bitmap widget . */
19
20#ifndef Fl_Bitmap_H
21#define Fl_Bitmap_H
22#include "Fl_Image.H"
23#include "Fl_Widget.H" // for fl_uintptr_t
24
25 class Fl_Widget;
26 struct Fl_Menu_Item;
27
32 class FL_EXPORT Fl_Bitmap : public Fl_Image {
33 friend class Fl_Graphics_Driver;
34 public:
36 const uchar *array;
38 int alloc_array;
39
40 private:
42 fl_uintptr_t id_;
43 int cache_w_, cache_h_; // size of bitmap when cached
44
45 public:
48 Fl_Bitmap(const uchar *bits, int W, int H) :
49 Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);}
50
52 Fl_Bitmap(const char *bits, int W, int H) :
53 Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);}
54 Fl_Bitmap(const uchar *bits, int bits_length, int W, int H);
55 Fl_Bitmap(const char *bits, int bits_length, int W, int H);
56 virtual ~Fl_Bitmap();
57 Fl_Image *copy(int W, int H) const FL_OVERRIDE;
58 Fl_Image *copy() const { return Fl_Image::copy(); }
59 void draw(int X, int Y, int W, int H, int cx=0, int cy=0) FL_OVERRIDE;
60 void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
61 void label(Fl_Widget*w) FL_OVERRIDE;
62 void label(Fl_Menu_Item*m) FL_OVERRIDE;
63 void uncache() FL_OVERRIDE;
64 int cache_w() {return cache_w_;}
65 int cache_h() {return cache_h_;}
66};
67
68#endif
Fl_Image.H
Fl_Image, Fl_RGB_Image classes.
Fl_Widget.H
Fl_Widget and Fl_Label classes.
Fl_Bitmap
The Fl_Bitmap class supports caching and drawing of mono-color (bitmap) images.
Definition Fl_Bitmap.H:32
Fl_Bitmap::array
const uchar * array
pointer to raw bitmap data
Definition Fl_Bitmap.H:36
Fl_Bitmap::Fl_Bitmap
Fl_Bitmap(const char *bits, int W, int H)
The constructors create a new bitmap from the specified bitmap data.
Definition Fl_Bitmap.H:52
Fl_Bitmap::alloc_array
int alloc_array
Non-zero if array points to bitmap data allocated internally.
Definition Fl_Bitmap.H:38
Fl_Bitmap::Fl_Bitmap
Fl_Bitmap(const uchar *bits, int W, int H)
The constructors create a new bitmap from the specified bitmap data.
Definition Fl_Bitmap.H:48
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::data
const char *const * data() const
Returns a pointer to the current image data array.
Definition Fl_Image.H:191
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_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