Home > Back-end >  Consult each great god a question, and DELPHI how to obtain a pointer to the object instance?
Consult each great god a question, and DELPHI how to obtain a pointer to the object instance?

Time:11-16

@ Image1. Picture. Bitmap. Canvas. Pixels [0, 0]
This writing, is wrong, how to correctly?

CodePudding user response:

Pixel is a Property (Property), is essentially a function, so get the return value is the address of the meaningless,
 
Var
Color: TColor;
PColor: ^ TColor;
The begin
Color:=Image1. Picture. Bitmap. Canvas. The Pixels [0, 0];
PColor:=@ Color;
end;

CodePudding user response:

Should be quoted by handle,

CodePudding user response:

Bitmap. Canvas. Pixels [0, 0] is a function, the return value is a color value TColor no object

The other Pixels is slow, if you want to traverse the Pixels, it is recommended to use Bitmap. The ScanLine, this is the performance of the Pixels of more than 100 times...

CodePudding user response:

TColor is a 4-byte value, makes little sense to you preach a 4-byte Pointers

CodePudding user response:

More peculiar thinking, introduce object-oriented programming (OOP) is to hide a pointer, and dating a pointer to bring chaos, how do you do exactly the opposite?

CodePudding user response:

More peculiar thinking, introduce object-oriented programming (OOP) is to hide a pointer, and get rid of a pointer to bring chaos, how do you do exactly the opposite?
  • Related