Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PixelBuffer Class Reference

#include <pixelBuffer.h>

Inheritance diagram for PixelBuffer:

ImageBuffer ReferenceCount WritableConfigurable Namable TypedWritable TypedObject List of all members.

Public Types

enum  Type { T_unsigned_byte, T_unsigned_short, T_unsigned_byte_332, T_float }
enum  Format {
  F_color_index, F_stencil_index, F_depth_component, F_red,
  F_green, F_blue, F_alpha, F_rgb,
  F_rgb5, F_rgb8, F_rgb12, F_rgb332,
  F_rgba, F_rgbm, F_rgba4, F_rgba5,
  F_rgba8, F_rgba12, F_luminance, F_luminance_alpha,
  F_luminance_alphamask
}

Public Member Functions

 PixelBuffer (void)
 PixelBuffer (int xsize, int ysize, int components, int component_width, Type type, Format format)
 PixelBuffer (int xsize, int ysize, int components, int component_width, Type type, Format format, bool bAllocateRAM)
 PixelBuffer (const PixelBuffer &copy)
void operator= (const PixelBuffer &copy)
INLINE ~PixelBuffer (void)
virtual void config (void)
bool read (const Filename &name)
bool write (const Filename &name) const
bool load (const PNMImage &pnmimage)
bool store (PNMImage &pnmimage) const
void copy (const PixelBuffer *pb)
virtual void copy (GraphicsStateGuardianBase *gsg, const DisplayRegion *dr)
virtual void copy (GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, const RenderBuffer &rb)
INLINE void set_xsize (int size)
INLINE void set_ysize (int size)
INLINE void set_xorg (int org)
INLINE void set_yorg (int org)
INLINE void set_size (int x_org, int y_org, int x_size, int y_size)
INLINE void set_format (Format format)
INLINE int get_xsize () const
INLINE int get_ysize () const
INLINE int get_xorg () const
INLINE int get_yorg () const
INLINE int get_border () const
INLINE int get_num_components () const
INLINE int get_component_width () const
INLINE Format get_format () const
INLINE Type get_image_type () const
INLINE void set_uchar_rgb_texel (const uchar color[3], int x, int y, int width)
virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()

Static Public Member Functions

INLINE PixelBuffer rgb_buffer (int xsize, int ysize)
INLINE PixelBuffer rgba_buffer (int xsize, int ysize)
INLINE PixelBuffer depth_buffer (int xsize, int ysize)
INLINE PixelBuffer stencil_buffer (int xsize, int ysize)
TypeHandle get_class_type ()
void init_type ()

Public Attributes

PTA_uchar _image

Protected Attributes

int _xsize
int _ysize
int _xorg
int _yorg
int _border
int _components
int _component_width
Format _format
Type _type
bool _loaded

Private Member Functions

INLINE void store_unscaled_byte (int &index, int value)
INLINE void store_unscaled_short (int &index, int value)
INLINE void store_scaled_byte (int &index, int value, double scale)
INLINE void store_scaled_short (int &index, int value, double scale)
INLINE double get_unsigned_byte (int &index) const
INLINE double get_unsigned_short (int &index) const

Static Private Attributes

TypeHandle _type_handle

Member Enumeration Documentation

enum PixelBuffer::Format
 

Enumeration values:
F_color_index 
F_stencil_index 
F_depth_component 
F_red 
F_green 
F_blue 
F_alpha 
F_rgb 
F_rgb5 
F_rgb8 
F_rgb12 
F_rgb332 
F_rgba 
F_rgbm 
F_rgba4 
F_rgba5 
F_rgba8 
F_rgba12 
F_luminance 
F_luminance_alpha 
F_luminance_alphamask 

Definition at line 64 of file pixelBuffer.h.

Referenced by Texture::fillin().

enum PixelBuffer::Type
 

Enumeration values:
T_unsigned_byte 
T_unsigned_short 
T_unsigned_byte_332 
T_float 

Definition at line 57 of file pixelBuffer.h.

Referenced by DXTextureContext8::CreateTexture(), and DXTextureContext7::CreateTexture().


Constructor & Destructor Documentation

PixelBuffer::PixelBuffer void   ) 
 

Definition at line 33 of file pixelBuffer.cxx.

References _border, _component_width, _components, _format, _image, _loaded, _type, _xorg, _xsize, _yorg, _ysize, F_rgb, PTA_uchar, and T_unsigned_byte.

PixelBuffer::PixelBuffer int  xsize,
int  ysize,
int  components,
int  component_width,
Type  type,
Format  format
 

Definition at line 55 of file pixelBuffer.cxx.

References _border, _component_width, _components, _format, _image, _loaded, _type, _xorg, _xsize, _yorg, _ysize, PointerToArray< unsigned char >::empty_array(), format, and type.

