Error in example [Delphi]

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

LarsNielsen
Posts: 2
Joined: Fri Dec 12, 2003 8:44 am

Error in example [Delphi]

Post by LarsNielsen »

I got two bad problems if I try to show an Black und White (B/W)-TIFF-Image with the Delphi-example:

1) There must be an error in the CASE "pf1bit" of "bmp.PixelFormat", an B/W TIFF-Image the output is rubbish.
I tried to change

Code: Select all

if ((x mod 8) = 0) then
   inc(k);
Mask := Mask1 shr (x mod 8);
if LineIn[x] = 0 then
   LineOut[k] := (LineIn[x] xor Mask);
into

Code: Select all

Inc(x);
LineOut[k] := LineIn[x];
That looks much better, but not correct - the image seems to be "shifted" to the left.

2) If I try to show a large B/W-TIFF-Image (9354 by 13244 pixel) I always get an exception in the line in code mentioned above:

Code: Select all

if LineIn[x] = 0 then
I asume these errors are Delphi specific, because XnView does it correct and it occurs in the Input-To-Output routines of the example.

I also asume this errors are not TIFF-specific, because this routines are independent of the grafic-format.
Lars Nielsen

Dontenwill GmbH
Software + Consulting
www.BusinessExpress.de
User avatar
xnview
Author of XnView
Posts: 44589
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Error in example [Delphi]

Post by xnview »

LarsNielsen wrote:I got two bad problems if I try to show an Black und White (B/W)-TIFF-Image with the Delphi-example:
Yes, sorry the delphi example is not so good.

For pf1bit, you can make that:

Load your bitmap with a 32bits padding!

Code: Select all

lp.LinePadding := 4;
And copy the data:

Code: Select all

        for y := 0 to gfl_bmp.Height - 1 do begin
          move(  Pointer(Integer(gfl_bmp.data) + (y * gfl_bmp.BytesPerLine))^,
            bmp.Scanline[y]^, gfl_bmp.BytesPerLine);
        end;
Regards. Pierre.
LarsNielsen
Posts: 2
Joined: Fri Dec 12, 2003 8:44 am

Post by LarsNielsen »

Thank you, works fine now! :D
Lars Nielsen

Dontenwill GmbH
Software + Consulting
www.BusinessExpress.de