// -*- c++ -*- #pragma once #ifndef __RAYS_BITMAP_H__ #define __RAYS_BITMAP_H__ #include #include #include #include namespace Rays { class Bitmap { typedef Bitmap This; public: Bitmap (); Bitmap ( int width, int height, const ColorSpace& cs = RGBA, const void* pixels = NULL); ~Bitmap (); Bitmap dup () const; int width () const; int height () const; const ColorSpace& color_space () const; int pitch () const; size_t size () const; void* pixels (); const void* pixels () const; template T* at (int x, int y); template const T* at (int x, int y) const; operator bool () const; bool operator ! () const; struct Data; Xot::PSharedImpl self; };// Bitmap template T* Bitmap::at (int x, int y) { return (T*) (((char*) pixels()) + pitch() * y + x * color_space().Bpp()); } template const T* Bitmap::at (int x, int y) const { return const_cast(this)->at(x, y); } }// Rays #endif//EOH