[libGD] #208 [Task opened] Scatter Filter

[email protected] Sun, 28 Jun 2009 06:51:50 +0200 (CEST)
Newsgroups php.gd.bugs
Message-ID <[email protected]>
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Kalle Sommer Nielsen (Kalle) 

Attached to Project - libGD
Summary - Scatter Filter
Task Type - Feature Request
Category - Drawing function
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - Medium
Priority - Normal
Reported Version - 2.0.35
Due in Version - Undecided
Due Date - Undecided
Details - I've just finished a patch for GD that implements a scatter filter in GD. To quickly explain wjat a scatter filter is, then Adobe's After Effects documentation explains it well:
http://help.adobe.com/en_US/AfterEffects/9.0/WS3878526689cb91655866c1103a9d3c597-7a6ba.html

This implementation uses a range as passed by its function parameters to determine how far the random pixels should be found from the current position in the image. It also works for truecolor and palette based images. The patch implements two functions in a separate file called gd_scatter.c:

  * gdImageScatter
  * gdImageScatterEx

gdImageScatter takes two parameters, first one being the gdImagePtr for the image, and the second one is the range (for both sub and plus, see next).

gdImageScatterEx takes three parameters, first one being the gdImagePtr for the image, and parameter two and three is the range. Parameter 2 is the "sub" range, how many pixels this may go back in the current iteration to find a random color, and the "plus" is how far ahead the current iteration to find a random color. When using gdImageScatter with a range of 5, then the "sub" range is "-5" and "plus" range is 5, so they will be identical, hence why gdImageScatterEx exists to make it possible to use different ranges in each direction.

The patch is diff'd off the PHP 5.3.0 (Tagged) CVS, but is really simple to migrate into libgd outside php, it can be found at (also attached):
http://php.tuxxedo.net/patches/gd/scatter/gd-php53.patch

Results:
These links shows the results of some same sized ranges, based on this original image:
http://php.tuxxedo.net/patches/gd/scatter/original.jpg

gdImageScatter(im, 10):
http://php.tuxxedo.net/patches/gd/scatter/result_10.jpg

gdImageScatter(im, 25):
http://php.tuxxedo.net/patches/gd/scatter/result_25.jpg

Hope this can get into GD 2.1, and it wasn't too difficult to understand the meaning of this filter :)

More information can be found at the following URL:
http://bugs.libgd.org/?do=details&task_id=208

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.