开发者

Get Current Pixel value using Scanline in Delphi

I am trying to get the current pixel in an image by a "OnMouseMove event" Using Scanline.

something equivalent to this:

Label1.Capt开发者_运维知识库ion := IntToStr(Image1.Picture.Bitmap.Canvas.Pixels[X,Y]);

Any ideas ?


ScanLine returns a pointer to a packed array of pixels that constitutes one line of a bitmap. Using this pointer you can access these pixels fast.

ScanLine can't help if you need only one pixel.

Still you can use ScanLine here; assuming bitmap pixel format pf32bit:

Label1.Caption:= IntToStr(PIntegerArray(Image1.Picture.Bitmap.ScanLine[Y])^[X]);


Scanlines are useful for quickly scanning the entire line, like in your other post. But if you want to get an arbitrary single pixel, the best way to do it is to use the code you've already got.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