FLTK 1.3.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
Fl_Image.H
1
//
2
// "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $"
3
//
4
// Image header file for the Fast Light Tool Kit (FLTK).
5
//
6
// Copyright 1998-2011 by Bill Spitzak and others.
7
//
8
// This library is free software; you can redistribute it and/or
9
// modify it under the terms of the GNU Library General Public
10
// License as published by the Free Software Foundation; either
11
// version 2 of the License, or (at your option) any later version.
12
//
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
// Library General Public License for more details.
17
//
18
// You should have received a copy of the GNU Library General Public
19
// License along with this library; if not, write to the Free Software
20
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
// USA.
22
//
23
// Please report all bugs and problems on the following page:
24
//
25
// http://www.fltk.org/str.php
26
//
27
28
/* \file
29
Fl_Image, Fl_RGB_Image classes . */
30
31
#ifndef Fl_Image_H
32
# define Fl_Image_H
33
34
# include "
Enumerations.H
"
35
36
class
Fl_Widget
;
37
struct
Fl_Menu_Item
;
38
struct
Fl_Label
;
39
51
class
FL_EXPORT
Fl_Image
{
52
int
w_, h_, d_, ld_, count_;
53
const
char
*
const
*data_;
54
55
// Forbid use of copy contructor and assign operator
56
Fl_Image
& operator=(
const
Fl_Image
&);
57
Fl_Image
(
const
Fl_Image
&);
58
59
protected
:
60
64
void
w
(
int
W) {w_ = W;}
68
void
h
(
int
H) {h_ = H;}
72
void
d
(
int
D) {d_ = D;}
76
void
ld
(
int
LD) {ld_ = LD;}
80
void
data
(
const
char
*
const
*p,
int
c) {data_ = p; count_ = c;}
81
void
draw_empty(
int
X,
int
Y);
82
83
static
void
labeltype(
const
Fl_Label
*lo,
int
lx,
int
ly,
int
lw,
int
lh,
Fl_Align
la);
84
static
void
measure(
const
Fl_Label
*lo,
int
&lw,
int
&lh);
85
86
public
:
87
91
int
w
()
const
{
return
w_;}
94
int
h
()
const
{
return
h_;}
100
int
d
()
const
{
return
d_;}
106
int
ld
()
const
{
return
ld_;}
113
int
count
()
const
{
return
count_;}
118
const
char
*
const
*
data
()
const
{
return
data_;}
119
126
Fl_Image
(
int
W,
int
H,
int
D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
127
virtual
~
Fl_Image
();
128
virtual
Fl_Image
*copy(
int
W,
int
H);
136
Fl_Image
*
copy
() {
return
copy
(w(), h()); }
137
virtual
void
color_average(
Fl_Color
c,
float
i);
144
void
inactive
() { color_average(FL_GRAY, .33f); }
145
virtual
void
desaturate();
146
virtual
void
label(
Fl_Widget
*w);
147
virtual
void
label(
Fl_Menu_Item
*m);
155
virtual
void
draw(
int
X,
int
Y,
int
W,
int
H,
int
cx=0,
int
cy=0);
// platform dependent
160
void
draw
(
int
X,
int
Y) {
draw
(X, Y, w(), h(), 0, 0);}
// platform dependent
161
virtual
void
uncache();
162
};
163
175
class
FL_EXPORT
Fl_RGB_Image
:
public
Fl_Image
{
176
friend
class
Fl_Quartz_Graphics_Driver
;
177
friend
class
Fl_GDI_Graphics_Driver
;
178
friend
class
Fl_Xlib_Graphics_Driver
;
179
public
:
180
181
const
uchar
*array;
182
int
alloc_array;
// Non-zero if array was allocated
183
184
private
:
185
186
#if defined(__APPLE__) || defined(WIN32)
187
void
*id_;
// for internal use
188
void
*mask_;
// for internal use (mask bitmap)
189
#else
190
unsigned
id_;
// for internal use
191
unsigned
mask_;
// for internal use (mask bitmap)
192
#endif // __APPLE__ || WIN32
193
194
public
:
195
197
Fl_RGB_Image
(
const
uchar
*bits,
int
W,
int
H,
int
D=3,
int
LD=0) :
198
Fl_Image
(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {
data
((
const
char
**)&array, 1);
ld
(LD);}
199
virtual
~
Fl_RGB_Image
();
200
virtual
Fl_Image
*
copy
(
int
W,
int
H);
201
Fl_Image
*
copy
() {
return
copy
(
w
(),
h
()); }
202
virtual
void
color_average
(
Fl_Color
c,
float
i);
203
virtual
void
desaturate
();
204
virtual
void
draw
(
int
X,
int
Y,
int
W,
int
H,
int
cx=0,
int
cy=0);
205
void
draw
(
int
X,
int
Y) {
draw
(X, Y,
w
(),
h
(), 0, 0);}
206
virtual
void
label
(
Fl_Widget
*w);
207
virtual
void
label
(
Fl_Menu_Item
*m);
208
virtual
void
uncache
();
209
};
210
211
#endif // !Fl_Image_H
212
213
//
214
// End of "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $".
215
//
© 1998-2011 by Bill Spitzak and others.
© 1998-2011 by Bill Spitzak and others. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.