in reply to Rotating an Image for an SDL::Surface
Something like this ought to do it.
Update: Fixed a couple of typos. And, having defined VERSION_33 in an arbitrary place in GD.xs and re-built GD, it now works.
#! perl -slw use strict; use GD; our $A ||= 45; my $imgIn = GD::Image->new( $ARGV[ 0 ] ) or die $!; my $cx = int $imgIn->width / 2; my $cy = int $imgIn->height /2; my $imgOut = GD::Image->new( $imgIn->getBounds, 1 ); $imgOut->copyRotated( $imgIn, $cx, $cy, 0, 0, $imgIn->getBounds, $A ); (my $ofile = $ARGV[0]) =~s[(\..*?$)][.r$A$1]; open OUT, '>:raw', $ofile or die $!; print OUT $imgOut->png; close OUT; system $ofile;
However, despite having installed the latest versions of GD(2.28) and libgd (2.0.33), running this dies with
libgd 2.0.33 or higher required for copyRotated support at ...
which is coming from gd.xs
void gdcopyRotated(dst,src,dstX,dstY,srcX,srcY,srcW,srcH,angle) GD::Image dst GD::Imagesrc double dstX double dstY int srcX int srcY int srcW int srcH int angle PROTOTYPE: $$$$$$$$$ CODE: { #ifdef VERSION_33 gdImageCopyRotated(dst,src,dstX,dstY,srcX,srcY,srcW,srcH,angle +); #else die("libgd 2.0.33 or higher required for copyRotated support") +; #endif }
but I can't work out where VERSION_33 should be defined?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Rotating an Image for an SDL::Surface
by hardburn (Abbot) on Aug 19, 2005 at 03:07 UTC |