After the buffer of the surface is ready, you can write bitmap data to the buffer,
The buffer of the surface is the same as the ordinary image data. It is also a scanned line data organized in a certain format.
The following example assumes that the source and target formats are both 32-bit and the size does not exceed the standard.
Uint8_t * sbits;
Sbits = (uint8_t *) Bitmap-> getpixels ();
Int sstride;
Sstride = Bitmap-> rowbytes ();
Int sbpp; // bytes per pixel
Sbpp = Bitmap-> bytesperpixel ();
Uint8_t * Sline;
Sline = sbits + (INT) Src-> ftop * sstride + (INT) Src-> fleft *
Sbpp;
Uint8_t * dBits;
DBits = static_cast (mbufferheap. Heap-> base ());
// Memcpy (dBits, sbits, 800*480*4 );
// Need check format
Int dstride;
Dstride = 800*4; // color: abgr
Int dbpp; // bytes per pixel
Dbpp = 4;
Uint8_t * dline;
Dline = dBits + (INT) DST. ftop * dstride + (INT) DST. fleft *
Dbpp;
Int width;
Int height;
Width = (INT) (DST. fright-dst. fleft );
Height = (INT) (DST. fbottom-dst. ftop );
While (height --)
{
Memcpy (dline, Sline, width * sbpp );
Dline + = dstride;
Sline + = sstride;
}
Http://blog.sina.com.cn/s/blog_53d1e55b0100ne4v.html