BdLm
asked on
PNG Image Lib , can't compile with D2010
I tried to compile the PNG image lib with delphi 2010 from http://pngdelphi.sourceforge.net .
Compiler stops, because of can't assign a value to the left side error at this line:
Byte(Dest^) := fOwner.GammaTable[pByte(Lo ngint(Src) + 2)^]; inc(Dest);
compile that lib and run with D7 has been no problem
pngimage.pas
pnglang.pas
zlibpas.pas
Compiler stops, because of can't assign a value to the left side error at this line:
Byte(Dest^) := fOwner.GammaTable[pByte(Lo
compile that lib and run with D7 has been no problem
procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte;
Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar);
var
Col: Integer;
begin
{Get first column and enter in loop}
Col := ColumnStart[Pass];
Dest := pChar(Longint(Dest) + Col * 3);
repeat
{Copy this row}
Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest);
Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest);
Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest);
{Move to next column}
inc(Src, 3);
inc(Dest, ColumnIncrement[Pass] * 3 - 3);
inc(Col, ColumnIncrement[Pass]);
until Col >= ImageWidth;
end;
pngextra.paspngimage.pas
pnglang.pas
zlibpas.pas
To elaborate, you can add these to your uses clause:
gif, pngImage, jpeg
procedure TForm1.Button1Click(Sender : TObject);
var
p: TPngImage;
begin
Image1.Picture.LoadFromFil e('C:\tmp. bmp');
p := TPngImage.Create;
p.Assign(image1.picture);
p.SaveTofile('test.png');
end;
gif, pngImage, jpeg
procedure TForm1.Button1Click(Sender
var
p: TPngImage;
begin
Image1.Picture.LoadFromFil
p := TPngImage.Create;
p.Assign(image1.picture);
p.SaveTofile('test.png');
end;
ASKER
Thanks for your input!
a ) is the unit pngimage from my post above the one which is now part of delphi 2010 , 2009 ????
b) We use D7 and d2010 for software development, therefore would like to comple also the "older code" from my post..
Any ideas on the compiler trouble ???
a ) is the unit pngimage from my post above the one which is now part of delphi 2010 , 2009 ????
b) We use D7 and d2010 for software development, therefore would like to comple also the "older code" from my post..
Any ideas on the compiler trouble ???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
should I change this code in general of is this change D2010 specific ?
{$if def Delphi 7 }
....... some old code
{$endif }
{$if def Delphi 2010 }
....... the new code
{$endif }
{$if def Delphi 7 }
....... some old code
{$endif }
{$if def Delphi 2010 }
....... the new code
{$endif }
In Codegear\rad studio\<6.0 or 7.0>\lib, there should be
zlib.dcu
zlibconst.dcu
pngimage.dcu
pnglang.dcu
And the library should be available to your IDE.