news download themes documentation links










FbTk::ImageControl Class Reference

Holds screen info, color tables and caches textures. More...

#include <ImageControl.hh>

Inheritance diagram for FbTk::ImageControl:

FbTk::NotCopyable List of all members.

Public Member Functions

 ImageControl (int screen_num, bool dither=false, int colors_per_channel=4, unsigned long cache_timeout=300000l, unsigned long cache_max=200l)
bool doDither () const
int bitsPerPixel () const
int depth () const
int colorsPerChannel () const
int screenNum () const
Visual * visual () const
unsigned long getSqrt (unsigned int val) const
Pixmap renderImage (unsigned int width, unsigned int height, const FbTk::Texture &src_texture)
void installRootColormap ()
void removeImage (Pixmap thepix)
void colorTables (const unsigned char **, const unsigned char **, const unsigned char **, int *, int *, int *, int *, int *, int *) const
void getXColorTable (XColor **, int *)
void getGradientBuffers (unsigned int, unsigned int, unsigned int **, unsigned int **)
void setDither (bool d)
void setColorsPerChannel (int cpc)
void cleanCache ()

Detailed Description

Holds screen info, color tables and caches textures.

Definition at line 42 of file ImageControl.hh.


Member Function Documentation

Pixmap FbTk::ImageControl::renderImage unsigned int  width,
unsigned int  height,
const FbTk::Texture src_texture
 

Render to pixmap

Parameters:
width width of pixmap
height height of pixmap
src_texture texture type to render
Returns:
pixmap of the rendered image, on failure None

Definition at line 203 of file ImageControl.cc.

References FbTk::Texture::color(), FbTk::Texture::colorTo(), FbTk::FbPixmap::drawable(), FbTk::Color::pixel(), FbTk::Texture::pixmap(), FbTk::TextureRender::render(), and FbTk::Texture::type().

00204                                                              {
00205 
00206     if (texture.type() & FbTk::Texture::PARENTRELATIVE)
00207         return ParentRelative;
00208 
00209     // search cache first
00210     Pixmap pixmap = searchCache(width, height, texture);
00211     if (pixmap) {
00212         return pixmap; // return cache item
00213     }
00214 
00215     // render new image
00216     TextureRender image(*this, width, height, m_colors, m_num_colors);
00217     pixmap = image.render(texture);
00218 
00219     if (pixmap) {
00220         // create new cache item and add it to cache list
00221 
00222         Cache *tmp = new Cache;
00223 
00224         tmp->pixmap = pixmap;
00225         tmp->texture_pixmap = texture.pixmap().drawable();
00226         tmp->width = width;
00227         tmp->height = height;
00228         tmp->count = 1;
00229         tmp->texture = texture.type();
00230         tmp->pixel1 = texture.color().pixel();
00231 
00232         if (texture.type() & FbTk::Texture::GRADIENT)
00233             tmp->pixel2 = texture.colorTo().pixel();
00234         else
00235             tmp->pixel2 = 0l;
00236 
00237         cache.push_back(tmp); 
00238 
00239         if ((unsigned) cache.size() > cache_max)
00240             cleanCache();
00241 
00242         return pixmap;
00243     }
00244 
00245     return None;
00246 }


The documentation for this class was generated from the following files:

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA