RawBitmap::RawBitmap(unsigned nWidth, unsigned nHeight) :width(nWidth), height(nHeight), corrected_width(CorrectedWidth(nWidth)), buffer(new RawColor[corrected_width * height]), texture(new GLTexture(corrected_width, nHeight)) { assert(nWidth > 0); assert(nHeight > 0); texture->EnableInterpolation(); AddSurfaceListener(*this); }
bool Bitmap::LoadFile(const TCHAR *path) { assert(path != nullptr && *path != _T('\0')); Reset(); pathName = path; AddSurfaceListener(*this); if (!surface_valid) return true; return Reload(); }
bool Bitmap::load(unsigned _id) { assert(_id != 0); reset(); id = _id; AddSurfaceListener(*this); if (!surface_valid) return true; return Reload(); }
bool Bitmap::Load(ResourceId _id, Type _type) { assert(_id.IsDefined()); Reset(); id = _id; type = _type; AddSurfaceListener(*this); if (!surface_valid) return true; return Reload(); }
void BufferCanvas::Create(PixelSize new_size) { assert(!active); Destroy(); texture = new GLTexture(new_size.cx, new_size.cy); if (OpenGL::frame_buffer_object && OpenGL::render_buffer_stencil) { frame_buffer = new GLFrameBuffer(); stencil_buffer = new GLRenderBuffer(); stencil_buffer->Bind(); PixelSize size = texture->GetAllocatedSize(); stencil_buffer->Storage(OpenGL::render_buffer_stencil, size.cx, size.cy); stencil_buffer->Unbind(); } Canvas::Create(new_size); AddSurfaceListener(*this); }