2016-05-15 4 views
0

次のコードはWin32でコンパイルしますが、DelphiコンパイラエラーE2064を生成します。左側はWin64でコンパイルすると割り当てできません。Win32-でコンパイルWin64-コンパイラエラーE2064で

type 
    PRGB24 = ^TRGB24; 

    TRGB24 = record 
    B, G, R: Byte; 
    end; 

    PRGBArray = ^TRGBArray; 
    TRGBArray = array [Word] of TRGB24; 

procedure TFormCurves.ApplyCurve(Src: TIEBitmap); 
var 
    iRGBArray: PRGBArray; 
    SFill, X, Y: Integer; 
begin 
    if not AImageLoaded then 
    Exit; 
    iRGBArray := PRGBArray(Src.Scanline[0]); 
    SFill := Integer(Src.Scanline[1]) - Integer(iRGBArray); 
    for Y := 0 to Src.Height - 1 do 
    begin 
    for X := 0 to Src.Width - 1 do 
    begin 
     iRGBArray[X].R := ALUT[0, ALUT[1, iRGBArray[X].R]]; 
     iRGBArray[X].G := ALUT[0, ALUT[2, iRGBArray[X].G]]; 
     iRGBArray[X].B := ALUT[0, ALUT[3, iRGBArray[X].B]]; 
    end; 
    Inc(Integer(iRGBArray), SFill);//compiler error E2064 left side cannot be assigned to 
    end; 
end; 

procedure TFormCurves.GetHist; 
var 
    iRGBArray: PRGBArray; 
    X, Y, SFill: Integer; 
    iIEBitmap: TIEBitmap; 
    iRGB: TRGB24; 
    R, G, B, l: Byte; 
begin 
    if not AImageLoaded then 
    Exit; 
    for Y := 0 to 3 do 
    begin 
    AMaxHistory[Y] := 0; 
    for X := 0 to 255 do 
     AHistory[Y, X] := 0; 
    end; 
    iIEBitmap := imgView.IEBitmap; 
    iRGBArray := PRGBArray(iIEBitmap.Scanline[0]); 
    SFill := Integer(iIEBitmap.Scanline[1]) - Integer(iRGBArray); 
    for Y := 0 to iIEBitmap.Height - 1 do 
    begin 
    for X := 0 to iIEBitmap.Width - 1 do 
    begin 
     iRGB := iRGBArray[X]; 
     R := iRGB.R; 
     G := iRGB.G; 
     B := iRGB.B; 
     l := (R + G + B) div 3; 
     AHistory[0, l] := AHistory[0, l] + 1; 
     AHistory[1, R] := AHistory[1, R] + 1; 
     AHistory[2, G] := AHistory[2, G] + 1; 
     AHistory[3, B] := AHistory[3, B] + 1; 
    end; 
    Inc(Integer(iRGBArray), SFill); //compiler error E2064 left side cannot be assigned to 
    end; 
    for Y := 0 to 3 do 
    for X := 0 to 255 do 
     if AHistory[Y, X] > AMaxHistory[Y] then 
     AMaxHistory[Y] := AHistory[Y, X]; 
end; 

Win64でのコンパイラエラーをどのように排除できますか?

答えて

2

Win64では、ポインタは64ビット幅で、Integerは32ビット幅です。このようなキャストでは、代入式の両辺が同じサイズである必要があります。したがって、エラー。

Integerにキャストする代わりに、PByteにキャストします。

Inc(PByte(iRGBArray), SFill);  

他のすべてのIntegerキャストは間違っています。これらのタイプのさまざまなサイズを把握する必要があります。解決するにはNativeIntにキャストしてください。

+0

これは、コンパイルエラーを修正しましたが、今はPRGBArray(sDst)[X]でWin64でランタイム例外が発生します。 Win32では実行時エラーはありません。何か案は?必要に応じて、別の質問で手順を掲載する必要がありますか? – Bill

+0

そのコードは問題になりません。私が見ることができないコードについて本当にあなたの意見を欲しいですか? –

+0

OK ..ランタイム問題の質問を投稿します – Bill