PixelBuffer::PixelBuffer int  xsize,
int  ysize,
int  components,
int  component_width,
Type  type,
Format  format,
bool  bAllocateRAM
 

Definition at line 78 of file pixelBuffer.cxx.

References _border, _component_width, _components, _format, _image, _loaded, _type, _xorg, _xsize, _yorg, _ysize, PointerToArray< unsigned char >::empty_array(), format, PTA_uchar, and type.

PixelBuffer::PixelBuffer const PixelBuffer &  copy  ) 
 

Definition at line 102 of file pixelBuffer.cxx.

INLINE PixelBuffer::~PixelBuffer void   ) 
 


Member Function Documentation

void PixelBuffer::config void   )  [virtual]
 

Reimplemented from ImageBuffer.

Definition at line 142 of file pixelBuffer.cxx.

References ImageBuffer::config().

Referenced by load().

void PixelBuffer::copy GraphicsStateGuardianBase gsg,
const DisplayRegion dr,
const RenderBuffer rb
[virtual]
 

Implements ImageBuffer.

Definition at line 425 of file pixelBuffer.cxx.

References GraphicsStateGuardianBase::copy_pixel_buffer().

void PixelBuffer::copy GraphicsStateGuardianBase gsg,
const DisplayRegion dr
[virtual]
 

Implements ImageBuffer.

Definition at line 421 of file pixelBuffer.cxx.

References GraphicsStateGuardianBase::copy_pixel_buffer().

void PixelBuffer::copy const PixelBuffer *  pb  ) 
 

Definition at line 407 of file pixelBuffer.cxx.

References _border, _components, _format, _image, _xorg, _xsize, _yorg, _ysize, PointerToArray< unsigned char >::empty(), PointerToArray< unsigned char >::empty_array(), NULL, pb, and PointerToArray< unsigned char >::v().

Referenced by GLGraphicsStateGuardian::texture_to_pixel_buffer(), and CRGraphicsStateGuardian::texture_to_pixel_buffer().

INLINE PixelBuffer PixelBuffer::depth_buffer int  xsize,
int  ysize
[static]
 

Referenced by PlanarReflector::pre_apply(), DXGraphicsStateGuardian7::prepare_texture(), and PT().

virtual TypeHandle PixelBuffer::force_init_type void   )  [inline, virtual]
 

Reimplemented from ImageBuffer.

Definition at line 163 of file pixelBuffer.h.

References ImageBuffer::get_class_type(), and ImageBuffer::init_type().

INLINE int PixelBuffer::get_border  )  const
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), GLGraphicsStateGuardian::copy_texture(), CRGraphicsStateGuardian::copy_texture(), and DXGraphicsStateGuardian7::prepare_texture().

TypeHandle PixelBuffer::get_class_type void   )  [inline, static]
 

Reimplemented from ImageBuffer.

Definition at line 152 of file pixelBuffer.h.

INLINE int PixelBuffer::get_component_width  )  const
 

Referenced by SceneGraphAnalyzer::collect_statistics(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), and CRGraphicsStateGuardian::save_mipmap_images().

INLINE Format PixelBuffer::get_format  )  const
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), GLGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), GLGraphicsStateGuardian::copy_texture(), CRGraphicsStateGuardian::copy_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), GLGraphicsStateGuardian::draw_pixel_buffer(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), and CRGraphicsStateGuardian::save_mipmap_images().

INLINE Type PixelBuffer::get_image_type  )  const
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), GLGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), GLGraphicsStateGuardian::draw_pixel_buffer(), DXTextureContext7::FillDDSurfTexturePixels(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), and CRGraphicsStateGuardian::save_mipmap_images().

INLINE int PixelBuffer::get_num_components  )  const
 

Referenced by SceneGraphAnalyzer::collect_statistics(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), DXTextureContext8::FillDDSurfTexturePixels(), DXTextureContext7::FillDDSurfTexturePixels(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), CRGraphicsStateGuardian::save_mipmap_images(), GLGraphicsStateGuardian::texture_to_pixel_buffer(), and CRGraphicsStateGuardian::texture_to_pixel_buffer().

virtual TypeHandle PixelBuffer::get_type void   )  const [inline, virtual]
 

Reimplemented from ImageBuffer.

Definition at line 160 of file pixelBuffer.h.

References ImageBuffer::get_class_type().

INLINE double PixelBuffer::get_unsigned_byte int &  index  )  const [private]
 

Referenced by store().

INLINE double PixelBuffer::get_unsigned_short int &  index  )  const [private]
 

Referenced by store().

INLINE int PixelBuffer::get_xorg  )  const
 

