569
edits
(notes on cairo difference) |
(Update to support seperate surfaces) |
||
| Line 1: | Line 1: | ||
== Class Surface == | == Class Surface == | ||
We need a surface to draw on to. | We need a surface to draw on to. There will need to be multiple surface implementations such as win32, mac, linux, image, pdf, etc. | ||
=== API === | === API === | ||
class | class ASurface { | ||
public: | public: | ||
// <insert refcount stuff here> | // <insert refcount stuff here> | ||
virtual cairo_surface_t *CairoSurface(); | |||
virtual int Format() const; | |||
virtual long Width() const; | |||
virtual long Height() const; | |||
// raw access | // raw access | ||
// will convert to ARGB32 pre-multiplied data if required | // will convert to ARGB32 pre-multiplied data if required | ||
SurfaceData* Lock(); | virtual SurfaceData* Lock(long x, long y, long width, long height); | ||
// when unlock() is called, the data will be written back. | // when unlock() is called, the data will be written back. | ||
// lock() must be called before calling this method. | // lock() must be called before calling this method. | ||
void Unlock(SurfaceData* data); | virtual void Unlock(SurfaceData* data); | ||
}; | }; | ||
| Line 94: | Line 26: | ||
class SurfaceData { | class SurfaceData { | ||
private: | private: | ||
long width; | |||
long height; | |||
unsigned long stride; | unsigned long stride; | ||
long length; | long length; | ||
| Line 104: | Line 36: | ||
unsigned char *_data) : | unsigned char *_data) : | ||
width(_width), height(_height), | width(_width), height(_height), | ||
stride(_stride), length(_length), data(_data) {} | stride(_stride), length(_length), data(_data) {} | ||
long Width() const { return width; } | |||
long Height() const { return height; } | |||
long Stride() const { return stride; } | |||
long | long Length() const { return length; } | ||
unsigned char * | unsigned char *Data() { return data; } | ||
}; | }; | ||
edits