<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o = 
"urn:schemas-microsoft-com:office:office"><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff 
size=2>4661289</FONT></SPAN></DIV>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff size=2>Anyone 
recognise that number?&nbsp; I am getting that when I pass a StringGrid to a 
utility routine as the value of the rowcount.</FONT></SPAN></DIV>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff size=2>It 
should be zero or 1 in the example I am running.</FONT></SPAN></DIV>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff size=2>Not 
surprisingly causes an access violation....</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>procedure 
xcClearGrid(PGrid:TStringGrid);<BR>var<BR>i,maxclear:integer;<BR>begin<BR>&nbsp; 
maxclear:=PGrid.FixedRows;<BR>&nbsp; if Pgrid.rowcount&gt;0 then 
maxclear:=PGrid.rowcount-1;<SPAN 
class=208581803-21042006>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;======here</SPAN><BR>&nbsp; 
for I := PGrid.FixedRows to maxclear do<BR>&nbsp;&nbsp;&nbsp; 
PGrid.Rows[i].Clear();<BR>&nbsp;&nbsp;&nbsp; 
PGrid.RowCount:=PGrid.FixedRows;&nbsp; //can only clear&nbsp;<SPAN 
class=208581803-21042006>from there</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=208581803-21042006></SPAN>end;<BR></DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV class=Section1>
<P class=MsoAutoSig align=left>John Bird</P>
<P class=MsoAutoSig><FONT face=Arial size=2>email</FONT></P>
<P class=MsoAutoSig><FONT face=Arial size=2>&nbsp;<A 
href="mailto:john@jbcl.co.nz">john@jbcl.co.nz</A></FONT></P>
<P class=MsoAutoSig><FONT face=Arial size=2>&nbsp;</FONT><A 
href="mailto:johnkbird@paradise.net.nz">johnkbird@paradise.net.nz</A></P>
<P class=MsoAutoSig><FONT face=Arial size=2>Expert in&nbsp;Beyond 
Software</FONT></P>
<P class=MsoAutoSig>Ph land (03)384-4527&nbsp; mobile&nbsp;(027)484-4528</P>
<P class=MsoAutoSig>92 Soleares Ave, Mt Pleasant</P>
<P class=MsoAutoSig>Christchurch</P>
<P class=MsoAutoSig><o:p><FONT face=Arial size=2>Web <A 
href="http://www.jbcl.co.nz/">www.jbcl.co.nz</A></FONT></o:p></P>
<P class=MsoAutoSig><o:p><FONT face=Arial size=2></FONT></o:p>&nbsp;</P>
<P class=MsoAutoSig><o:p><!--StartFragment -->&nbsp;</o:p></P></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  delphi-bounces@ns3.123.co.nz [mailto:delphi-bounces@ns3.123.co.nz] <B>On 
  Behalf Of </B>Phil Middlemiss<BR><B>Sent:</B> Friday, 21 April 2006 8:37 
  a.m.<BR><B>To:</B> NZ Borland Developers Group - Delphi 
  List<BR><B>Subject:</B> Re: [DUG] Image Magick 
  examples<BR><BR></FONT></DIV>It's OK, I've worked it out. There is another set 
  of routines to retrieve normalised colour values (0..1) and they match up with 
  dividing the Word values by 65535 so I'm guessing it's to support graphic 
  formats that have ability to store a 2bytes per pixel colour depth. Anyway, 
  I'm using the normalised values now and it's all good.<BR><BR>The ImageMagick 
  libraries seem very good at handling large graphic files without being 
  processor intensive (although you need a lot of hard drive space). I'm 
  adapting a TGraphic descendant that someone wrote a few years ago for an 
  earlier version, to work with the latest version of ImageMagick (seems they 
  reworked their architecture somewhat). If anyone else is interested then let 
  me know and I'll make the code available when it's polished 
  off.<BR><BR>Phil.<BR><BR>Paul A Norman wrote: 
  <BLOCKQUOTE 
  cite=mid7a20a4ed0604192349u63e6537bpb7d1be39065c82a7@mail.gmail.com 
  type="cite">Shouldn't, but is there a setting for the Colour Gamut?<BR><BR>
    <DIV><SPAN class=gmail_quote>On 21/04/06, <B class=gmail_sendername>Todd 
    Martin</B> &lt;<A href="mailto:toddm@kol.co.nz">toddm@kol.co.nz</A>&gt; 
    wrote:</SPAN> 
    <BLOCKQUOTE class=gmail_quote 
    style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Do 
      you ever get values &gt; 255?<BR><BR>Todd.<BR><BR>On Wednesday 19 Apr 2006 
      21:42, Phil Middlemiss wrote: <BR>&gt;&nbsp;&nbsp;Thanks for the example 
      Todd - yeah, that's compiling and seems to be<BR>&gt; running fine. There 
      are no reported memory leaks around the pixel wands<BR>&gt; 
      either.<BR>&gt;<BR>&gt;&nbsp;&nbsp;One question though: the PixelPacket 
      contains *Word* values for red, <BR>&gt; green, blue, and opacity. How do 
      I interpret values greater than 
      255?<BR>&gt;<BR>&gt;&nbsp;&nbsp;Cheers,<BR>&gt;&nbsp;&nbsp;Phil.<BR>&gt;<BR>&gt;&nbsp;&nbsp;Todd 
      Martin wrote:<BR>&gt; Hi Phil<BR>&gt;<BR>&gt; I've only just started 
      looking at Image Magic myself. <BR>&gt; Try this :)<BR>&gt; You'll need to 
      add a correction and a function declaration to<BR>&gt; 
      "pixel_iterator.inc" as outlined below.<BR>&gt;<BR>&gt; 
      uses<BR>&gt;&nbsp;&nbsp; magick_wand, ImageMagick;<BR>&gt;<BR>&gt; 
      procedure DrawDiagonalLine(AInputFileName, AOutputFileName : AnsiString); 
      <BR>&gt; var<BR>&gt;&nbsp;&nbsp; Iterator : 
      PPixelIterator;<BR>&gt;&nbsp;&nbsp; PixelWands : 
      PPPixelWand;<BR>&gt;&nbsp;&nbsp; ImageWand : 
      PMagickWand;<BR>&gt;&nbsp;&nbsp; Status : 
      MagickBooleanType;<BR>&gt;&nbsp;&nbsp; RowIndex, WandCount : 
      Cardinal;<BR>&gt; begin<BR>&gt;&nbsp;&nbsp; Iterator := nil; 
      <BR>&gt;&nbsp;&nbsp; ImageWand := nil;<BR>&gt;&nbsp;&nbsp; 
      try<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ImageWand := 
      NewMagickWand;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; status := 
      MagickReadImage(ImageWand,PChar(AInputFileName));<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
      if (status = MagickTrue) then<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
      begin<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //use a pixel iterator 
      to draw a diagonal line <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      Iterator:=NewPixelIterator(ImageWand);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      if assigned(Iterator) then<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      begin<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //return the 
      next row as an array of pixel 
      wands<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount); 
      <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RowIndex := 
      0;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while 
      assigned(PixelWands) 
      do<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      begin<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      inc(PixelWands,RowIndex); //move to the pixel wand at 
      column=row<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      PixelSetColor(PixelWands^,'#224466'); 
      <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      PixelSyncIterator(Iterator);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      inc(RowIndex);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      end;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      end;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      MagickWriteImage(ImageWand,PChar(AOutputFileName)); 
      <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; end;<BR>&gt;&nbsp;&nbsp; 
      finally<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
      DestroyPixelIterator(Iterator);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
      DestroyMagickWand(ImageWand);<BR>&gt;&nbsp;&nbsp; end;<BR>&gt; 
      end;<BR>&gt;<BR>&gt; initialization<BR>&gt;&nbsp;&nbsp; 
      MagickWandGenesis;<BR>&gt;<BR>&gt; finalization<BR>&gt;&nbsp;&nbsp; 
      MagickWandTerminus;<BR>&gt;<BR>&gt;<BR>&gt; ....and put the following in 
      pixel_iterator.inc<BR>&gt;<BR>&gt; //****correction*****<BR>&gt; function 
      NewPixelIterator(wand: PMagickWand): PPixelIterator; cdecl; <BR>&gt; 
      external WandExport;<BR>&gt;<BR>&gt; //****extra declaration****<BR>&gt; 
      function PixelGetNextIteratorRow(iterator: PPixeliterator; var 
      columnCount<BR>&gt; : Cardinal) : PPPixelWand; cdecl; external 
      WandExport;<BR>&gt;<BR>&gt; I compiled this in Kylix. Let me know if you 
      have any problems.<BR>&gt; Todd.<BR>&gt;<BR>&gt; On Wednesday 19 Apr 2006 
      03:54, Phil Middlemiss wrote:<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp;Yeah, 
      I've got the source and looked through the API. 
      <BR>&gt;<BR>&gt;&nbsp;&nbsp;&gt;From what I can see of the API though, it 
      jumps straight down into the<BR>&gt;&nbsp;&nbsp;&gt; fine details of 
      documenting each method and doesn't have anything 
      that<BR>&gt;&nbsp;&nbsp;&gt; tells you "This is the general approach to 
      use". <BR>&gt;<BR>&gt;&nbsp;&nbsp;For example, I see that there is a 
      routine called MagickSetFirstIterator<BR>&gt; (among other iteration 
      routines) but nowhere does it describe the way to<BR>&gt; set up an 
      iteration, or even what you are iterating. There is a pixel wand <BR>&gt; 
      too (and a pixel iterator), but I can't find anything that describes 
      the<BR>&gt; overall method of using them.<BR>&gt;<BR>&gt;&nbsp;&nbsp;Have 
      you got any examples (I don't care if they are not documented) that 
      I<BR>&gt; could look at? 
      <BR>&gt;<BR>&gt;&nbsp;&nbsp;Cheers,<BR>&gt;&nbsp;&nbsp;Phil.<BR>&gt;<BR>&gt;&nbsp;&nbsp;Todd 
      Martin wrote:<BR>&gt; Hi Phil<BR>&gt;<BR>&gt; Have you looked at the API 
      documents?<BR>&gt; 
      {myInstallDirectoryForImageMagic}/share/doc/ImageMagick-6.2.6/www/api 
      <BR>&gt;<BR>&gt; Are you running Windows or Linux? Do you have the 
      ImageMagic source or just<BR>&gt; a binary download?<BR>&gt;<BR>&gt; 
      Todd.<BR>&gt;<BR>&gt; On Wednesday 19 Apr 2006 02:39, Phil Middlemiss 
      wrote:<BR>&gt;<BR>&gt;<BR>&gt; Hi all,<BR>&gt;<BR>&gt; I'm trying to 
      understand Image Magick - I have got the Lazerus headers<BR>&gt; and 
      compiled and run the sample app listed on the wiki page for it. 
      All<BR>&gt; fine.<BR>&gt;<BR>&gt; Now when it comes to actually working 
      out how to use the thing I'm not <BR>&gt; sure how to go about it. The 
      documentation is a little different from<BR>&gt; the actual Lazerus files, 
      and even if it were the same it is lacking the<BR>&gt; whole "This is the 
      overview/paradigm" section. <BR>&gt;<BR>&gt; What I really need is a good 
      example that does more than just read in an<BR>&gt; image and save it to 
      another format. Does anyone has some<BR>&gt; examples/documentation that 
      they are willing to share?<BR>&gt;<BR>&gt; Cheers,<BR>&gt; 
      Phil.<BR>&gt;<BR>&gt;<BR>&gt; 
      _______________________________________________<BR>&gt; Delphi mailing 
      list<BR>&gt; <A 
      href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</A><BR>&gt; <A 
      href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</A><BR>&gt;<BR>&gt;<BR>&gt; 
      _______________________________________________<BR>&gt; Delphi mailing 
      list<BR>&gt; <A 
      href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</A><BR>&gt; <A 
      href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</A><BR>_______________________________________________<BR>Delphi 
      mailing list<BR><A 
      href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</A><BR><A 
      href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</A><BR></BLOCKQUOTE></DIV><BR><PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
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><BR><BR>__________ NOD32 1.1461 (20060329) Information 
  __________<BR><BR>This message was checked by NOD32 antivirus system.<BR><A 
  href="http://www.eset.com">http://www.eset.com</A><BR></BLOCKQUOTE></BODY></HTML>