FLTK 1.3.2
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
Fl_Shared_Image.H
Go to the documentation of this file.
1
//
2
// "$Id: Fl_Shared_Image.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
3
//
4
// Shared image header file for the Fast Light Tool Kit (FLTK).
5
//
6
// Copyright 1998-2010 by Bill Spitzak and others.
7
//
8
// This library is free software. Distribution and use rights are outlined in
9
// the file "COPYING" which should have been included with this file. If this
10
// file is missing or damaged, see the license at:
11
//
12
// http://www.fltk.org/COPYING.php
13
//
14
// Please report all bugs and problems on the following page:
15
//
16
// http://www.fltk.org/str.php
17
//
18
22
#ifndef Fl_Shared_Image_H
23
# define Fl_Shared_Image_H
24
25
# include "Fl_Image.H"
26
27
28
// Test function for adding new formats
29
typedef
Fl_Image
*(*Fl_Shared_Handler)(
const
char
*name,
uchar
*header,
30
int
headerlen);
31
32
// Shared images class.
40
class
FL_EXPORT
Fl_Shared_Image
:
public
Fl_Image
{
41
42
friend
class
Fl_JPEG_Image
;
43
friend
class
Fl_PNG_Image
;
44
45
protected
:
46
47
static
Fl_Shared_Image
**images_;
// Shared images
48
static
int
num_images_;
// Number of shared images
49
static
int
alloc_images_;
// Allocated shared images
50
static
Fl_Shared_Handler *handlers_;
// Additional format handlers
51
static
int
num_handlers_;
// Number of format handlers
52
static
int
alloc_handlers_;
// Allocated format handlers
53
54
const
char
*name_;
// Name of image file
55
int
original_;
// Original image?
56
int
refcount_;
// Number of times this image has been used
57
Fl_Image
*image_;
// The image that is shared
58
int
alloc_image_;
// Was the image allocated?
59
60
static
int
compare(
Fl_Shared_Image
**i0,
Fl_Shared_Image
**i1);
61
62
// Use get() and release() to load/delete images in memory...
63
Fl_Shared_Image
();
64
Fl_Shared_Image
(
const
char
*n,
Fl_Image
*img = 0);
65
virtual
~
Fl_Shared_Image
();
66
void
add();
67
void
update();
68
69
public
:
71
const
char
*
name
() {
return
name_; }
73
int
refcount
() {
return
refcount_; }
74
void
release();
75
void
reload();
76
77
virtual
Fl_Image
*
copy
(
int
W,
int
H);
78
Fl_Image
*
copy
() {
return
copy
(
w
(),
h
()); }
79
virtual
void
color_average
(
Fl_Color
c,
float
i);
80
virtual
void
desaturate
();
81
virtual
void
draw
(
int
X,
int
Y,
int
W,
int
H,
int
cx,
int
cy);
82
void
draw
(
int
X,
int
Y) {
draw
(X, Y,
w
(),
h
(), 0, 0); }
83
virtual
void
uncache
();
84
85
static
Fl_Shared_Image
*find(
const
char
*n,
int
W = 0,
int
H = 0);
86
static
Fl_Shared_Image
*
get
(
const
char
*n,
int
W = 0,
int
H = 0);
87
static
Fl_Shared_Image
**images();
88
static
int
num_images();
89
static
void
add_handler(Fl_Shared_Handler f);
90
static
void
remove_handler(Fl_Shared_Handler f);
91
};
92
93
//
94
// The following function is provided in the fltk_images library and
95
// registers all of the "extra" image file formats that are not part
96
// of the core FLTK library...
97
//
98
99
FL_EXPORT
extern
void
fl_register_images
();
100
101
#endif // !Fl_Shared_Image_H
102
103
//
104
// End of "$Id: Fl_Shared_Image.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
105
//
© 1998-2012 by Bill Spitzak and others.