Here's a piece of code that you can use to replace lines with stretched images.
One particular use would be drawing an Anti-Aliased line. You can also control the width of the line by changing the image:
Function DrawImageLine(img:Image, x1#, y1#, x2#, y2#)
PushMatrix()
Local Angle# = ATan2(x2 - x1, y2 - y1)
Local Size# = Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
Translate(x1, y1)
Rotate(270 + Angle)
Scale(Size / img.Width(), 1.0)
DrawImage(img, 0, 0)
PopMatrix()
End
It requires a horizontal image with the handle set to the left side. Ex.: If you want the image centered, SetHandle(0, img.Height() / 2.0). If you want the image to the left of the line, SetHandle(0, img.Height()).
|