<!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> </DIV>
<DIV><SPAN class=208581803-21042006><FONT face=Arial color=#0000ff size=2>Anyone
recognise that number? 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> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>procedure
xcClearGrid(PGrid:TStringGrid);<BR>var<BR>i,maxclear:integer;<BR>begin<BR>
maxclear:=PGrid.FixedRows;<BR> if Pgrid.rowcount>0 then
maxclear:=PGrid.rowcount-1;<SPAN
class=208581803-21042006> <======here</SPAN><BR>
for I := PGrid.FixedRows to maxclear do<BR>
PGrid.Rows[i].Clear();<BR>
PGrid.RowCount:=PGrid.FixedRows; //can only clear <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> </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> <A
href="mailto:john@jbcl.co.nz">john@jbcl.co.nz</A></FONT></P>
<P class=MsoAutoSig><FONT face=Arial size=2> </FONT><A
href="mailto:johnkbird@paradise.net.nz">johnkbird@paradise.net.nz</A></P>
<P class=MsoAutoSig><FONT face=Arial size=2>Expert in Beyond
Software</FONT></P>
<P class=MsoAutoSig>Ph land (03)384-4527 mobile (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> </P>
<P class=MsoAutoSig><o:p><!--StartFragment --> </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> <<A href="mailto:toddm@kol.co.nz">toddm@kol.co.nz</A>>
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 > 255?<BR><BR>Todd.<BR><BR>On Wednesday 19 Apr 2006
21:42, Phil Middlemiss wrote: <BR>> Thanks for the example
Todd - yeah, that's compiling and seems to be<BR>> running fine. There
are no reported memory leaks around the pixel wands<BR>>
either.<BR>><BR>> One question though: the PixelPacket
contains *Word* values for red, <BR>> green, blue, and opacity. How do
I interpret values greater than
255?<BR>><BR>> Cheers,<BR>> Phil.<BR>><BR>> Todd
Martin wrote:<BR>> Hi Phil<BR>><BR>> I've only just started
looking at Image Magic myself. <BR>> Try this :)<BR>> You'll need to
add a correction and a function declaration to<BR>>
"pixel_iterator.inc" as outlined below.<BR>><BR>>
uses<BR>> magick_wand, ImageMagick;<BR>><BR>>
procedure DrawDiagonalLine(AInputFileName, AOutputFileName : AnsiString);
<BR>> var<BR>> Iterator :
PPixelIterator;<BR>> PixelWands :
PPPixelWand;<BR>> ImageWand :
PMagickWand;<BR>> Status :
MagickBooleanType;<BR>> RowIndex, WandCount :
Cardinal;<BR>> begin<BR>> Iterator := nil;
<BR>> ImageWand := nil;<BR>>
try<BR>> ImageWand :=
NewMagickWand;<BR>> status :=
MagickReadImage(ImageWand,PChar(AInputFileName));<BR>>
if (status = MagickTrue) then<BR>>
begin<BR>> //use a pixel iterator
to draw a diagonal line <BR>>
Iterator:=NewPixelIterator(ImageWand);<BR>>
if assigned(Iterator) then<BR>>
begin<BR>> //return the
next row as an array of pixel
wands<BR>>
PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
<BR>> RowIndex :=
0;<BR>> while
assigned(PixelWands)
do<BR>>
begin<BR>>
inc(PixelWands,RowIndex); //move to the pixel wand at
column=row<BR>>
PixelSetColor(PixelWands^,'#224466');
<BR>>
PixelSyncIterator(Iterator);<BR>>
PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);<BR>>
inc(RowIndex);<BR>>
end;<BR>>
end;<BR>><BR>>
MagickWriteImage(ImageWand,PChar(AOutputFileName));
<BR>> end;<BR>>
finally<BR>>
DestroyPixelIterator(Iterator);<BR>>
DestroyMagickWand(ImageWand);<BR>> end;<BR>>
end;<BR>><BR>> initialization<BR>>
MagickWandGenesis;<BR>><BR>> finalization<BR>>
MagickWandTerminus;<BR>><BR>><BR>> ....and put the following in
pixel_iterator.inc<BR>><BR>> //****correction*****<BR>> function
NewPixelIterator(wand: PMagickWand): PPixelIterator; cdecl; <BR>>
external WandExport;<BR>><BR>> //****extra declaration****<BR>>
function PixelGetNextIteratorRow(iterator: PPixeliterator; var
columnCount<BR>> : Cardinal) : PPPixelWand; cdecl; external
WandExport;<BR>><BR>> I compiled this in Kylix. Let me know if you
have any problems.<BR>> Todd.<BR>><BR>> On Wednesday 19 Apr 2006
03:54, Phil Middlemiss wrote:<BR>><BR>><BR>> Yeah,
I've got the source and looked through the API.
<BR>><BR>> >From what I can see of the API though, it
jumps straight down into the<BR>> > fine details of
documenting each method and doesn't have anything
that<BR>> > tells you "This is the general approach to
use". <BR>><BR>> For example, I see that there is a
routine called MagickSetFirstIterator<BR>> (among other iteration
routines) but nowhere does it describe the way to<BR>> set up an
iteration, or even what you are iterating. There is a pixel wand <BR>>
too (and a pixel iterator), but I can't find anything that describes
the<BR>> overall method of using them.<BR>><BR>> Have
you got any examples (I don't care if they are not documented) that
I<BR>> could look at?
<BR>><BR>> Cheers,<BR>> Phil.<BR>><BR>> Todd
Martin wrote:<BR>> Hi Phil<BR>><BR>> Have you looked at the API
documents?<BR>>
{myInstallDirectoryForImageMagic}/share/doc/ImageMagick-6.2.6/www/api
<BR>><BR>> Are you running Windows or Linux? Do you have the
ImageMagic source or just<BR>> a binary download?<BR>><BR>>
Todd.<BR>><BR>> On Wednesday 19 Apr 2006 02:39, Phil Middlemiss
wrote:<BR>><BR>><BR>> Hi all,<BR>><BR>> I'm trying to
understand Image Magick - I have got the Lazerus headers<BR>> and
compiled and run the sample app listed on the wiki page for it.
All<BR>> fine.<BR>><BR>> Now when it comes to actually working
out how to use the thing I'm not <BR>> sure how to go about it. The
documentation is a little different from<BR>> the actual Lazerus files,
and even if it were the same it is lacking the<BR>> whole "This is the
overview/paradigm" section. <BR>><BR>> What I really need is a good
example that does more than just read in an<BR>> image and save it to
another format. Does anyone has some<BR>> examples/documentation that
they are willing to share?<BR>><BR>> Cheers,<BR>>
Phil.<BR>><BR>><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>><BR>><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>_______________________________________________<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>