{TChunkIDAT implementation}const
  {Adam 7 interlacing values}
  RowStart: array[0..6] of Integer = (0, 0, 4, 0, 2, 0, 1);
  ColumnStart: array[0..6] of Integer = (0, 4, 0, 2, 0, 1, 0);
  RowIncrement: array[0..6] of Integer = (8, 8, 8, 4, 4, 2, 2);
  ColumnIncrement: array[0..6] of Integer = (8, 8, 4, 4, 2, 2, 1);{Copy interlaced images with 1 byte for R, G, B}
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;
以上代码在delphi6可以顺利编译,但是2009编译的时候 Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest);报错
[DCC Error] pngimage.pas(2769): E2064 Left side cannot be assigned to
希望有人能指点一下

解决方案 »

  1.   

    procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; 
      Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); 
    改成:
    procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; 
      Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: PByte); 
      

  2.   

    procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; 
      Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); 
    改成:
    procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; 
      Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: PByte); 
      

  3.   

    又出现了一个新问题
    Dest := pChar(Longint(Dest) + Col * 3); 
    [DCC Error] pngimage.pas(2766): E2010 Incompatible types: 'PByte' and 'PWideChar'
    应该是类型不对,我不太熟悉delphi,一直用BCB的。怎么才能赋值呢?
      

  4.   

    Dest := PByte(Longint(Dest) + Col * 3); 试试
      

  5.   

    pChar改成PByte 类型不一样 其计算结果会不会和原先的 不同?
      

  6.   

    replace all: PChar -> PAnsiChar
      

  7.   

    结果一样的想再转回PChar(Dest) 就可以了