Page 89 - KEC Khaitan C5 Flipbook
P. 89

o  Canvas.Height: Gets or sets the height of the Canvas.
                   o  Canvas.Visible: Gets or sets whether the Canvas is visible or not.

                    Drawing blocks: These blocks are used to draw shapes, text, and images on the Canvas.
                   o  Call  Canvas.DrawCircle  (centerX,  centerY,  radius,  fill): Draws  a circle at the
                      specified coordinates with a given radius.

                   o  Call Canvas.DrawLine (x1, y1, x2, y2): Draws a line between two points (x1, y1) and
                      (x2, y2).

                   o  Call Canvas.DrawPoint (x, y): Draws a single point at the specified coordinates.
                   o  Call Canvas.DrawShape (pointList, fill): Draws a shape using a list of coordinates.
                   o  Call Canvas.DrawText (text, x, y): Draws text at the specified coordinates.

                   o  Call  Canvas.DrawTextAtAngle  (text, x, y,  angle): Draws  text  at  the specified
                      coordinates and angle.

                    Touch  and  Gesture  Blocks: These blocks handle touch  and gesture  events on the
                   Canvas.
                   o  When Canvas.Touched (x, y, touchedAnySprite): Triggered when the user touches
                      the Canvas. Provides the coordinates (x, y) of the touch.

                   o  When Canvas.Dragged  (startX,  startY, currentX,  currentY,  prevX,  prevY,
                      draggedAnySprite): Triggered  when the  user drags  their  finger on the  Canvas.
                      Provides the coordinates (x, y) of the drag.

                   o  When Canvas.TouchUp (x, y): Triggered when the user lifts their finger from the
                      Canvas. Provides the coordinates (x, y) of the release.
                   o  When  Canvas.TouchDown  (x,  y): Triggered  when  the  user initially  touches  the
                      Canvas. Provides the coordinates (x, y) of the touch.

                   o  When Canvas.Flung (x, y, speed, heading, xvel, yvel, flungSprite): Triggered when
                      the user flings (swipes quickly) on the Canvas. Provides the coordinates (x, y), speed,
                      and heading of the fling.

                    Image Manipulation Blocks: These blocks allow you  to  manipulate  images on the
                   Canvas.
                   o  Call Canvas.Save: Saves the current contents of the Canvas as an image file.

                   o  Call Canvas.SaveAs (fileName): Saves the current contents of the Canvas as an
                      image file with a specified name.
                   o  Call  Canvas.GetBackgroundPixelColor (x, y): Gets  the  color of the  pixel  at  the

                      specified coordinates.
                   o  Call  Canvas.GetPixelColor  (x,  y): Gets the color of the pixel at the specified
                      coordinates.

                   o  Call Canvas.SetBackgroundPixelColor (x, y, color): Sets the color of the pixel at the
                      specified coordinates.



                                                                                         UI Design and Touch Events  87
   84   85   86   87   88   89   90   91   92   93   94