This component is deprecated.

Beginning July 1st, 2017, any new channels using this component will be rejected during certification.

Beginning January 1st, 2018, any updates to existing channels using this component will be rejected during certification.

Supported Interfaces

Events

Description

The roImageCanvas component provides an interface to render graphic elements at specific spots on the screen.

Although it is not intended to be a full-fledged graphics component for high-performance gaming, it does provide a simple interface for building custom animations out of arrays of images displayed on the screen.

An item (graphical element) may be one of three types: image, text, or colored rectangle.  The item type is determined by the Content Meta-Data fields set on the item.

Image

If the URL attribute is set, the item is displayed as an image.

Attributes (see Content Meta-Data):

URL
CompositionMode
SourceRect
TargetRect
TargetTranslation
TargetRotation

Text

If the Text attribute is set, the item is displayed as text.

Attributes (see Content Meta-Data):

Text
TextAttrs { Color, Font, HAlign, VAlign, Direction }
TargetRect

Rectangle

If the Color attribute is set, the item is displayed as a filled rectangle.

Attributes (see Content Meta-Data):

Color
TargetRect

 

Example: displays two images and some text on the screen
Sub showImageCanvas() 
	canvasItems = [
		{ 
			url:"http://192.168.1.23/boardwalk.jpg"
			TargetRect:{x:100,y:100,w:400,h:300}
		},
		{	
			url:"http://192.168.1.23/walking.jpg"
			TargetRect:{x:500,y:400,w:400,h:300}
		},
		{ 
			Text:"Hello ImageCanvas"
			TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
			HAlign:"HCenter", VAlign:"VCenter",
			Direction:"LeftToRight"}
			TargetRect:{x:390,y:357,w:500,h:60}
		}
	] 

   canvas = CreateObject("roImageCanvas")
   port = CreateObject("roMessagePort")
   canvas.SetMessagePort(port)
   'Set opaque background
   canvas.SetLayer(0, {Color:"#FF000000", CompositionMode:"Source"}) 
   canvas.SetRequireAllImagesToDraw(true)
   canvas.SetLayer(1, canvasItems)
   canvas.Show() 
   while(true)
       msg = wait(0,port) 
       if type(msg) = "roImageCanvasEvent" then
           if (msg.isRemoteKeyPressed()) then
               i = msg.GetIndex()
               print "Key Pressed - " ; msg.GetIndex()
               if (i = 2) then
                   ' Up - Close the screen.
                   canvas.close()
               end if
           else if (msg.isScreenClosed()) then
               print "Closed"
               return
           end if
       end if
   end while
End Sub