Claudio Ciccani wrote:
> Lu yunfeng wrote:
>> Dear Pedro,
>>
>> My question is not the simple display of an image by DirectFB, I want to 
>> rotate the  image by 90 degrees first , then to display it by DirectFB. I 
>> cannot find any APIs in DirectFB LIB  which can support image rotation 
>> display.
> 
> You can use TextureTriangles() to do that.
> 
> The following code blits "src" surface to "dst" surface rotated by 90 
> degrees.
> 
> /* BEGIN CODE */
> DFBVertex v[4];
> 
> /* [x,y] are the coordinates of the destination point. */
> /* [width,height] is the size of the source surface. */
> 
> v[0].x = x;
> v[0].y = y;
> v[0].z = 0;
> v[0].w = 1;
> v[0].s = 1;
> v[0].t = 0;
> 
> v[1].x = x+width;
> v[1].y = y;
> v[1].z = 0;
> v[1].w = 1;
> v[1].s = 1;
> v[1].t = 1;
> 
> v[2].x = x+width;
> v[2].y = y+height;
> v[2].z = 0;
> v[2].w = 1;
> v[2].s = 0;
> v[2].t = 1;
> 
> v[3].x = x;
> v[3].y = y+height;
> v[3].z = 0;
> v[3].w = 1;
> v[3].s = 0;
> v[3].t = 0;
> 
> dst->TextureTriangles( dst, src, v, NULL, 4, DTTF_FAN );
> /* END CODE */
> 
> However this only works if TextureTriangles() is accelerated, since 
> there is not software fallback.

Yes, that's currently the only way to rotate it without doing it yourself.

You can also have a look the rotation code in DFBSee, but I don't
know how efficient that code is. The best way for the CPU to rotate
an image is to do it tile based to allow better cache usage, e.g.
rotate the image in 16x16 or 32x32 pixel blocks, depending on your
cache line length and pixel format.

-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to