Referenced by GLGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_texture(), GLGraphicsStateGuardian::draw_pixel_buffer(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE int PixelBuffer::get_xsize  )  const
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), GLGraphicsStateGuardian::build_phony_mipmaps(), CRGraphicsStateGuardian::build_phony_mipmaps(), SceneGraphAnalyzer::collect_statistics(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), GLGraphicsStateGuardian::copy_pixel_buffer(), DXGraphicsStateGuardian8::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), GLGraphicsStateGuardian::draw_pixel_buffer(), TextureContext::estimate_texture_memory(), DXTextureContext8::FillDDSurfTexturePixels(), Spotlight::make_image(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), CRGraphicsStateGuardian::save_mipmap_images(), GLGraphicsStateGuardian::texture_to_pixel_buffer(), and CRGraphicsStateGuardian::texture_to_pixel_buffer().

INLINE int PixelBuffer::get_yorg  )  const
 

Referenced by GLGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_texture(), GLGraphicsStateGuardian::draw_pixel_buffer(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE int PixelBuffer::get_ysize  )  const
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), GLGraphicsStateGuardian::build_phony_mipmaps(), CRGraphicsStateGuardian::build_phony_mipmaps(), SceneGraphAnalyzer::collect_statistics(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), GLGraphicsStateGuardian::copy_pixel_buffer(), DXGraphicsStateGuardian8::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), GLGraphicsStateGuardian::draw_pixel_buffer(), TextureContext::estimate_texture_memory(), DXTextureContext8::FillDDSurfTexturePixels(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), CRGraphicsStateGuardian::save_mipmap_images(), GLGraphicsStateGuardian::texture_to_pixel_buffer(), and CRGraphicsStateGuardian::texture_to_pixel_buffer().

void PixelBuffer::init_type void   )  [inline, static]
 

Reimplemented from ImageBuffer.

Definition at line 155 of file pixelBuffer.h.

References ImageBuffer::get_class_type(), ImageBuffer::init_type(), and register_type().

Referenced by ConfigureFn().

bool PixelBuffer::load const PNMImage pnmimage  ) 
 

Definition at line 203 of file pixelBuffer.cxx.

References _components, _format, _image, _loaded, _type, _xsize, _ysize, config(), PNMImageHeader::CT_color, PNMImageHeader::CT_four_channel, PNMImageHeader::CT_grayscale, PNMImageHeader::CT_two_channel, PointerToArray< unsigned char >::empty_array(), F_luminance, F_luminance_alpha, F_rgb, F_rgba, PNMImage::get_alpha_val(), PNMImage::get_blue_val(), PNMImageHeader::get_color_type(), PNMImage::get_gray_val(), PNMImage::get_green_val(), PNMImageHeader::get_maxval(), PNMImageHeader::get_num_channels(), PNMImage::get_red_val(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), PNMImageHeader::has_alpha(), PNMImageHeader::is_grayscale(), scale, store_scaled_byte(), store_scaled_short(), store_unscaled_byte(), store_unscaled_short(), T_unsigned_byte, T_unsigned_short, and xelval.

Referenced by GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), DXTextureContext7::CreateTexture(), and read().

void PixelBuffer::operator= const PixelBuffer &  copy  ) 
 

Definition at line 123 of file pixelBuffer.cxx.

References _border, _component_width, _components, _format, _image, _loaded, _type, _xorg, _xsize, _yorg, and _ysize.

bool PixelBuffer::read const Filename &  name  ) 
 

Definition at line 153 of file pixelBuffer.cxx.

References ImageBuffer::clear_alpha_filename(), load(), PNMImage::read(), ImageBuffer::set_filename(), and Namable::set_name().

Referenced by indirect_display_func().

INLINE PixelBuffer PixelBuffer::rgb_buffer int  xsize,
int  ysize
[static]
 

Referenced by PlanarReflector::pre_apply(), SpheretexHighlighter::SpheretexHighlighter(), and SpotlightShader::SpotlightShader().

INLINE PixelBuffer PixelBuffer::rgba_buffer int  xsize,
int  ysize
[static]
 

INLINE void PixelBuffer::set_format Format  format  ) 
 

INLINE void PixelBuffer::set_size int  x_org,
int  y_org,
int  x_size,
int  y_size
 

Referenced by GLGraphicsStateGuardian::copy_texture(), and DXGraphicsStateGuardian8::copy_texture().

INLINE void PixelBuffer::set_uchar_rgb_texel const uchar  color[3],
int  x,
int  y,
int  width
 

Referenced by Spotlight::make_image().

INLINE void PixelBuffer::set_xorg int  org  ) 
 

Referenced by CRGraphicsStateGuardian::copy_texture(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE void PixelBuffer::set_xsize int  size  ) 
 

