Skip Menu |

This queue is for tickets about the Image-Imlib2 CPAN distribution.

Report information
The Basics
Id: 11375
Status: resolved
Priority: 0/
Queue: Image-Imlib2

People
Owner: leon [...] astray.com
Requestors: ch [...] ngmedia.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Patch that adds clone, sharpen and blur
Patch that adds clone, sharpen and blur. Regards Christian Hansen
diff -ru ../Image-Imlib2-1.04/lib/Image/Imlib2.pm ./lib/Image/Imlib2.pm --- ../Image-Imlib2-1.04/lib/Image/Imlib2.pm Thu Feb 3 16:28:54 2005 +++ ./lib/Image/Imlib2.pm Fri Feb 4 04:34:03 2005 @@ -306,6 +306,25 @@ $image->blend($cropped_image, 0, 0, 0, 50, 50, 200, 0, 50, 50); +=head2 blur (radius) + +This will blur the image. A radius of 0 has no effect, 1 and above determine +the blur matrix radius that determine how much to blur the image. + + $image->blur(1); + +=head2 sharpen (radius) + +This sharpens the image. The radius affects how much to sharpen by. + + $image->sharpen(1); + +=head2 clone () + +This creates an exact duplicate of the current image. + + $cloned = $image->clone; + =head2 draw_polygon (polygon, closed) This will draw polygon (of type Imlib2::Image::Polygon) on the the image. diff -ru ../Image-Imlib2-1.04/lib/Image/Imlib2.xs ./lib/Image/Imlib2.xs --- ../Image-Imlib2-1.04/lib/Image/Imlib2.xs Thu Feb 3 16:28:54 2005 +++ ./lib/Image/Imlib2.xs Fri Feb 4 04:28:20 2005 @@ -462,6 +462,53 @@ } +void +Imlib2_blur(image, radius) + Image::Imlib2 image + int radius + + PROTOTYPE: $$ + + CODE: + { + imlib_context_set_image(image); + imlib_image_blur(radius); + } + + +void +Imlib2_sharpen(image, radius) + Image::Imlib2 image + int radius + + PROTOTYPE: $$ + + CODE: + { + imlib_context_set_image(image); + imlib_image_sharpen(radius); + } + + +Image::Imlib2 +Imlib2_clone(image) + Image::Imlib2 image + + PROTOTYPE: $ + + CODE: + { + Imlib_Image cloned; + + imlib_context_set_image(image); + cloned = imlib_clone_image(); + + RETVAL = cloned; + } + OUTPUT: + RETVAL + + void Imlib2_draw_polygon(image, poly, closed) Image::Imlib2 image diff -ru ../Image-Imlib2-1.04/t/simple.t ./t/simple.t --- ../Image-Imlib2-1.04/t/simple.t Thu Feb 3 16:28:54 2005 +++ ./t/simple.t Fri Feb 4 04:30:06 2005 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 9; +use Test::More tests => 12; use_ok('Image::Imlib2'); @@ -50,6 +50,17 @@ # Does fill_ellipse work? $image->fill_ellipse(50, 50, 25, 25); +my $cloned = $image->clone; + +# Is it the right width? +is($cloned->get_width, 580); + +# Is it the right height? +is($cloned->get_height, 200); + +# Is alpha on by default? +is($cloned->has_alpha, 1); + # create a polygon my $poly = Image::Imlib2::Polygon->new(); @@ -67,6 +78,12 @@ # orientate it $image->image_orientate(1); + +# blur it +$image->blur(1); + +# sharpen it +$image->sharpen(1); # create a scaled image of it my $dstimage = $image->create_scaled_image(100,80);
Thanks, this made it into 1.07.