#include <pixmap.h>
Inheritance diagram for Wt::Pixmap:
Public Types | |
NoOptim | |
BestOptim | |
DefaultOptim = BestOptim | |
enum | Optimization { NoOptim, BestOptim, DefaultOptim = BestOptim } |
Public Member Functions | |
Pixmap () | |
constructor for NULL pixmap or default display | |
Pixmap (int w, int h, int depth=-1, int flags=0, Optimization optimization=DefaultOptim) | |
constructor for a sized, non display, pixmap | |
Pixmap (const Size &size, int depth=-1, int flags=0, Optimization optimization=DefaultOptim) | |
constructor for a sized, non display, pixmap | |
Pixmap (const PixmapBase &pixmap) | |
copy shares the pixmap | |
Pixmap (const SDLSurface &sdlsurface) | |
constructor from SDLSurface (for scale to work implicitely) | |
Pixmap (const std::string &filename) | |
constructor from file | |
void | fill (const Color &color=Color("white")) |
void | fill (const Rect &dst, const Color &color=Color("white")) |
void | fill (const Region &dst, const Color &color=Color("white")) |
void | blend (const Color &color=Color("white"), int alpha_blend_factor=Color::Transparent) |
void | blend (const Rect &dst, const Color &color=Color("white"), int alpha_blend_factor=Color::Transparent) |
void | blend (const Region &dst, const Color &color=Color("white"), int alpha_blend_factor=Color::Transparent) |
int | blit (const Point &p, const PixmapBase &src) |
int | blit (const Point &p, const PixmapBase &src, const Rect &src_rect) |
int | blitAlphaCopy (const Point &p, const PixmapBase &src) |
int | blitAlphaCopy (const Point &p, const PixmapBase &src, const Rect &src_rect) |
int | blitAlphaBlend (int x, int y, const PixmapBase &src, const Rect &src_rect, int alpha_blend_factor=Color::Transparent) |
copy to from src rect with alpha blending | |
int | blitAlphaBlend (const PixmapBase &src, int alpha_blend_factor=Color::Transparent) |
copy to from src with alpha blending | |
int | blitAlphaBlend (int x, int y, const PixmapBase &src, int alpha_blend_factor=Color::Transparent) |
copy to from src with alpha blending | |
int | blitAlphaBlend (const Point &p, const PixmapBase &src, int alpha_blend_factor=Color::Transparent) |
int | blitAlphaBlend (const Point &p, const PixmapBase &src, const Rect &src_rect, int alpha_blend_factor=Color::Transparent) |
void | resize (const Size &size) |
PixmapBase | scale (const Size &size, SDLSurface::ScaleMode mode=SDLSurface::ScaleFree) const |
PixmapBase | smoothScale (const Size &size, SDLSurface::ScaleMode mode=SDLSurface::ScaleFree) const |
int | pixel (const Point &p) const |
Color | pixelColor (const Point &p) const |
void | setPixel (const Point &p, int pixel_value) |
void | setPixelColor (const Point &p, const SDLColor &color) |
PixmapBase | copy () const |
PixmapBase | copy (int x, int y, int w, int h) const |
PixmapBase | copy (const Rect &r) const |
Informative methods | |
bool | isNull () const |
Size | size () const |
Rect | rect () const |
Protected Types | |
typedef PixmapOf< SDLSurface > | PixmapBase |
Definition at line 288 of file pixmap.h.
typedef PixmapOf<SDLSurface> Wt::PixmapOf< SDLPixmap >::PixmapBase [protected, inherited] |
Definition at line 290 of file pixmap.h.
00290 { 00291 NoOptim, 00292 BestOptim, 00293 DefaultOptim = BestOptim 00294 } Optimization;
Wt::Pixmap::Pixmap | ( | ) | [inline] |
constructor for NULL pixmap or default display
Definition at line 297 of file pixmap.h.
Referenced by Wt::Label::setText(), and Wt::Widget::updateBackground().
00298 : PixmapBase() {}
Wt::Pixmap::Pixmap | ( | int | w, | |
int | h, | |||
int | depth = -1 , |
|||
int | flags = 0 , |
|||
Optimization | optimization = DefaultOptim | |||
) | [inline] |
Wt::Pixmap::Pixmap | ( | const Size & | size, | |
int | depth = -1 , |
|||
int | flags = 0 , |
|||
Optimization | optimization = DefaultOptim | |||
) | [inline] |
Wt::Pixmap::Pixmap | ( | const PixmapBase & | pixmap | ) | [inline] |
Wt::Pixmap::Pixmap | ( | const SDLSurface & | sdlsurface | ) | [inline] |
constructor from SDLSurface (for scale to work implicitely)
Definition at line 317 of file pixmap.h.
00318 : PixmapBase(sdlsurface) {}
Wt::Pixmap::Pixmap | ( | const std::string & | filename | ) | [inline] |
void Wt::PixmapOf< SDLPixmap >::blend | ( | const Rect & | dst, | |
const Color & | color = Color("white") , |
|||
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
Definition at line 96 of file pixmap.h.
00097 { 00098 00099 switch(color.alpha()) { 00100 case Color::Transparent: 00101 return; 00102 case Color::Opaque: 00103 fill(dst, color); 00104 return; 00105 default: 00106 break; 00107 } 00108 00109 const Rect overlap = dst.intersect(SDLPixmap::clipRect()); 00110 if(overlap.isEmpty()) 00111 return; 00112 00113 int new_part, old_part; 00114 Color::calcBlendFactors(color.alpha(), new_part, old_part); 00115 int alpha_new_part, alpha_old_part; 00116 Color::calcBlendFactors(alpha_blend_factor, alpha_new_part, alpha_old_part); 00117 00118 SDLPixmap::lock() 00119 ; 00120 const int bpp = SDLPixmap::pixelFormat().bytesPerPixel(); 00121 for(int y = overlap.y(); y < overlap.y() + overlap.height(); y++) { 00122 int offset = SDLPixmap::pixelOffset(overlap.x(), y); 00123 for(int x = overlap.x(); x < overlap.x() + overlap.width(); x++) { 00124 00125 Color c = SDLPixmap::pixelColor(offset); 00126 c = Color::blend(c, old_part, color, new_part, 00127 alpha_new_part, alpha_old_part); 00128 00129 SDLPixmap::setPixelColor(offset, c); 00130 offset += bpp; 00131 } 00132 } 00133 SDLPixmap::unlock(); 00134 00135 return; 00136 }
void Wt::PixmapOf< SDLPixmap >::blend | ( | const Color & | color = Color("white") , |
|
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
Definition at line 91 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blend(), Wt::Painter::blendRect(), and Wt::Painter::blendRegion().
00092 { 00093 blend(rect(), SDLPixmap::pixelFormat().mapToPixelValue(color), alpha_blend_factor); 00094 }
int Wt::PixmapOf< SDLPixmap >::blit | ( | const Point & | p, | |
const PixmapBase & | src, | |||
const Rect & | src_rect | |||
) | [inline, inherited] |
int Wt::PixmapOf< SDLPixmap >::blit | ( | const Point & | p, | |
const PixmapBase & | src | |||
) | [inline, inherited] |
Definition at line 149 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blit(), Wt::RootWindow::blit_region(), Wt::PixmapOf< Wt::SDLSurface >::copy(), Wt::Painter::drawPixmap(), Wt::Painter::drawText(), and Wt::Painter::drawTiledPixmap().
00149 { 00150 return blit(p.x(), p.y(), src); 00151 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaBlend | ( | const Point & | p, | |
const PixmapBase & | src, | |||
const Rect & | src_rect, | |||
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
Definition at line 230 of file pixmap.h.
00231 { 00232 return blitAlphaBlend(p.x(), p.y(), src, src_rect, alpha_blend_factor); 00233 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaBlend | ( | const Point & | p, | |
const PixmapBase & | src, | |||
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
Definition at line 226 of file pixmap.h.
00227 { 00228 return blitAlphaBlend(p.x(), p.y(), src, alpha_blend_factor); 00229 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaBlend | ( | int | x, | |
int | y, | |||
const PixmapBase & | src, | |||
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
copy to from src with alpha blending
Definition at line 220 of file pixmap.h.
00221 { 00222 return blitAlphaBlend(x, y, src, 00223 Rect(0, 0, src.width(), src.height()), 00224 alpha_blend_factor); 00225 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaBlend | ( | const PixmapBase & | src, | |
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
copy to from src with alpha blending
Definition at line 213 of file pixmap.h.
00214 { 00215 return blitAlphaBlend(0, 0, src, 00216 Rect(0, 0, src.width(), src.height()), 00217 alpha_blend_factor); 00218 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaBlend | ( | int | x, | |
int | y, | |||
const PixmapBase & | src, | |||
const Rect & | src_rect, | |||
int | alpha_blend_factor = Color::Transparent | |||
) | [inline, inherited] |
copy to from src rect with alpha blending
if alpha_blend_factor = Color::Transparent (default) we keep the destination alpha (blit semantics). If it is set to Color::Opaque we replace alpha values with the new one (blitAlphaCopy semantics).
The blending of the color happens anyway.
Definition at line 172 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blitAlphaBlend().
00174 { 00175 const Rect dst = Rect(x, y, src_rect.width(), src_rect.height()); 00176 const Rect overlap = dst.intersect(SDLPixmap::clipRect()); 00177 00178 if(overlap.isEmpty()) 00179 return 0; 00180 00181 assert(SDLPixmap::depth() == src.depth()); 00182 00183 const int bpp = SDLPixmap::pixelFormat().bytesPerPixel(); 00184 const int src_bpp = src.pixelFormat().bytesPerPixel(); 00185 00186 int alpha_new_part, alpha_old_part; 00187 Color::calcBlendFactors(alpha_blend_factor, alpha_new_part, alpha_old_part); 00188 SDLPixmap::lock() 00189 ; 00190 for(int y = overlap.y(); y < overlap.y() + overlap.height(); y++) { 00191 int offset = SDLPixmap::pixelOffset(overlap.x(), y); 00192 int src_offset = src.pixelOffset(src_rect.x(), src_rect.y() + y - overlap.y()); 00193 for(int x = overlap.x(); x < overlap.x() + overlap.width(); x++) { 00194 Color c = pixelColor(offset); 00195 Color src_c = src.pixelColor(src_offset); 00196 00197 int new_part, old_part; 00198 Color::calcBlendFactors(src_c.alpha(), new_part, old_part); 00199 c = Color::blend(c, old_part, src_c, new_part, 00200 alpha_new_part, alpha_old_part); 00201 SDLPixmap::setPixelColor(offset, c); 00202 00203 offset += bpp; 00204 src_offset += src_bpp; 00205 } 00206 } 00207 SDLPixmap::unlock(); 00208 00209 return 0; 00210 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaCopy | ( | const Point & | p, | |
const PixmapBase & | src, | |||
const Rect & | src_rect | |||
) | [inline, inherited] |
Definition at line 160 of file pixmap.h.
00160 { 00161 return blitAlphaCopy(p.x(), p.y(), src, src_rect); 00162 }
int Wt::PixmapOf< SDLPixmap >::blitAlphaCopy | ( | const Point & | p, | |
const PixmapBase & | src | |||
) | [inline, inherited] |
Definition at line 157 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blitAlphaCopy(), and Wt::Painter::drawText().
00157 { 00158 return blitAlphaCopy(p.x(), p.y(), src); 00159 }
PixmapBase Wt::PixmapOf< SDLPixmap >::copy | ( | const Rect & | r | ) | const [inline, inherited] |
Definition at line 280 of file pixmap.h.
00280 { 00281 PixmapBase p(r.width(), r.height()); 00282 p.convertTo(*this); 00283 p.blit(0, 0, *this, r); 00284 return p; 00285 }
PixmapBase Wt::PixmapOf< SDLPixmap >::copy | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h | |||
) | const [inline, inherited] |
PixmapBase Wt::PixmapOf< SDLPixmap >::copy | ( | ) | const [inline, inherited] |
void Wt::PixmapOf< SDLPixmap >::fill | ( | const Region & | dst, | |
const Color & | color = Color("white") | |||
) | [inline, inherited] |
void Wt::PixmapOf< SDLPixmap >::fill | ( | const Rect & | dst, | |
const Color & | color = Color("white") | |||
) | [inline, inherited] |
void Wt::PixmapOf< SDLPixmap >::fill | ( | const Color & | color = Color("white") |
) | [inline, inherited] |
Definition at line 75 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blend(), Wt::PixmapOf< Wt::SDLSurface >::fill(), Wt::Painter::fillRect(), and Wt::Painter::fillRegion().
00075 { 00076 fill(SDLPixmap::pixelFormat().mapToPixelValue(color)); 00077 }
bool Wt::PixmapOf< SDLPixmap >::isNull | ( | ) | const [inline, inherited] |
int Wt::PixmapOf< SDLPixmap >::pixel | ( | const Point & | p | ) | const [inline, inherited] |
Definition at line 253 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::pixel(), and Wt::Painter::rop().
00253 { 00254 return pixel(p.x(), p.y()); 00255 }
Color Wt::PixmapOf< SDLPixmap >::pixelColor | ( | const Point & | p | ) | const [inline, inherited] |
Definition at line 258 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blitAlphaBlend(), and Wt::PixmapOf< Wt::SDLSurface >::pixelColor().
00258 { 00259 return pixelColor(p.x(), p.y()); 00260 }
Rect Wt::PixmapOf< SDLPixmap >::rect | ( | ) | const [inline, inherited] |
Reimplemented in Wt::Widget.
Definition at line 69 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blend(), Wt::PixmapOf< Wt::SDLSurface >::copy(), Wt::PushButton::drawButton(), Wt::Painter::drawLine(), and Wt::Painter::isClipped().
void Wt::PixmapOf< SDLPixmap >::resize | ( | const Size & | size | ) | [inline, inherited] |
Reimplemented in Wt::Widget.
Definition at line 236 of file pixmap.h.
Referenced by Wt::Widget::resize(), Wt::RootWindow::resize(), and Wt::PixmapOf< Wt::SDLSurface >::resize().
PixmapBase Wt::PixmapOf< SDLPixmap >::scale | ( | const Size & | size, | |
SDLSurface::ScaleMode | mode = SDLSurface::ScaleFree | |||
) | const [inline, inherited] |
Definition at line 241 of file pixmap.h.
Referenced by Wt::Painter::drawPixmap(), Wt::PixmapOf< Wt::SDLSurface >::scale(), and Wt::Widget::updateBackground().
void Wt::PixmapOf< SDLPixmap >::setPixel | ( | const Point & | p, | |
int | pixel_value | |||
) | [inline, inherited] |
Definition at line 263 of file pixmap.h.
Referenced by Wt::Painter::rop(), and Wt::PixmapOf< Wt::SDLSurface >::setPixel().
00263 { 00264 setPixel(p.x(), p.y(), pixel_value); 00265 }
void Wt::PixmapOf< SDLPixmap >::setPixelColor | ( | const Point & | p, | |
const SDLColor & | color | |||
) | [inline, inherited] |
Definition at line 268 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::setPixelColor().
00268 { 00269 setPixelColor(p.x(), p.y(), color); 00270 }
Size Wt::PixmapOf< SDLPixmap >::size | ( | ) | const [inline, inherited] |
Reimplemented in Wt::Widget.
Definition at line 65 of file pixmap.h.
Referenced by Wt::RootWindow::blit_region(), Wt::Label::drawContents(), Wt::Widget::erase(), Wt::PixmapOf< Wt::SDLSurface >::resize(), Wt::RootWindow::RootWindow(), Wt::PixmapOf< Wt::SDLSurface >::scale(), Wt::PushButton::setButtonSize(), and Wt::PixmapOf< Wt::SDLSurface >::smoothScale().
PixmapBase Wt::PixmapOf< SDLPixmap >::smoothScale | ( | const Size & | size, | |
SDLSurface::ScaleMode | mode = SDLSurface::ScaleFree | |||
) | const [inline, inherited] |
Definition at line 247 of file pixmap.h.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::smoothScale().
00248 { 00249 return smoothScale(size.width(), size.height(), mode); 00250 }
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.