Referenced by CRGraphicsStateGuardian::copy_texture(), indirect_display_func(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE void PixelBuffer::set_yorg int  org  ) 
 

Referenced by CRGraphicsStateGuardian::copy_texture(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE void PixelBuffer::set_ysize int  size  ) 
 

Referenced by CRGraphicsStateGuardian::copy_texture(), indirect_display_func(), and DXGraphicsStateGuardian7::prepare_texture().

INLINE PixelBuffer PixelBuffer::stencil_buffer int  xsize,
int  ysize
[static]
 

bool PixelBuffer::store PNMImage pnmimage  )  const
 

Definition at line 351 of file pixelBuffer.cxx.

References _components, _type, _xsize, _ysize, PNMImage::clear(), Namable::get_name(), get_unsigned_byte(), get_unsigned_short(), PNMImageHeader::has_alpha(), PNMImageHeader::is_grayscale(), PNMImage::set_alpha(), PNMImage::set_blue(), PNMImage::set_gray(), PNMImage::set_green(), PNMImage::set_red(), T_unsigned_byte, and T_unsigned_short.

Referenced by DXTextureContext7::CreateTexture(), and write().

INLINE void PixelBuffer::store_scaled_byte int &  index,
int  value,
double  scale
[private]
 

Referenced by load().

INLINE void PixelBuffer::store_scaled_short int &  index,
int  value,
double  scale
[private]
 

Referenced by load().

INLINE void PixelBuffer::store_unscaled_byte int &  index,
int  value
[private]
 

Referenced by load().

INLINE void PixelBuffer::store_unscaled_short int &  index,
int  value
[private]
 

Referenced by load().

bool PixelBuffer::write const Filename &  name  )  const
 

Definition at line 174 of file pixelBuffer.cxx.

References ImageBuffer::get_filename(), store(), and PNMImage::write().


Member Data Documentation

int PixelBuffer::_border [protected]
 

Definition at line 179 of file pixelBuffer.h.

Referenced by copy(), operator=(), and PixelBuffer().

int PixelBuffer::_component_width [protected]
 

Definition at line 181 of file pixelBuffer.h.

Referenced by operator=(), and PixelBuffer().

int PixelBuffer::_components [protected]
 

Definition at line 180 of file pixelBuffer.h.

Referenced by copy(), load(), operator=(), PixelBuffer(), and store().

Format PixelBuffer::_format [protected]
 

Definition at line 182 of file pixelBuffer.h.

Referenced by copy(), load(), operator=(), and PixelBuffer().

PTA_uchar PixelBuffer::_image
 

Definition at line 190 of file pixelBuffer.h.

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), GLGraphicsStateGuardian::build_phony_mipmap_level(), CRGraphicsStateGuardian::build_phony_mipmap_level(), ConvertD3DSurftoPixBuf(), ConvertDDSurftoPixBuf(), copy(), GLGraphicsStateGuardian::copy_pixel_buffer(), DXGraphicsStateGuardian8::copy_pixel_buffer(), CRGraphicsStateGuardian::copy_pixel_buffer(), GLGraphicsStateGuardian::draw_pixel_buffer(), DXTextureContext8::FillDDSurfTexturePixels(), DXTextureContext7::FillDDSurfTexturePixels(), indirect_display_func(), load(), operator=(), PixelBuffer(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::texture_to_pixel_buffer(), and CRGraphicsStateGuardian::texture_to_pixel_buffer().

bool PixelBuffer::_loaded [protected]
 

Definition at line 185 of file pixelBuffer.h.

Referenced by load(), operator=(), and PixelBuffer().

Type PixelBuffer::_type [protected]
 

Definition at line 183 of file pixelBuffer.h.

Referenced by load(), operator=(), PixelBuffer(), and store().

TypeHandle PixelBuffer::_type_handle [static, private]
 

Reimplemented from ImageBuffer.

Definition at line 25 of file pixelBuffer.cxx.

int PixelBuffer::_xorg [protected]
 

Definition at line 177 of file pixelBuffer.h.

Referenced by copy(), operator=(), and PixelBuffer().

int PixelBuffer::_xsize [protected]
 

Definition at line 172 of file pixelBuffer.h.

Referenced by copy(), load(), operator=(), PixelBuffer(), and store().

int PixelBuffer::_yorg [protected]
 

Definition at line 178 of file pixelBuffer.h.

Referenced by copy(), operator=(), and PixelBuffer().

int PixelBuffer::_ysize [protected]
 

Definition at line 173 of file pixelBuffer.h.

Referenced by copy(), load(), operator=(), PixelBuffer(), and store().


The documentation for this class was generated from the following files:
Generated on Fri Apr 18 00:13:10 2003 for Panda by doxygen1.3