[Gimp-developer] Tiles / Shaped Angular Gradients



Hi. I sent an e-mail recently asking for information about the Gimp
algorithm for generating the shaped angular gradients over arbitrary
free shapes on the canvas. I did more digging in the source code and
discovered the pertinent function in app/gimpdrawable-blend.c:

code:
--------
  (gdouble x,
                                         gdouble y)
{
  Tile   *tile;
  gfloat  value;
  gint    ix = CLAMP (x, 0.0, distR.w - 0.7);
  gint    iy = CLAMP (y, 0.0, distR.h - 0.7);

  tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);

  value = 1.0 - *((gfloat *) tile_data_pointer (tile, ix, iy));

  tile_release (tile, FALSE);

  return value;
}
--------

However, this is rather obscure to me because it depends on a global
PixelRegion data structure and "Tiles" for that structure being
calculated before hand. Is there some one who could give me any helpful
words of insight on this subject?

I am rather curious, imagining that if I where to write a function for
calculating the value of any pixel in a shaped angular gradient in an
arbitrary enclosed path, it would have something to do with finding the
closest points in the enclosing path and actually calculating angles.
But so far I haven't found anything like that in the Gimp code.

-- 
frigidcode.com
indicium.us

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]