FLTK 1.3.11
Toggle main menu visibility
Loading...
Searching...
No Matches
Fl_Shared_Image.H
Go to the documentation of this file.
1
//
2
// "$Id$"
3
//
4
// Shared image header file for the Fast Light Tool Kit (FLTK).
5
//
6
// Copyright 1998-2017 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
21
22
#ifndef Fl_Shared_Image_H
23
# define Fl_Shared_Image_H
24
25
# include "
Fl_Image.H
"
26
27
#undef SHIM_DEBUG
28
29
// Test function for adding new formats
30
typedef
Fl_Image
*(*Fl_Shared_Handler)(
const
char
*name,
uchar
*header,
31
int
headerlen);
32
33
// Shared images class.
51
class
FL_EXPORT
Fl_Shared_Image
:
public
Fl_Image {
52
53
friend
class
Fl_JPEG_Image;
54
friend
class
Fl_PNG_Image;
55
56
private
:
57
static
Fl_RGB_Scaling
scaling_algorithm_;
// method used to rescale RGB source images
58
#if FLTK_ABI_VERSION >= 10304
59
Fl_Image *scaled_image_;
60
#endif
61
protected
:
62
63
static
Fl_Shared_Image
**images_;
// Shared images
64
static
int
num_images_;
// Number of shared images
65
static
int
alloc_images_;
// Allocated shared images
66
static
Fl_Shared_Handler *handlers_;
// Additional format handlers
67
static
int
num_handlers_;
// Number of format handlers
68
static
int
alloc_handlers_;
// Allocated format handlers
69
70
const
char
*name_;
// Name of image file
71
int
original_;
// Original image?
72
int
refcount_;
// Number of times this image has been used
73
Fl_Image *image_;
// The image that is shared
74
int
alloc_image_;
// Was the image allocated?
75
76
static
int
compare
(
Fl_Shared_Image
**i0,
Fl_Shared_Image
**i1);
77
78
// Use get() and release() to load/delete images in memory...
79
Fl_Shared_Image
();
80
Fl_Shared_Image
(
const
char
*n, Fl_Image *img = 0);
81
virtual
~Fl_Shared_Image
();
82
void
add
();
83
void
update();
84
85
public
:
86
#ifdef SHIM_DEBUG
87
static
void
print_pool();
88
#endif
89
91
const
char
*
name
() {
return
name_; }
92
96
int
refcount
() {
return
refcount_; }
97
105
int
original
() {
return
original_; }
106
107
void
release();
108
void
reload();
109
110
virtual
Fl_Image
*copy(
int
W,
int
H);
111
Fl_Image
*copy() {
return
copy(w(), h()); }
112
virtual
void
color_average(
Fl_Color
c,
float
i);
113
virtual
void
desaturate();
114
virtual
void
draw(
int
X,
int
Y,
int
W,
int
H,
int
cx,
int
cy);
115
void
draw(
int
X,
int
Y) { draw(X, Y, w(), h(), 0, 0); }
116
void
scale(
int
width,
int
height,
int
proportional = 1,
int
can_expand = 0);
117
virtual
void
uncache();
118
119
static
Fl_Shared_Image *find(
const
char
*name,
int
W = 0,
int
H = 0);
120
static
Fl_Shared_Image *get(
const
char
*name,
int
W = 0,
int
H = 0);
121
static
Fl_Shared_Image *get(Fl_RGB_Image *rgb,
int
own_it = 1);
122
static
Fl_Shared_Image **images();
123
static
int
num_images();
124
static
void
add_handler(Fl_Shared_Handler f);
125
static
void
remove_handler(Fl_Shared_Handler f);
134
static
void
scaling_algorithm
(
Fl_RGB_Scaling
algorithm) {scaling_algorithm_ = algorithm; }
135
};
136
137
//
138
// The following function is provided in the fltk_images library and
139
// registers all of the "extra" image file formats that are not part
140
// of the core FLTK library...
141
//
142
143
FL_EXPORT
extern
void
fl_register_images
();
144
145
#endif
// !Fl_Shared_Image_H
146
147
//
148
// End of "$Id$"
149
//
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition
Enumerations.H:941
Fl_Image.H
Fl_Image, Fl_RGB_Image classes.
Fl_RGB_Scaling
Fl_RGB_Scaling
The scaling algorithm to use for RGB images.
Definition
Fl_Image.H:37
fl_register_images
FL_EXPORT void fl_register_images()
Register the image formats.
Definition
fl_images_core.cxx:54
Fl_Image
Base class for image caching and drawing.
Definition
Fl_Image.H:55
Fl_Shared_Image::add
void add()
Adds a shared image to the image cache.
Definition
Fl_Shared_Image.cxx:155
Fl_Shared_Image::compare
static int compare(Fl_Shared_Image **i0, Fl_Shared_Image **i1)
Compares two shared images.
Definition
Fl_Shared_Image.cxx:88
Fl_Shared_Image::name
const char * name()
Returns the filename of the shared image.
Definition
Fl_Shared_Image.H:91
Fl_Shared_Image::scaling_algorithm
static void scaling_algorithm(Fl_RGB_Scaling algorithm)
Sets what algorithm is used when resizing a source image.
Definition
Fl_Shared_Image.H:134
Fl_Shared_Image::Fl_Shared_Image
Fl_Shared_Image()
Creates an empty shared image.
Definition
Fl_Shared_Image.cxx:108
Fl_Shared_Image::original
int original()
Returns whether this is an original image.
Definition
Fl_Shared_Image.H:105
Fl_Shared_Image::refcount
int refcount()
Returns the number of references of this shared image.
Definition
Fl_Shared_Image.H:96
uchar
unsigned char uchar
unsigned char
Definition
fl_types.h:30
FL
Fl_Shared_Image.H
Generated by
1.18.0