DrawImageRect / MidHandle / Position

BlitzPlus Forums/BlitzPlus Programming/DrawImageRect / MidHandle / Position

WillKoh(Posted 2003) [#1]
If I use DrawImageRect to draw a portion of an Image (in my case an animated if that matters), I get trouble positioning the extracted portition correctly (vertically) when I have midhandled the containing image. Is this a blitz bug or is there something I have overlooked?


Andy_A(Posted 2003) [#2]
From Blitz+ command ref:

[quote]
When an image is loaded with LoadImage, the image handle (the location within the image where the image is 'drawn from') is always defaulted to the top left corner (coordinates 0,0). This means if you draw an image that is 50x50 pixels at screen location 200,200, the image will begin to be drawn at 200,200 and extend to 250,250.

This command moves the image handle from the 0,0 coordinate of the image to the exact middle of the image. Therefore, in the same scenario above, if you were to draw a 50x50 pixel image at screen location 200,200 with its image handle set to Mid with this command, the image would start drawing at 175,175 and extend to 225,225.
[quote]

You probably need to adjust Y-coord by half the image height.


_Skully(Posted 2003) [#3]
alternatively, and I dont know why you would want to, you could draw the image at 200-(imagewidth(image)/2),200-(imageheight(image)/2)

Skully