List Info

Thread: Re: Work with bitmap




Re: Work with bitmap
country flaguser name
United Kingdom
2007-03-12 16:41:29
> // assume that pixelformat of the surface is RGB32
> int pitch=0;
> int x = 10;//x position of the first point
> int y = 10;
> u32 *buf = 0;
> DFBResult ret;
> // get direct access to the surface memory
> ret =surface->Lock( surface, DSLF_WRITE, &buf,
&pitch );
> if ( DFB_OK == ret  ) {
>      buf[ x + y*pitch/4 ] = 0xFF0000; // red pixel
>      x++;
>      buf[ x + y*pitch/4 ] = 0xFF00;  // green pixel
>      x++;
>      buf[ x + y*pitch/4 ] = 0xFF;  // blue pixel
>      // and so on ...
> }
> surface->Unlock( surface );

Unlock() is called when ret != DFB_OK.  Is that correct?


Phil.






_______________________________________________
directfb-dev mailing list
directfb-devdirectfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/
directfb-dev

Re: Work with bitmap
user name
2007-03-13 05:27:35
>
> Unlock() is called when ret != DFB_OK.  Is that
correct?
> Phil.

In fact, you are right, It's not quite correct.
But it's safe because the Unlock() function will check the
surface -
is it locked ?


-- 
Best Regards
Nikita Egorov
NikeGogmail.com
NikeGovarma-el.com

_______________________________________________
directfb-dev mailing list
directfb-devdirectfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/
directfb-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )