Difference between revisions of "PixelDisplay"
Jump to navigation
Jump to search
(Correct parameters for PixelDisplay.fillPoly.) |
|||
Line 2: | Line 2: | ||
By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it). But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to <c>displayMode.pixel</c>. | By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it). But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to <c>displayMode.pixel</c>. | ||
+ | |||
+ | A PixelDisplay is 960 x 640 pixels by default (see [[screen coordinates]]), though this may be changed via the [[PixelDisplay.clear|clear]] method. | ||
== Methods and Properties == | == Methods and Properties == |
Revision as of 01:06, 6 January 2022
The PixelDisplay
class in Mini Micro is a display type that represents a rectangular pixel buffer, with methods to efficiently draw lines, shapes, images, and text.
By default, display 5 is configured as a pixel display, and is in fact the pixel display to which the gfx global refers (unless you change it). But you can make any display layer a pixel display by setting its mode to displayMode.pixel
.
A PixelDisplay is 960 x 640 pixels by default (see screen coordinates), though this may be changed via the clear method.
Methods and Properties
Method or Property | Purpose |
---|---|
PixelDisplay.color | get or set the default drawing color, used when color is not otherwise specified |
PixelDisplay.width | number of columns in the the pixel buffer |
PixelDisplay.height | number of rows in the the pixel buffer |
PixelDisplay.scale | scaling factor used to magnify (or shrink) the pixel display on screen |
PixelDisplay.clear [color], [width], [height] | clear/reset the pixel buffer |
PixelDisplay.pixel x , y | get the color of a particular pixel |
PixelDisplay.setPixel x, y, [color] | set the color of a particular pixel |
PixelDisplay.scrollX | get or set a horizontal shift applied to the entire display |
PixelDisplay.scrollY | get or set a vertical shift applied to the entire display |
PixelDisplay.line x1, y1, x2, y2, [color], [penSize] | draw a line |
PixelDisplay.drawRect left, bottom, width, height, [color], [penSize] | draw a rectangle outline |
PixelDisplay.fillRect left, bottom, width, height, [color] | draw a filled rectangle |
PixelDisplay.drawEllipse left, bottom, width, height, [color], [penSize] | draw an ellipse outline |
PixelDisplay.fillEllipse left, bottom, width, height, [color] | draw a filled ellipse |
PixelDisplay.drawPoly points, [color], [penSize] | draw a polygon outline |
PixelDisplay.fillPoly points, [color] | draw a filled polygon |
PixelDisplay.drawImage img, left, bottom, [width], [height], [srcLeft], [srcBottom], [srcWidth], [srcHeight] | draw an Image (or portion thereof) |
PixelDisplay.getImage(left, bottom, width, height) | get a portion of the pixel buffer as an Image |
PixelDisplay.print str, x, y, [color], [font] | draw a string |