fltk
1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Fossies Dox: fltk-1.3.5-source.tar.bz2 ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 36 # if HAVE_X11_XREGION_H 37 # include <X11/Xregion.h> 38 # else // if the X11/Xregion.h header is not available, we assume this is the layout of an X11 Region: 48 # endif // HAVE_X11_XREGION_H 66 if (
w()<0 &&
data()) {
76 static int start(
Fl_Pixmap *pxm,
int XP,
int YP,
int WP,
int HP,
int w,
int h,
int &cx,
int &cy,
77 int &X,
int &
Y,
int &W,
int &
H)
92 cx += X-XP; cy +=
Y-YP;
94 if (cx < 0) {W += cx; X -= cx; cx = 0;}
95 if (cx+W > w) W = w-cx;
97 if (cy < 0) {
H += cy;
Y -= cy; cy = 0;}
98 if (cy+
H > h)
H = h-cy;
104 int &X,
int &
Y,
int &W,
int &
H) {
106 int code =
start(
this, XP, YP, WP, HP,
w(),
h(), cx, cy, X,
Y, W,
H);
113 id_ = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(
w(),
h());
125 extern UINT win_pixmap_bg_color;
126 this->pixmap_bg_color = win_pixmap_bg_color;
140 #ifdef __APPLE__ // Apple, Mac OS X 145 if (pxm->
prepare(XP, YP, WP, HP, cx, cy, X,
Y, W,
H))
return;
150 #elif defined(WIN32) // Windows GDI 155 if (pxm->
prepare(XP, YP, WP, HP, cx, cy, X,
Y, W,
H))
return;
157 HDC new_gc = CreateCompatibleDC(
fl_gc);
158 int save = SaveDC(new_gc);
159 SelectObject(new_gc, (
void*)pxm->
mask_);
160 BitBlt(
fl_gc, X,
Y, W,
H, new_gc, cx, cy, SRCAND);
161 SelectObject(new_gc, (
void*)pxm->
id_);
162 BitBlt(
fl_gc, X,
Y, W,
H, new_gc, cx, cy, SRCPAINT);
163 RestoreDC(new_gc,save);
170 #if FLTK_ABI_VERSION < 10301 171 UINT Fl_Pixmap::pixmap_bg_color = 0;
176 if (pxm->
prepare(XP, YP, WP, HP, cx, cy, X,
Y, W,
H))
return;
177 typedef BOOL (WINAPI* fl_transp_func) (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
178 static HMODULE hMod =
NULL;
179 static fl_transp_func fl_TransparentBlt =
NULL;
181 hMod = LoadLibrary(
"MSIMG32.DLL");
182 if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod,
"TransparentBlt");
184 if (fl_TransparentBlt) {
185 HDC new_gc = CreateCompatibleDC(
fl_gc);
186 int save = SaveDC(new_gc);
187 SelectObject(new_gc, (
void*)pxm->
id_);
189 fl_TransparentBlt(
fl_gc, X,
Y, W,
H, new_gc, cx, cy, W,
H, pxm->pixmap_bg_color );
190 RestoreDC(new_gc,save);
204 if (pxm->
prepare(XP, YP, WP, HP, cx, cy, X,
Y, W,
H))
return;
222 for (
int i = 0; i < r->numRects; i++) {
225 W1 = r->rects[i].x2 - r->rects[i].x1;
226 H1 = r->rects[i].y2 - r->rects[i].y1;
241 #endif // (platform-specific) 289 if (
ncolors < 0) new_data =
new char *[
h() + 2];
290 else new_data =
new char *[
h() +
ncolors + 1];
292 new_data[0] =
new char[strlen(
data()[0]) + 1];
293 strcpy(new_data[0],
data()[0]);
299 new_row = new_data + 1;
300 *new_row =
new char[
ncolors * 4];
306 for (i = 0, new_row = new_data + 1; i <
ncolors; i ++, new_row ++) {
307 *new_row =
new char[strlen(
data()[i + 1]) + 1];
308 strcpy(*new_row,
data()[i + 1]);
313 for (i = 0; i <
h(); i ++, new_row ++) {
314 *new_row =
new char[chars_per_line];
315 memcpy(*new_row,
data()[i +
ncolors + 1], chars_per_line);
327 if (W ==
w() &&
H ==
h()) {
333 if (W <= 0 ||
H <= 0)
return 0;
365 if (
ncolors < 0) new_data =
new char *[
H + 2];
366 else new_data =
new char *[
H +
ncolors + 1];
367 new_data[0] =
new char[strlen(new_info) + 1];
368 strcpy(new_data[0], new_info);
374 new_row = new_data + 1;
375 *new_row =
new char[
ncolors * 4];
381 for (i = 0, new_row = new_data + 1; i <
ncolors; i ++, new_row ++) {
382 *new_row =
new char[strlen(
data()[i + 1]) + 1];
383 strcpy(*new_row,
data()[i + 1]);
388 for (
dy =
H, sy = 0, yerr =
H;
dy > 0;
dy --, new_row ++) {
389 *new_row =
new char[chars_per_line];
415 new_image =
new Fl_Pixmap((
char*
const*)new_data);
430 unsigned ia, ir, ig, ib;
433 if (i < 0.0
f) i = 0.0f;
434 else if (i > 1.0
f) i = 1.0f;
436 ia = (unsigned)(256 * i);
464 const char *previous_word =
p;
466 while (*
p && isspace(*
p))
p++;
468 while (*
p && !isspace(*
p))
p++;
469 while (*
p && isspace(*
p))
p++;
470 if (!*
p) {
p = previous_word;
break;}
471 if (what ==
'c')
break;
473 while (*
p && !isspace(*
p))
p++;
477 r = (ia * r + ir) >> 8;
478 g = (ia * g + ig) >> 8;
479 b = (ia *
b + ib) >> 8;
484 else sprintf(line,
"%c c #%02X%02X%02X",
data()[
color + 1][0], r, g,
b);
487 ((
char **)
data())[
color + 1] =
new char[strlen(line) + 1];
496 for (
int i = 0; i <
count(); i ++)
delete[] (
char *)
data()[i];
497 delete[] (
char **)
data();
506 sscanf(
p[0],
"%*d%d%d", &height, &
ncolors);
539 for (i = 0; i <
ncolors; i ++) {
542 const char *previous_word =
p;
544 while (*
p && isspace(*
p))
p++;
546 while (*
p && !isspace(*
p))
p++;
547 while (*
p && isspace(*
p))
p++;
548 if (!*
p) {
p = previous_word;
break;}
549 if (what ==
'c')
break;
551 while (*
p && !isspace(*
p))
p++;
555 g = (
uchar)((r * 31 + g * 61 +
b * 8) / 100);
558 data()[i + 1][1], g, g, g);
559 else sprintf(line,
"%c c #%02X%02X%02X",
data()[i + 1][0], g, g, g);
561 delete[] (
char *)
data()[i + 1];
562 ((
char **)
data())[i + 1] =
new char[strlen(line) + 1];
563 strcpy((
char *)
data()[i + 1], line);
void data(const char *const *p, int c)
static int chars_per_pixel
const char *const * data() const
Base class for image caching and drawing.
static int start(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, int &X, int &Y, int &W, int &H)
virtual void color_average(Fl_Color c, float i)
void set_data(const char *const *p)
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy)
virtual void draw(const char *str, int n, int x, int y)
see fl_draw(const char *str, int n, int x, int y).
static unsigned get_color(Fl_Color i)
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data)
static void measure(const Fl_Label *lo, int &lw, int &lh)
void fl_delete_bitmask(Fl_Bitmask bm)
static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la)
FL_EXPORT int fl_measure_pixmap(char *const *data, int &w, int &h)
static void draw(int which, int x, int y, int w, int h, int inset)
utility header to pull drawing functions together
void draw_empty(int X, int Y)
int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
int fl_parse_color(const char *p, uchar &r, uchar &g, uchar &b)
void restore_clip()
see fl_restore_clip().
Fl_Pixmap(char *const *D)
int prepare(int XP, int YP, int WP, int HP, int &cx, int &cy, int &X, int &Y, int &W, int &H)
FL_EXPORT HINSTANCE fl_display
END TIMERS.
virtual void label(Fl_Widget *w)
declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.
FL_EXPORT Fl_Graphics_Driver * fl_graphics_driver
Points to the driver that currently receives all graphics requests.
void fl_delete_offscreen(Fl_Offscreen gWorld)
Fl_Region XRectangleRegion(int x, int y, int w, int h)
static short cmap[256][3]
void draw(const char *str, int n, int x, int y)
see fl_draw(const char *str, int n, int x, int y).
virtual void desaturate()
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0)
static void set_labeltype(Fl_Labeltype, Fl_Label_Draw_F *, Fl_Label_Measure_F *)
Fl_Region clip_region()
see fl_clip_region().
void fl_begin_offscreen(Fl_Offscreen gWorld)
FL_EXPORT int fl_draw_pixmap(char *const *data, int x, int y, Fl_Color=FL_GRAY)
void fl_release_dc(HWND w, HDC dc)
CGContextRef Fl_Offscreen
Fl_Offscreen fl_create_offscreen(int w, int h)
the label displays an "icon" based on a Fl_Image
void rects(int x, int y, int r, int t)