}
}
+void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf,
+ const Rect& r, int stride)
+{
+ const rdr::U8* srcBuffer;
+ int srcStride;
+
+ if (format.equal(pf)) {
+ getImage(imageBuf, r, stride);
+ return;
+ }
+
+ if (stride == 0)
+ stride = r.width();
+
+ srcBuffer = getBuffer(r, &srcStride);
+
+ pf.bufferFromBuffer((U8*)imageBuf, format, srcBuffer, r.width(), r.height(),
+ stride, srcStride);
+}
+
// -=- Modifiable generic pixel buffer class
ModifiablePixelBuffer::ModifiablePixelBuffer(const PixelFormat& pf,
// stride. Try to avoid using this though as getBuffer() will in
// most cases avoid the extra memory copy.
void getImage(void* imageBuf, const Rect& r, int stride=0);
+ // Get pixel data in a given format
+ // Works just the same as getImage(), but guaranteed to be in a
+ // specific format.
+ void getImage(const PixelFormat& pf, void* imageBuf,
+ const Rect& r, int stride=0);
///////////////////////////////////////////////
// Framebuffer update methods