问题
In particular, i want to preset desired size, fetch a bitmap from external source, and then work with data in classy objecty-oriented manner.
I presume what
- TBits isnt just a straightforward collection of Booleans and
- internal storage is contiguous.
Am i correct with such assumptions?
回答1:
- Correct,
TBitsis internally bit-structured, so it's not a straightforward collection of booleans. - Yes, storage is handled by allocating contiguous memory big enough to carry the size( in increments of SizeOf(integer)).
To get access to the internal data pointer, class helpers can be used.
Type
TBitsHelper = class helper for TBits
private
function GetBitsPointer: Pointer;
public
property BitsPt: pointer read GetBitsPointer;
end;
function TBitsHelper.GetBitsPointer: Pointer;
begin
with Self do Result := FBits;
end;
来源:https://stackoverflow.com/questions/11375619/can-i-access-tbits-internal-bitmap