gd_rotate - Rotates a GD image.
gd_rotate (gdsrc:variable, gddst:variable, srcx:integer, srcy:integer, srcw:integer, srch:integer, dstx:integer,dsty:integer,dstw:integer,dsth:integer,angle:integer, transparent:"string", bgcolor:"string",pourc:float, truecolor:true|false);
This function is used to rotate a GD image.
gd_rotate really creates a new image if gddst is not specified, so it returns the new GD structure. The old GD structure is still valid. gd_free must be call with this new GD structure.
pourc and dw,dh are mutually exclusive.
The srcX and srcY coordinates specify the upper left corner of the source area; however, the dstX and dstY coordinates specify the CENTER of the destination area. This important distinction is made because the rotated rectangle may may or may not be parallel to the X and Y axes. The destination coordinates may be floating point, as the center of the desired destination area may lie at the center of a pixel (0.5 pixels) rather than its upper left corner. The angle specified is an integer number of degrees, between 0 and 360, with 0 degrees causing no change, and counterclockwise rotation as the angle increases.
To use this module, you must specify the following in /usr/local/website/site.conf:
Module gd { Library : "/usr/local/lib/libsngd.so" Init : "sngd_init" }
res=<{ %include "/includes/gd.sn"; remove("/html/images/rot1.jpg"); remove("/html/images/rot2.jpg"); imsrc=gd_new(filename:"/html/images/20130708-1944-londres.jpg",truecolor:true); imdst=gd_new(width:1000,height:1000,bgcolor:Blue,truecolor:true); gd_rotate(gdsrc:imsrc, gddst:imdst,srcx:400,srcy:400,srcw:800,srch:800,dstx:50,dsty:50,angle:45); gd_write(gd:imsrc,format:"jpg",filename:"/html/images/rot1.jpg"); gd_write(gd:imdst,format:"jpg",filename:"/html/images/rot2.jpg",quality:100); gd_free(imsrc); gd_free(imdst); -e "/html/images/rot1.jpg"; -e "/html/images/rot2.jpg"; }>.), q(res=truetrue.),{asm=>"-a"});
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com