AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.PixelFromPoint Method (Single, Single)

Converts a point on the sprite's image to the pixel on the sprite's image that is underneath that point. For example if a 200x100 pixel image was assigned to a sprite of size 10x10, then calling this method with a pixel value of 5,5 (center of the sprite) would return 100,50 (center of the image).

Syntax
Pascal
function PixelFromPoint(const X: Single; const Y: Single): TAgkPoint; overload;
Parameters 
Description 
const X: Single 
the X coordinate of the surface point. 
const Y: Single 
the Y coordinate of the surface point. 

The surface point converted to the pixel point.

The sprite must have an image assigned for this to work or it will always return 0. The method is not limited by the size of the image or sprite, so in the above example a pixel value of 20,5 or 5,-1 would both be valid.

Copyright (c) 2012. All rights reserved.