Author: manolo
Date: 2012-03-12 07:20:18 -0700 (Mon, 12 Mar 2012)
New Revision: 9281
Log:
Created virtual char fltk3::GraphicsDriver::can_do_alpha_blending()
Modified:
branches/branch-3.0/include/FL/fl_draw.H
branches/branch-3.0/include/fltk3/Device.h
branches/branch-3.0/include/fltk3/draw.h
branches/branch-3.0/src/fltk3/DoubleWindow.cxx
branches/branch-3.0/src/fltk3/Image.cxx
Modified: branches/branch-3.0/include/FL/fl_draw.H
===================================================================
--- branches/branch-3.0/include/FL/fl_draw.H 2012-03-12 13:33:56 UTC (rev
9280)
+++ branches/branch-3.0/include/FL/fl_draw.H 2012-03-12 14:20:18 UTC (rev
9281)
@@ -421,12 +421,14 @@
fltk3::draw_image(cb, data, X, Y, W, H, D);
}
+inline char fl_can_do_alpha_blending() {
+ return fltk3::can_do_alpha_blending();
+}
#if 0 // FIXME: 123
FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int
Y,int W,int H, int D=1);
-FL_EXPORT char fl_can_do_alpha_blending();
#endif
Modified: branches/branch-3.0/include/fltk3/Device.h
===================================================================
--- branches/branch-3.0/include/fltk3/Device.h 2012-03-12 13:33:56 UTC (rev
9280)
+++ branches/branch-3.0/include/fltk3/Device.h 2012-03-12 14:20:18 UTC (rev
9281)
@@ -336,6 +336,8 @@
inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
/** see fltk3::copy_offscreen() */
virtual void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen
pixmap, int srcx, int srcy);
+ /** see fltk3::can_do_alpha_blending() */
+ virtual char can_do_alpha_blending() {return 0;}
/** \brief The destructor */
virtual ~GraphicsDriver() { if (p) free(p); }
};
@@ -400,6 +402,7 @@
void line_style(int style, int width=0, char* dashes=0);
void transformed_vertex(double xf, double yf);
void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
+ char can_do_alpha_blending();
#if ! defined(FLTK3_DOXYGEN)
static fltk3::Offscreen create_offscreen_with_alpha(int w, int h);
#endif
@@ -466,6 +469,7 @@
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
void line_style(int style, int width=0, char* dashes=0);
void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
+ char can_do_alpha_blending();
#if ! defined(FLTK3_DOXYGEN)
void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
#endif
@@ -528,6 +532,7 @@
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
void line_style(int style, int width=0, char* dashes=0);
void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
+ char can_do_alpha_blending();
};
#endif
Modified: branches/branch-3.0/include/fltk3/draw.h
===================================================================
--- branches/branch-3.0/include/fltk3/draw.h 2012-03-12 13:33:56 UTC (rev
9280)
+++ branches/branch-3.0/include/fltk3/draw.h 2012-03-12 14:20:18 UTC (rev
9281)
@@ -726,8 +726,9 @@
\returns 1 if true alpha blending supported by platform
\returns 0 not supported so FLTK will use screen door transparency
*/
- /* note: doxygen comment here to avoid triplication in os-speciic files */
- FLTK3_EXPORT char can_do_alpha_blending();
+ inline char can_do_alpha_blending() {
+ return fltk3::graphics_driver->can_do_alpha_blending();
+ }
/**
Reads an RGB(A) image from the current window or off-screen buffer.
Modified: branches/branch-3.0/src/fltk3/DoubleWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-12 13:33:56 UTC
(rev 9280)
+++ branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-12 14:20:18 UTC
(rev 9281)
@@ -99,7 +99,7 @@
// maybe someone feels inclined to implement alpha blending on X11?
-char fltk3::can_do_alpha_blending() {
+char fltk3::XlibGraphicsDriver::can_do_alpha_blending() {
return 0;
}
#elif defined(WIN32)
@@ -118,7 +118,7 @@
* curently run on supports alpha blending for bitmap transfers
* and finds the required function if so.
*/
-char fltk3::can_do_alpha_blending() {
+char fltk3::GDIGraphicsDriver::can_do_alpha_blending() {
static char been_here = 0;
static char can_do = 0;
// do this test only once
@@ -182,8 +182,8 @@
// first try to alpha blend
// if to printer, always try alpha_blend
int to_display = fltk3::SurfaceDevice::surface()->class_name() ==
fltk3::DisplayDevice::class_id; // true iff display output
- if ( (to_display && fltk3::can_do_alpha_blending()) ||
fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
- alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h,
blendfunc);
+ if ( (to_display && can_do_alpha_blending()) ||
fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+ if (fl_alpha_blend) alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc,
srcx, srcy, w, h, blendfunc);
}
// if that failed (it shouldn't), still copy the bitmap over, but now alpha
is 1
if (!alpha_ok) {
@@ -197,7 +197,7 @@
#elif defined(__APPLE_QUARTZ__) || defined(FLTK3_DOXYGEN)
-char fltk3::can_do_alpha_blending() {
+char fltk3::QuartzGraphicsDriver::can_do_alpha_blending() {
return 1;
}
Modified: branches/branch-3.0/src/fltk3/Image.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Image.cxx 2012-03-12 13:33:56 UTC (rev
9280)
+++ branches/branch-3.0/src/fltk3/Image.cxx 2012-03-12 14:20:18 UTC (rev
9281)
@@ -503,7 +503,7 @@
}
if (!img->id_) {
img->id_ = fl_create_offscreen(img->w(), img->h());
- if ((img->d() == 2 || img->d() == 4) && fltk3::can_do_alpha_blending()) {
+ if ((img->d() == 2 || img->d() == 4) && can_do_alpha_blending()) {
fl_begin_offscreen((fltk3::Offscreen)img->id_);
fltk3::draw_image(img->array, 0, 0, img->w(), img->h(),
img->d()|fltk3::IMAGE_WITH_ALPHA, img->ld());
fl_end_offscreen();
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit