developer.garmin.com
Open in
urlscan Pro
2606:4700:4400::ac40:9624
Public Scan
Submitted URL: https://developer.garmin.com/connect-iq/api-docs/Toybox/Graphics/BufferedBitmap.html#initialize-instance_function
Effective URL: https://developer.garmin.com/connect-iq/api-docs/Toybox/Graphics/BufferedBitmap.html
Submission: On June 01 via manual from AZ — Scanned from DE
Effective URL: https://developer.garmin.com/connect-iq/api-docs/Toybox/Graphics/BufferedBitmap.html
Submission: On June 01 via manual from AZ — Scanned from DE
Form analysis
0 forms found in the DOMText Content
CLASS: TOYBOX.GRAPHICS.BUFFEREDBITMAP Inherits: Toybox.Lang.Object * Toybox.Lang.Object * Toybox.Graphics.BufferedBitmap show all OVERVIEW This class represents an off-screen bitmap. It provides methods to modify the bitmap palette, and get a drawable context. SEE ALSO: * Core Topics - Resources Example: Sets up an off-screen buffer using resources. using Toybox.Graphics; var screenShape; var offscreenBuffer; var dateBuffer; if (Toybox.Graphics has :BufferedBitmap) { // check to see if device has BufferedBitmap enabled offscreenBuffer = new Graphics.BufferedBitmap( {:width=>dc.getWidth(), :height=>dc.getHeight(), :palette=>[Graphic.COLOR_DK_GRAY, Graphics.COLOR_LT_GRAY, Graphics.COLOR_BLACK, Graphics.COLOR_WHITE]} ); // create an off-screen buffer with a palette of four colors stringBuffer = new Graphics.BufferedBitmap( // Buffer will have full color support as no palette is defined {:width=>dc.getWidth(), :height=>Graphics.getFontHeight(Graphics.FONT_MEDIUM)} ); } else { offscreenBuffer = null; // handle devices without BufferedBitmap stringBuffer = null; } Since: API Level 2.3.0 INSTANCE METHOD SUMMARY COLLAPSE * getDc() as Graphics.Dc Get the Dc to draw on the buffered bitmap. * getHeight() as Lang.Number Get the height of a bitmap. * getPalette() as Lang.Array<Graphics.ColorType> null if this surface uses the system palette. * getWidth() as Lang.Number Get the width of a bitmap. * initialize(options as { :width as Lang.Number, :height as Lang.Number, :palette as Lang.Array<Graphics.ColorType>, :colorDepth as Lang.Number, :bitmapResource as WatchUi.BitmapResource, :alphaBlending as Graphics.AlphaBlending }) Constructor. * isCached() as Lang.Boolean Check if the memory for the bitmap is still loaded in the memory User can invoke this method to check if the underlying resource is still available in the memory since last used if true, the resource such as BufferedBitmap has been cached and can be used directly without re-drawing. * setPalette(palette as Lang.Array<Graphics.ColorType>) as Void INSTANCE METHOD DETAILS GETDC() AS GRAPHICS.DC Get the Dc to draw on the buffered bitmap. Returns: * Graphics.Dc — The draw context Since: API Level 2.3.0 GETHEIGHT() AS LANG.NUMBER Get the height of a bitmap. Returns: * Lang.Number — Height of the bitmap in pixels Since: API Level 4.0.0 GETPALETTE() AS LANG.ARRAY<GRAPHICS.COLORTYPE> null if this surface uses the system palette Returns: * Lang.Array — The current palette for this bitmap. Since: API Level 2.3.0 GETWIDTH() AS LANG.NUMBER Get the width of a bitmap. Returns: * Lang.Number — Width of the bitmap in pixels Since: API Level 4.0.0 INITIALIZE(OPTIONS AS { :WIDTH AS LANG.NUMBER, :HEIGHT AS LANG.NUMBER, :PALETTE AS LANG.ARRAY<GRAPHICS.COLORTYPE>, :COLORDEPTH AS LANG.NUMBER, :BITMAPRESOURCE AS WATCHUI.BITMAPRESOURCE, :ALPHABLENDING AS GRAPHICS.ALPHABLENDING }) Constructor Parameters: * options — (Lang.Dictionary) — Dictionary of options. Must contain width and height, with optional palette, or a BitmapResource. This resource is not allowed to have an alpha channel. * :width — (Lang.Number) — The width of the surface in pixels * :height — (Lang.Number) — The height of the surface in pixels * :palette — (Lang.Array) — The colors used in this surface. Using less will reduce the bitmap size. The bitmap will use the system default if not provided. The maximum palette size allowed is 256 colors. If a palette is provided, the number of colors must also be <= to the number of system colors. * :colorDepth — (Lang.Number) — Color depth in terms of bits/pixel, when missing, default to system value. * :bitmapResource — (WatchUi.BitmapResource) — A BitmapResource to initialize * :alphaBlending — (Lang.Number) — A AlphaBlending enum to specify the level of alpha blending support for this buffered bitmap object Since: API Level 2.3.0 Throws: * (Graphics.InvalidPaletteException) — Thrown if the palette size exceeds the number of system colors. * (Graphics.InvalidPaletteException) — Thrown if the palette size exceeds 256 colors. * (Graphics.InvalidBitmapResourceException) — Thrown if the BitmapResource provided has an alpha channel. * (Lang.OutOfGraphicsMemory) — Thrown if there isn't enough free memory available to load the resource. ISCACHED() AS LANG.BOOLEAN Check if the memory for the bitmap is still loaded in the memory User can invoke this method to check if the underlying resource is still available in the memory since last used if true, the resource such as BufferedBitmap has been cached and can be used directly without re-drawing. Returns: * Lang.Boolean — true if the object's memory has not been recycled since last usage. Since: API Level 4.0.0 SETPALETTE(PALETTE AS LANG.ARRAY<GRAPHICS.COLORTYPE>) AS VOID Parameters: * palette — (Lang.Array) — A palette for this bitmap. The number of colors must match the current palette. Each color in the image will be replaced with the colors specified in the new palette. Since: API Level 2.3.0 Throws: * (Graphics.InvalidPaletteException) — Thrown if the palette size does not match the current palette. -------------------------------------------------------------------------------- Generated May 31, 2023 8:48:50 AM