<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks for the example Todd - yeah, that's compiling and seems to be
running fine. There are no reported memory leaks around the pixel wands
either.<br>
<br>
One question though: the PixelPacket contains *Word* values for red,
green, blue, and opacity. How do I interpret values greater than 255?<br>
<br>
Cheers,<br>
Phil.<br>
<br>
Todd Martin wrote:
<blockquote cite="mid200604192055.04407.toddm@kol.co.nz" type="cite">
  <pre wrap="">Hi Phil

I've only just started looking at Image Magic myself. 
Try this :) 
You'll need to add a correction and a function declaration to 
"pixel_iterator.inc" as outlined below.

uses
  magick_wand, ImageMagick;

procedure DrawDiagonalLine(AInputFileName, AOutputFileName : AnsiString);
var
  Iterator : PPixelIterator;
  PixelWands : PPPixelWand;
  ImageWand : PMagickWand;
  Status : MagickBooleanType;
  RowIndex, WandCount : Cardinal;
begin
  Iterator := nil;
  ImageWand := nil;
  try
    ImageWand := NewMagickWand;
    status := MagickReadImage(ImageWand,PChar(AInputFileName));
    if (status = MagickTrue) then
    begin
      //use a pixel iterator to draw a diagonal line
      Iterator:=NewPixelIterator(ImageWand);
      if assigned(Iterator) then
      begin
        //return the next row as an array of pixel wands
        PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
        RowIndex := 0;
        while assigned(PixelWands) do
        begin
          inc(PixelWands,RowIndex); //move to the pixel wand at column=row
          PixelSetColor(PixelWands^,'#224466');
          PixelSyncIterator(Iterator);
          PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
          inc(RowIndex);
        end;
      end;

      MagickWriteImage(ImageWand,PChar(AOutputFileName));
    end;
  finally
    DestroyPixelIterator(Iterator);
    DestroyMagickWand(ImageWand);
  end;
end;

initialization
  MagickWandGenesis;

finalization
  MagickWandTerminus;


....and put the following in pixel_iterator.inc

//****correction*****
function NewPixelIterator(wand: PMagickWand): PPixelIterator; cdecl; external 
WandExport;

//****extra declaration****
function PixelGetNextIteratorRow(iterator: PPixeliterator; var columnCount : 
Cardinal) : PPPixelWand; cdecl; external WandExport;

I compiled this in Kylix. Let me know if you have any problems. 
Todd.

On Wednesday 19 Apr 2006 03:54, Phil Middlemiss wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap=""> Yeah, I've got the source and looked through the API.

 &gt;From what I can see of the API though, it jumps straight down into the
 &gt; fine details of documenting each method and doesn't have anything that
 &gt; tells you "This is the general approach to use".

 For example, I see that there is a routine called MagickSetFirstIterator
(among other iteration routines) but nowhere does it describe the way to
set up an iteration, or even what you are iterating. There is a pixel wand
too (and a pixel iterator), but I can't find anything that describes the
overall method of using them.

 Have you got any examples (I don't care if they are not documented) that I
could look at?

 Cheers,
 Phil.

 Todd Martin wrote:
Hi Phil

Have you looked at the API documents?
{myInstallDirectoryForImageMagic}/share/doc/ImageMagick-6.2.6/www/api

Are you running Windows or Linux? Do you have the ImageMagic source or just
a binary download?

Todd.

On Wednesday 19 Apr 2006 02:39, Phil Middlemiss wrote:


Hi all,

I'm trying to understand Image Magick - I have got the Lazerus headers
and compiled and run the sample app listed on the wiki page for it. All
fine.

Now when it comes to actually working out how to use the thing I'm not
sure how to go about it. The documentation is a little different from
the actual Lazerus files, and even if it were the same it is lacking the
whole "This is the overview/paradigm" section.

What I really need is a good example that does more than just read in an
image and save it to another format. Does anyone has some
examples/documentation that they are willing to share?

Cheers,
Phil.


_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>



  </pre>
</blockquote>
</body>
</html>