(none) imager-devel
/ help / lists / applications / search /
 

Re: Set Pixel?

From: Tony Cook (
04389@xyz.molar.is)
Date: Fri 04 Jan 2002 - 22:25:25 UTC

  • Next message: gak: "Re: Small Resize Quality"

    On Fri, 4 Jan 2002, Mike Depot wrote:
    > I took a quick look at the docs, and I didn't see a function to set
    > individual pixels to a certain color. Does such a function exist? What I
    > would really like is to pass an array of coordinates...

    Imager obviously has internal functions for getting/setting individual
    pixels, but these functions haven't been exposed through the OO interface,
    I suspect mainly because it's such a low-level interface.

    They are exposed as functions in the Imager package, but was is intended
    mainly for testing, see t/t01introvert.t and t/t02*.t

    Ok, to set a pixel to a given color in Imager 0.39:

      Imager::i_ppix($im->{IMG}, $x, $y, $color);

    If you want to set pixels across a row to given colors you can use:

      Imager::i_plin($im->{IMG}, $x, $y, @colors);

    Your idea of passing in an array of coordinates is a good one, since it
    seems a little higher level than one pixel at a time :) I'll look at
    adding it.

    Tony



  •