Ple*_*rds 0 delphi png image delphi-xe3 graphicex
我正在尝试将GraphicEx组件库(用于PNG文件)从我的Delphi 2006移植到XE3(最后得到它),在纠正基本错误时,我遇到了这个错误:
"TPNGGraphic.IsChunk" invalid type cast
Run Code Online (Sandbox Code Playgroud)
在线:
function TPNGGraphic.IsChunk(ChunkType: TChunkType): Boolean;
// determines, independant of the cruxial 5ths bits in each "letter", whether the
// current chunk type in the header is the same as the given chunk type
const
Mask = not $20202020;
begin
Result := (Cardinal(FHeader.ChunkType) and Mask) = (Cardinal(ChunkType) and Mask); // <-- this line
end;
Run Code Online (Sandbox Code Playgroud)
有谁知道我该怎么做才能纠正它?
TChunkType定义为
type
TChunkType = array[0..3] of Char;
Run Code Online (Sandbox Code Playgroud)
因此编译器无法将TChunkType类型转换为Cardinal.
尝试将定义更改为
type
TChunkType = array[0..3] of AnsiChar;
Run Code Online (Sandbox Code Playgroud)