Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...

roImagePlayer

22min
this object displays static bitmap images on the video display the simplest way to use roimageplayer is to make calls to displayfile() with the filename as a string alternatively, you can use preloadfile() in conjunction with displaypreload() to have more control for more pleasing aesthetics when generating an image player, use the roimagewidget object the javascript equivalent is the \<img> tag in html https //developer mozilla org/en us/docs/web/html/element/img object creation the image player is displayed by first creating rorectangle and roimageplayer instances, then calling setrectangle() using the rorectangle instance as the argument rectangle = createobject("rorectangle", 0, 0, 1024, 768) i = createobject("roimageplayer") i setrectangle(rectangle) ifimagecontrol displayfile(image filename as string) as boolean displays the image with the specified filename the image filename string must point to a png , jpeg , or 8 bit, 24 bit, or 32 bit bmp file note that jpeg image files with cmyk color profiles are not supported displayfile(parameters as roassociativearray) as boolean displays an image using an associative array of display parameters filename the name of the image file mode the image mode see the entry for setdefaultmode() below for more details transition the image transition setting see the entry for setdefaulttransition() below for more details encryptionalgorithm the file encryption algorithm currently the options are "aesctr" and "aesctrhmac" encryptionkey the key to decrypt the image file this is a byte array consisting of 128 bits of key, followed by 128 bits of iv see the roimageplayer docid 0umxqyvruy7drnluuzafp section below for details on displaying encrypted images the image player no longer accepts "{a|a}" aes encryption keys (i e where the top and bottom 64 bits of the key are identical) preloadfile(image filename as string) as boolean loads the specified image file into an offscreen memory buffer preloadfile(parameters as roassociativearray) as boolean loads an image file into an offscreen memory buffer image display properties are determined by an associative array of parameters filename the name of the image file mode see the entry for setdefaultmode() below for more details transition see the entry for setdefaulttransition() below for more details displaypreload() as boolean uses the on screen memory buffer to display the image stored in the offscreen memory buffer using preloadfile() there are only two memory buffers one is displayed on screen; and the other is used for preloading images preloadfile() can be called multiple times before displaypreload() is called, and will keep loading into the same off screen buffer the displayfile() method calls preloadfile() followed immediately by displaypreload() , so any previously preloaded image will be lost if no image is preloaded, displaypreload() will have no effect stopdisplay() as boolean removes an image from the display displayfileex(filename as string, mode as integer, x as integer, y as integer) as boolean preloadfileex(filename as string, mode as integer, x as integer, y as integer) as boolean setdefaultmode(mode as integer) as boolean sets the default image display mode for displayfile() and preloadfile() if setdefaultmode() is not called, then the default mode is set to 0 (equivalent to the image being centered without scaling) the supported display mode are listed below 0 – center image no scaling takes place cropping only occurs if the image is bigger than the window 1 – scale to fit the image is scaled so that it is fully viewable, with its aspect ratio maintained 2 – scale to fill and crop the image is scaled so that it completely fills the window, with its aspect ratio maintained 3 – scale to fill the image is stretched so that it fills the window and the whole image is viewable the aspect ratio will not be maintained if it is different from the window setdefaulttransition(transition as integer) as boolean sets the transition to be used when the next image is displayed the following are available transitions 0 no transition immediate blit 1 4 wipes from top, bottom, left, or right 5 8 explodes from centre, top left, top right, bottom left, or bottom right 10 11 uses vertical or horizontal venetian blind effect 12 13 combs vertical or horizontal 14 fades out to background color, then back in 15 fades between current image and new image 16 19 slides from top, bottom, left or right 20 23 slides entire screen from top, bottom, left, or right 24 25 scales old image in, then the new one out again (this works as a pseudo rotation around a vertical or horizontal axis) 26 29 expands a new image onto the screen from right, left, bottom, or top settransform(transform as string) as boolean applies one of eight transforms to the image calls to this method only take effect when the next file is displayed note that the image rectangle itself does not change to accommodate the new height and width ratio of a transformed image this method can be called separately on multiple roimageplayer or roimagewidget instances identity no transformation (default behavior) rot90 90 degree clockwise rotation rot180 180 degree rotation rot270 270 degree clockwise rotation mirror horizontal mirror transformation mirror rot90 mirrored 90 degree clockwise rotation mirror rot180 mirrored 180 degree clockwise rotation mirror rot270 mirrored 270 degree clockwise rotation overlayimage(image filename as string, x as integer, y as integer) as boolean composites the image with the specified filename on top of the primary displayfile() image use the x and y integers to specify its location within the image widget setrectangle(r as rorectangle) as boolean changes the size and positioning of the image rectangle using the passed rorectangle object getrectangle() as rorectangle returns an rorectangle object that has the same location and dimensions as the rorectangle object used to define the image window createtesthole(hole as rorectangle) as boolean creates a hole in the image with the location and dimensions specified in the passed rorectangle instance any video windows located directly beneath the image will show through this method will disrupt image playback and should be used for test purposes only settransitionduration(duration as integer) as boolean sets the amount of time it takes (in milliseconds) for a specified transition effect to take place the default transition duration is 1000 milliseconds displaybuffer(a as object, b as integer, c as integer) as boolean hide() as boolean hides the image currently being displayed by the roimageplayer widget show() as boolean shows the image currently being displayed by the roimageplayer widget raise() as void sends the widget to the top of the z order on the graphics plane (i e in front of all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order some surfaces are always drawn at the top of the graphics z order, including the mouse cursor, closed captions, and rotextwidget docid\ gqenktmmfazejdlzhttiz you can use the pausegraphics() / resumegraphics() methods on the rovideomode object to ensure multiple changes to the graphics z order occur simultaneously lower() as void sends the widget to the bottom of the z order on the graphics plane (i e behind all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order x, y the x and y values indicate which position of the image to center as near as possible, or both x and y can be set to 1, which uses the center of the image as the point to position nearest to the center to display images in a zone, setrectangle() must be called, and enablezonesupport() must be included in a script to use the zones functionality testing display modes here are some example shell commands you can use to test the different display modes brightsign> image filename bmp 0 brightsign> image filename bmp 1 brightsign> image filename bmp 2 brightsign> image filename bmp 3 brightsign> image filename bmp 0 0 0 brightsign> image filename bmp 2 0 0 preloading images the following example script uses preloaded images to improve the ui speed when the user hits a key on the keyboard as soon as a key is struck, the display switches to the new image, which has already been preloaded the only possible delay occurs if the key is hit while the image is preloading in this case, the image will display as soon as it is loaded i = createobject("roimageplayer") p = createobject("romessageport") k = createobject("rokeyboard") k setport(p) i preloadfile("one bmp") loop i displaypreload i preloadfile("two bmp") wait(0,p) i displaypreload i preloadfile("one bmp") wait(0,p) goto loop image decryption the roimageplayer , roimagewidget , roclockwidget , rotextwidget , and rocanvaswidget objects can be used to display encrypted images each object has an image playback method that accepts an associative array, which can include the encryptionalgorithm and encryptionkey decryption parameters contact support\@brightsign biz mailto\ support\@brightsign biz to learn more about generating a key for obfuscation and storing it on the player you can call rodeviceinfo hasfeature("media decryption") to determine if a player model and firmware version supports image decryption example print "play encrypted image in an image widget" imageplayer = createobject("roimagewidget", r1) aa=createobject("roassociativearray") aa filename = "sd /images enc jpg" aa encryptionalgorithm = "aesctr" aa encryptionkey = createobject("robytearray") aa encryptionkey fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000") imageplayer displayfile(aa) sleep(10000) imageplayer hide() print "play encrypted image with playstaticimage" videoplayer = createobject("rovideoplayer") aa=createobject("roassociativearray") aa filename = "sd /images enc jpg" aa encryptionalgorithm = "aesctr" aa encryptionkey = createobject("robytearray") aa encryptionkey fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000") videoplayer playstaticimage(aa) sleep(10000) videoplayer = invalid print "show clock image" resourcemanager = createobject("roresourcemanager", "sd /resources txt") clockwidget = createobject("roclockwidget", r1, resourcemanager, {}) aa=createobject("roassociativearray") aa filename = "sd /images enc jpg" aa encryptionalgorithm = "aesctr" aa encryptionkey = createobject("robytearray") aa encryptionkey fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000") clockwidget setbackgroundbitmap(aa, true) clockwidget show() sleep(10000) clockwidget hide() print "text widget with encrypted background image" twparams = createobject("roassociativearray") twparams linecount = 1 twparams textmode = 1 twparams rotation = 0 twparams alignment = 1 tw=createobject("rotextwidget",r1,1,2,twparams) tw\ setbackgroundcolor(\&h00ff0000) tw\ setforegroundcolor(\&hff00ff00) tw\ pushstring("encrypted background") 'tw\ setrectangle(r) aa=createobject("roassociativearray") aa filename = "sd /images enc jpg" aa encryptionalgorithm = "aesctr" aa encryptionkey = createobject("robytearray") aa encryptionkey fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000") tw\ setbackgroundbitmap(aa, true) tw\ show() sleep(10000) tw\ hide() cw=createobject("rocanvaswidget", rect) canvas aa=createobject("roassociativearray") canvas aa filename = "sd /images enc jpg" canvas aa encryptionalgorithm = "aesctr" canvas aa encryptionkey = createobject("robytearray") canvas aa encryptionkey fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000") cw\ setlayer(canvas aa, 1) cw\ show()