Leonardo M. Ramé schrieb:
procedure TImageDrawer.Draw(ABuffer: Pointer); begin ... if MyImage.DataType = "Uint16" then data = PWord(ABuffer)^ else if MyImage.DataType = "Uint8" then data = PByte(ABuffer)^; end;If I do this, the result of PWord(ABuffer) is the same as PByte(ABuffer). I'm starting to think PByte is equal to Pointer type.
The address of ABuffer stays the same, the typecasts only affect the element type (pointed to).
I cannot provide a simpler solution than you found already. You have to find an type for "data" that allows for both signed and unsigned values in the range of the values, too, e.g. Int64. When ABuffer contains multiple values, typecasts also are required when incrementing the pointer.
DoDi -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
