>>>Is it possible to first create the surface and then access it's data?
>>>thanks a lot
>
>
> Yes, use IDirectFBSurface::Lock().
>
>
>>>dsc.preallocated[0].pitch = ; /* ????????? */
>
>
> Well that's a problem!
>
> The pitch is the byte offset between adjacent lines of the surface's
> data. It'll be the number of bytes on a line or slightly larger if
> you need to create a specific word alignment.
This was EXCELLENT HELP !!!
thx
---
Here is a snippet for those who might be searching the archives:
// create surface
dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
dsc.width = width;
dsc.height = height;
dsc.pixelformat = pixelformat;
dfb->CreateSurface( dfb, &dsc, &world );
// size of pixel in byte
row_bytes = (pixelformat >> 20) & 0x07;
// hexdump
world->Lock( world, DSLF_READ , &data, &pitch );
__u8* ptr = data;
size_t i, j, k;
for( i = 0; i < height; i++ ){
printf( "%p\t", ptr );
for( j = 0; j < width; j++ ){
for( k = 0; k < row_bytes; k++ )
printf( "%02x", *ptr++ );
putchar( ' ' );
}
putchar( '\n' );
ptr += pitch - width * row_bytes;
}
world->Unlock( world );
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev