Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...
roImageWidget
17min
this object can be used in place of roimageplayer in cases where the image is displayed within a rectangle using an roimagewidget can result in more pleasing aesthetics for image player creation; it can also be used to display images in a multi screen array beyond this, roimagewidget behaves identically to roimageplayer the javascript equivalent is the \<img> https //developer mozilla org/en us/docs/web/html/element/img tag in html object creation the image widget area is generated using an rorectangle object rectangle = createobject("rorectangle", 0, 0, 1024, 768) i = createobject("roimagewidget", 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 descrption in the roimageplayer entry for details on displaying encrypted images 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 roimagewidget instance show() as boolean shows the image currently being displayed by the roimagewidget instance multiscreen images this object includes overloaded preloadfile() and displayfile() methods these methods receive an roassociativearray object that stores various options to be passed they must be used when displaying images across multiple screens in an array, or displaying a portion of an image—though they can also be used in place of the original method calls in all cases the following code uses the preloadfile() method for a multiscreen display i=createobject("roimagewidget") a=createobject("roassociativearray") a\["filename"] = "test jpg" a\["mode"] = 1 a\["transition"] = 14 a\["multiscreenwidth"] = 3 a\["multiscreenheight"] = 2 a\["multiscreenx"] = 0 a\["multiscreeny"] = 0 i preloadfile(a) i displaypreload the filename , mode , and transition values are the same as those documented for the displayfile() and preloadfile() methods above the multiscreenwidth and multiscreenheight parameters specify the width and height of the multi screen matrix for example, 3x2 would be three screens wide and two screens high the multiscreenx and multiscreeny specify the position of the current screen within that matrix in the above case, on average only 1/6 of the image is drawn on each screen, though the image mode still applies so that, depending on the shape of the image, it may have black bars on the side screens it is relatively simple, therefore, for an image widget to display part of an image based on its position in the multiscreen array the following are default values for the parameters mode = 0 transition = 0 multiscreenwidth = 1 multiscreenheight = 1 multiscreenx = 0 multiscreeny = 0 this code uses displayfile() to display a portion of an image i=createobject("roimagewidget") a=createobject("roassociativearray") a\["filename"] = "test jpg" a\["mode"] = 0 a\["multiscreenx"] = 600 a\["multiscreeny"] = 600 a\["multiscreenwidth"] = 400 a\["multiscreenheight"] = 400 i displayfile(a) this displays just a portion of the image test jpg starting at coordinates sourcex , sourcey , and sourcewidth by sourceheight in size the viewmode is still honored as if it were displaying the whole file