Image rotation with Bos Taurus

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
Posts: 54
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 2 times
Been thanked: 2 times

Image rotation with Bos Taurus

Post by bluebird » Sat Feb 04, 2017 5:13 pm

I would be grateful for any help in my Bos Taurus learning curve.

In the code fragment below, I want to show an arrow symbol called "pointer.jpg" in several different rotated positions on the same form.
The base image un-rotated is a "Vee" shape pointing in a horizontal right direction.

nDegrees is calculated in function AngleX based on the slope of the line from start point nX1,nY1 ending at nX2,nY2
hBitmap2 is the handle to the original "pointer.jpg" image
hBitmap3 is the handle to the image rotated by nDegrees

Question 1. The rotation using BT_BITMAP_ROTATE seems to be clockwise instead of the expected counter-clockwise. Is that observation correct?

Question 2. Am I using BT functions (rotating and showing) correctly according to the code fragment below?

Question 3. If you want to show the image in a new place after a 2nd rotation, do you have to first reset it to the original horizontal position ?

Code Fragment

hBitmap3:=BT_BitmapTransform (hBitmap2, BT_BITMAP_ROTATE , nDegrees, WHITE) // rotate command
BT_DrawBitmapTransparent (hDC, nRow2-15,nCol2-10, 30, 30, BT_SCALE, hBitmap3) // show rotated image
BT_DrawBitmapTransparent (hDC,50 ,750, 40, 40, BT_SCALE, hBitmap2) // draw unrotated image off to the side

BT_DrawBitmapTransparent (hDC, nRow3-15,nCol3-10, 30, 30, BT_SCALE, hBitmap3) // show rotated image in another place

Function AngleX(x1,y1,x2,y2)
#DEFINE PI 3.1415

Local nAngleInDegrees, nAtanx, nRatio, nCircleRadians:=2*PI


msgbox("angle is "+str(nAngleInDegrees)+"Deg.")
Return 360-nAngleInDegrees

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest