CmdRotate

From MCS Wiki AVR
(Difference between revisions)
Jump to: navigation, search
(Created page with "= <span class="f_Header">Action</span> = Apply a rotation to the current matrix. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </s...")
 
 
Line 34: Line 34:
  
 
= <span class="f_Header">Example</span> =
 
= <span class="f_Header">Example</span> =
 +
 +
<source lang="bascomavr">
 +
' Pseudocode
 +
 +
' To rotate the bitmap clockwise by 10 degrees with respect to the top left of the bitmap
 +
Begin_G BITMAPS
 +
CmdLoadIdentity
 +
CmdRotate 10 * 65536 / 360
 +
CmdSetMatrix
 +
Vertex2II 68, 28, 0, 0
 +
</source> [[File:Clip0046.png|center|Clip0046.png]]
 +
 +
<source lang="bascomavr">
 +
' To rotate the bitmap counter clockwise by 33 degrees top left of the bitmap
 +
Begin_G BITMAPS
 +
CmdLoadIdentity
 +
CmdRotate -33 * 65536 / 360
 +
CmdSetMatrix
 +
Vertex2II 68, 28, 0, 0
 +
</source>
 +
 +
<source lang="bascomavr">
 +
' Rotating a 64 x 64 bitmap around its center
 +
Begin_G BITMAPS
 +
CmdLoadIdentity
 +
CmdTranslate 65536 * 32, 65536 * 32
 +
CmdRotate 90 * 65536 / 360
 +
CmdTranslate 65536 * -32, 65536 * -32
 +
CmdSetMatrix
 +
Vertex2II 68, 28, 0, 0
 +
</source> [[File:Clip0047.png|center|Clip0047.png]]
 +
 +
{{Languages}}
 +
 +
[[Category:FT800 Commands]]

Latest revision as of 19:43, 12 December 2014

Contents

Action

Apply a rotation to the current matrix.

 

 

Syntax

CmdRotate 

 

 

Remarks

a

Clockwise rotation angle, in units of 1/65536 of a circle

 

 

 

Example

' Pseudocode
 
' To rotate the bitmap clockwise by 10 degrees with respect to the top left of the bitmap
Begin_G BITMAPS
CmdLoadIdentity
CmdRotate 10 * 65536 / 360
CmdSetMatrix
Vertex2II 68, 28, 0, 0
Clip0046.png
' To rotate the bitmap counter clockwise by 33 degrees top left of the bitmap
Begin_G BITMAPS
CmdLoadIdentity
CmdRotate -33 * 65536 / 360
CmdSetMatrix
Vertex2II 68, 28, 0, 0
' Rotating a 64 x 64 bitmap around its center
Begin_G BITMAPS
CmdLoadIdentity
CmdTranslate 65536 * 32, 65536 * 32
CmdRotate 90 * 65536 / 360
CmdTranslate 65536 * -32, 65536 * -32
CmdSetMatrix
Vertex2II 68, 28, 0, 0
Clip0047.png
Languages   English  
Personal tools
Namespaces
Variants
Actions
Navigation
Language