Implement Images

This commit is contained in:
Michal Moskal
2016-04-01 19:55:51 -07:00
parent 6176963504
commit 4b92de7516
8 changed files with 163 additions and 76 deletions

View File

@ -1,6 +1,70 @@
// Auto-generated. Do not edit.
//% color=45 weight=31
declare namespace images {
/**
* Creates an image that fits on the LED screen.
*/
//% weight=75 help=images/create-image
//% blockId=device_build_image block="create image" imageLiteral=1 shim=images::createImage
function createImage(leds: string): Image;
/**
* Creates an image with 2 frames.
*/
//% weight=74 help=images/create-big-image
//% blockId=device_build_big_image block="create big image" imageLiteral=2 shim=images::createBigImage
function createBigImage(leds: string): Image;
}
declare interface Image {
/**
* Shows an frame from the image at offset ``x offset``.
* @param xOffset TODO
*/
//% help=images/show-image weight=80 async
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 xOffset.defl=0 shim=ImageMethods::showImage
showImage(xOffset?: number): void;
/**
* Scrolls an image .
* @param frameOffset x offset moved on each animation step, eg: 5, 1, -1
* @param interval time between each animation step in milli seconds, eg: 200
*/
//% help=images/show-image weight=79 async
//% blockId=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.
*/
//% help=images/clear shim=ImageMethods::clear
clear(): void;
/**
* Sets a specific pixel brightness at a given position
*/
//% help= shim=ImageMethods::setPixelBrightness
setPixelBrightness(x: number, y: number, value: number): void;
/**
* Gets the pixel brightness ([0..255]) at a given position
*/
//% help= shim=ImageMethods::pixelBrightness
pixelBrightness(x: number, y: number): number;
}
/**
* Provides access to basic micro:bit functionality.
*/
@ -14,8 +78,7 @@ declare namespace basic {
//% help=basic/show-number
//% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec"
//% async
//% interval.defl=150 shim=basic::showNumber
//% async interval.defl=150 shim=basic::showNumber
function showNumber(value: number, interval?: number): void;
/**
@ -27,8 +90,7 @@ declare namespace basic {
//% weight=95 blockGap=8
//% imageLiteral=1 async
//% blockId=device_show_leds
//% block="show leds" icon="\uf00a"
//% interval.defl=400 imageLiteral=1 shim=basic::showLeds
//% block="show leds" icon="\uf00a" interval.defl=400 shim=basic::showLeds
function showLeds(leds: string, interval?: number): void;
/**
@ -40,8 +102,7 @@ declare namespace basic {
//% weight=87 blockGap=8
//% block="show|string %text" icon="\uf031"
//% async
//% blockId=device_print_message
//% interval.defl=150 shim=basic::showString
//% blockId=device_print_message interval.defl=150 shim=basic::showString
function showString(text: string, interval?: number): void;
/**
@ -56,8 +117,7 @@ declare namespace basic {
* @param leds TODO
* @param interval TODO
*/
//% help=basic/show-animation shim=micro_bit::showAnimation imageLiteral=1 async
//% interval.defl=400 imageLiteral=1 shim=basic::showAnimation
//% help=basic/show-animation shim=micro_bit::showAnimation imageLiteral=1 async interval.defl=400 shim=basic::showAnimation
function showAnimation(leds: string, interval?: number): void;
/**
@ -111,7 +171,7 @@ declare namespace control {
* @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_QUEUE).
*/
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source|with value %value=control_event_value" blockExternalInputs=1
//% mode.defl=CREATE_AND_QUEUE shim=control::raiseEvent
//% mode.defl=1 shim=control::raiseEvent
function raiseEvent(src: number, value: number, mode: EventCreationMode ): void;
/**