Add missing Image methods

This commit is contained in:
Michal Moskal
2016-04-12 17:10:37 -07:00
parent abc9e90cb9
commit ef821e4b8b
2 changed files with 115 additions and 14 deletions

View File

@ -24,6 +24,12 @@ declare namespace images {
declare interface Image {
/**
* Plots the image at a given column to the screen
*/
//% help=images/plot-image xOffset.defl=0 shim=ImageMethods::plotImage
plotImage(xOffset?: number): void;
/**
* Shows an frame from the image at offset ``x offset``.
* @param xOffset TODO
@ -32,6 +38,13 @@ declare interface Image {
//% BUGblockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 xOffset.defl=0 shim=ImageMethods::showImage
showImage(xOffset?: number): void;
/**
* Draws the ``index``-th frame of the image on the screen.
* @param xOffset TODO
*/
//% help=images/plot-frame weight=80 shim=ImageMethods::plotFrame
plotFrame(xOffset: number): void;
/**
* Scrolls an image .
* @param frameOffset x offset moved on each animation step, eg: 5, 1, -1
@ -41,12 +54,6 @@ declare interface Image {
//% BUGblockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8 frameOffset.defl=0 interval.defl=200 shim=ImageMethods::scrollImage
scrollImage(frameOffset?: number, interval?: number): void;
/**
* Plots the image at a given column to the screen
*/
//% help=images/plot-image xOffset.defl=0 shim=ImageMethods::plotImage
plotImage(xOffset?: number): void;
/**
* Sets all pixels off.
*/
@ -64,6 +71,42 @@ declare interface Image {
*/
//% help= shim=ImageMethods::pixelBrightness
pixelBrightness(x: number, y: number): number;
/**
* Gets the width in columns
*/
//% help=functions/width shim=ImageMethods::width
width(): number;
/**
* Gets the height in rows (always 5)
*/
//% shim= shim=ImageMethods::height
height(): number;
/**
* Set a pixel state at position ``(x,y)``
* @param x TODO
* @param y TODO
* @param value TODO
*/
//% help=functions/set-pixel shim=ImageMethods::setPixel
setPixel(x: number, y: number, value: boolean): void;
/**
* Get the pixel state at position ``(x,y)``
* @param x TODO
* @param y TODO
*/
//% help=functions/pixel shim=ImageMethods::pixel
pixel(x: number, y: number): boolean;
/**
* Shows a particular frame of the image strip.
* @param frame TODO
*/
//% weight=70 help=functions/show-frame shim=ImageMethods::showFrame
showFrame(frame: number): void;
}