Its close to the truncation value from int64 to int32 that we see sometimes
From: "John Bird" <[EMAIL PROTECTED]> To: "'NZ Borland Developers Group - Delphi List'" <[email protected]> Subject: [DUG] Stringgrid Date sent: Fri, 21 Apr 2006 15:27:17 +1200 Organization: John Bird Consulting Send reply to: [EMAIL PROTECTED], NZ Borland Developers Group - Delphi List <[email protected]> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]> 4661289 Anyone recognise that number? I am getting that when I pass a StringGrid to a utility routine as the value of the rowcount. It should be zero or 1 in the example I am running. Not surprisingly causes an access violation.... procedure xcClearGrid(PGrid:TStringGrid); var i,maxclear:integer; begin maxclear:=PGrid.FixedRows; if Pgrid.rowcount>0 then maxclear:=PGrid.rowcount- 1;<======here for I := PGrid.FixedRows to maxclear do PGrid.Rows[i].Clear(); PGrid.RowCount:=PGrid.FixedRows; //can only clearfrom there end; John Bird email [EMAIL PROTECTED] [EMAIL PROTECTED] Expert inBeyond Software Ph land (03)384-4527 mobile(027)484-4528 92 Soleares Ave, Mt Pleasant Christchurch Web www.jbcl.co.nz -----Original Message----- From: [EMAIL PROTECTED] [mailto:delphi- [EMAIL PROTECTED] On Behalf Of Phil Middlemiss Sent: Friday, 21 April 2006 8:37 a.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Image Magick examples 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. 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. Phil. Paul A Norman wrote: Shouldn't, but is there a setting for the Colour Gamut? On 21/04/06, Todd Martin <[EMAIL PROTECTED]> wrote: Do you ever get values > 255? Todd. On Wednesday 19 Apr 2006 21:42, Phil Middlemiss wrote: >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. > >One question though: the PixelPacket contains *Word* values for red, > green, blue, and opacity. How do I interpret values greater than 255? > >Cheers, >Phil. > >Todd Martin wrote: > 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: > > >Yeah, I've got the source and looked through the API. > >>From what I can see of the API though, it jumps straight down into the >> fine details of documenting each method and doesn't have anything that >> 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 > [email protected] > http://ns3.123.co.nz/mailman/listinfo/delphi > > > _______________________________________________ > Delphi mailing list > [email protected] > http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi __________ NOD32 1.1461 (20060329) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.comRegards Rohit ===================================================== ================= CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH (649) 489-2280 FX (649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] ===================================================== ================= _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
