#[repr(C)]pub struct playdate_graphics {Show 64 fields
pub video: *const playdate_video,
pub clear: Option<unsafe extern "C" fn(color: LCDColor)>,
pub setBackgroundColor: Option<unsafe extern "C" fn(color: LCDSolidColor)>,
pub setStencil: Option<unsafe extern "C" fn(stencil: *mut LCDBitmap)>,
pub setDrawMode: Option<unsafe extern "C" fn(mode: LCDBitmapDrawMode) -> LCDBitmapDrawMode>,
pub setDrawOffset: Option<unsafe extern "C" fn(dx: c_int, dy: c_int)>,
pub setClipRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int)>,
pub clearClipRect: Option<unsafe extern "C" fn()>,
pub setLineCapStyle: Option<unsafe extern "C" fn(endCapStyle: LCDLineCapStyle)>,
pub setFont: Option<unsafe extern "C" fn(font: *mut LCDFont)>,
pub setTextTracking: Option<unsafe extern "C" fn(tracking: c_int)>,
pub pushContext: Option<unsafe extern "C" fn(target: *mut LCDBitmap)>,
pub popContext: Option<unsafe extern "C" fn()>,
pub drawBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, flip: LCDBitmapFlip)>,
pub tileBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, width: c_int, height: c_int, flip: LCDBitmapFlip)>,
pub drawLine: Option<unsafe extern "C" fn(x1: c_int, y1: c_int, x2: c_int, y2: c_int, width: c_int, color: LCDColor)>,
pub fillTriangle: Option<unsafe extern "C" fn(x1: c_int, y1: c_int, x2: c_int, y2: c_int, x3: c_int, y3: c_int, color: LCDColor)>,
pub drawRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, color: LCDColor)>,
pub fillRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, color: LCDColor)>,
pub drawEllipse: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, lineWidth: c_int, startAngle: c_float, endAngle: c_float, color: LCDColor)>,
pub fillEllipse: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, startAngle: c_float, endAngle: c_float, color: LCDColor)>,
pub drawScaledBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, xscale: c_float, yscale: c_float)>,
pub drawText: Option<unsafe extern "C" fn(text: *const c_void, len: usize, encoding: PDStringEncoding, x: c_int, y: c_int) -> c_int>,
pub newBitmap: Option<unsafe extern "C" fn(width: c_int, height: c_int, bgcolor: LCDColor) -> *mut LCDBitmap>,
pub freeBitmap: Option<unsafe extern "C" fn(arg1: *mut LCDBitmap)>,
pub loadBitmap: Option<unsafe extern "C" fn(path: *const c_char, outerr: *mut *const c_char) -> *mut LCDBitmap>,
pub copyBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>,
pub loadIntoBitmap: Option<unsafe extern "C" fn(path: *const c_char, bitmap: *mut LCDBitmap, outerr: *mut *const c_char)>,
pub getBitmapData: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, width: *mut c_int, height: *mut c_int, rowbytes: *mut c_int, mask: *mut *mut u8, data: *mut *mut u8)>,
pub clearBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, bgcolor: LCDColor)>,
pub rotatedBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, rotation: c_float, xscale: c_float, yscale: c_float, allocedSize: *mut c_int) -> *mut LCDBitmap>,
pub newBitmapTable: Option<unsafe extern "C" fn(count: c_int, width: c_int, height: c_int) -> *mut LCDBitmapTable>,
pub freeBitmapTable: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable)>,
pub loadBitmapTable: Option<unsafe extern "C" fn(path: *const c_char, outerr: *mut *const c_char) -> *mut LCDBitmapTable>,
pub loadIntoBitmapTable: Option<unsafe extern "C" fn(path: *const c_char, table: *mut LCDBitmapTable, outerr: *mut *const c_char)>,
pub getTableBitmap: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable, idx: c_int) -> *mut LCDBitmap>,
pub loadFont: Option<unsafe extern "C" fn(path: *const c_char, outErr: *mut *const c_char) -> *mut LCDFont>,
pub getFontPage: Option<unsafe extern "C" fn(font: *mut LCDFont, c: u32) -> *mut LCDFontPage>,
pub getPageGlyph: Option<unsafe extern "C" fn(page: *mut LCDFontPage, c: u32, bitmap: *mut *mut LCDBitmap, advance: *mut c_int) -> *mut LCDFontGlyph>,
pub getGlyphKerning: Option<unsafe extern "C" fn(glyph: *mut LCDFontGlyph, glyphcode: u32, nextcode: u32) -> c_int>,
pub getTextWidth: Option<unsafe extern "C" fn(font: *mut LCDFont, text: *const c_void, len: usize, encoding: PDStringEncoding, tracking: c_int) -> c_int>,
pub getFrame: Option<unsafe extern "C" fn() -> *mut u8>,
pub getDisplayFrame: Option<unsafe extern "C" fn() -> *mut u8>,
pub getDebugBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
pub copyFrameBufferBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
pub markUpdatedRows: Option<unsafe extern "C" fn(start: c_int, end: c_int)>,
pub display: Option<unsafe extern "C" fn()>,
pub setColorToPattern: Option<unsafe extern "C" fn(color: *mut LCDColor, bitmap: *mut LCDBitmap, x: c_int, y: c_int)>,
pub checkMaskCollision: Option<unsafe extern "C" fn(bitmap1: *mut LCDBitmap, x1: c_int, y1: c_int, flip1: LCDBitmapFlip, bitmap2: *mut LCDBitmap, x2: c_int, y2: c_int, flip2: LCDBitmapFlip, rect: LCDRect) -> c_int>,
pub setScreenClipRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int)>,
pub fillPolygon: Option<unsafe extern "C" fn(nPoints: c_int, coords: *mut c_int, color: LCDColor, fillrule: LCDPolygonFillRule)>,
pub getFontHeight: Option<unsafe extern "C" fn(font: *mut LCDFont) -> u8>,
pub getDisplayBufferBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
pub drawRotatedBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, rotation: c_float, centerx: c_float, centery: c_float, xscale: c_float, yscale: c_float)>,
pub setTextLeading: Option<unsafe extern "C" fn(lineHeightAdustment: c_int)>,
pub setBitmapMask: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, mask: *mut LCDBitmap) -> c_int>,
pub getBitmapMask: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>,
pub setStencilImage: Option<unsafe extern "C" fn(stencil: *mut LCDBitmap, tile: c_int)>,
pub makeFontFromData: Option<unsafe extern "C" fn(data: *mut LCDFontData, wide: c_int) -> *mut LCDFont>,
pub getTextTracking: Option<unsafe extern "C" fn() -> c_int>,
pub setPixel: Option<unsafe extern "C" fn(x: c_int, y: c_int, c: LCDColor)>,
pub getBitmapPixel: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int) -> LCDSolidColor>,
pub getBitmapTableInfo: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable, count: *mut c_int, width: *mut c_int)>,
pub drawTextInRect: Option<unsafe extern "C" fn(text: *const c_void, len: usize, encoding: PDStringEncoding, x: c_int, y: c_int, width: c_int, height: c_int, wrap: PDTextWrappingMode, align: PDTextAlignment)>,
}Fields§
§video: *const playdate_video§clear: Option<unsafe extern "C" fn(color: LCDColor)>void playdate->graphics->clear(LCDColor color);
Clears the entire display, filling it with color.
Equivalent to playdate.graphics.clear() in the Lua API.
setBackgroundColor: Option<unsafe extern "C" fn(color: LCDSolidColor)>void playdate->graphics->setBackgroundColor(LCDColor color);
Sets the background color shown when the display is offset or for clearing dirty areas in the sprite system.
Equivalent to playdate.graphics.setBackgroundColor() in the Lua API.
setStencil: Option<unsafe extern "C" fn(stencil: *mut LCDBitmap)>void playdate->graphics->setStencil(LCDBitmap* stencil);
Sets the stencil used for drawing. For a tiled stencil, use setStencilImage() instead. To clear the stencil, set it to NULL.
setDrawMode: Option<unsafe extern "C" fn(mode: LCDBitmapDrawMode) -> LCDBitmapDrawMode>LCDBitmapDrawMode playdate->graphics->setDrawMode(LCDBitmapDrawMode mode);
Sets the mode used for drawing bitmaps. Note that text drawing uses bitmaps, so this affects how fonts are displayed as well. Returns the previous draw mode, in case you need to restore it after drawing.
LCDBitmapDrawMode
typedef enum
{
kDrawModeCopy,
kDrawModeWhiteTransparent,
kDrawModeBlackTransparent,
kDrawModeFillWhite,
kDrawModeFillBlack,
kDrawModeXOR,
kDrawModeNXOR,
kDrawModeInverted
} LCDBitmapDrawMode;Equivalent to playdate.graphics.setImageDrawMode() in the Lua API.
setDrawOffset: Option<unsafe extern "C" fn(dx: c_int, dy: c_int)>void playdate->graphics->setDrawOffset(int dx, int dy);
Offsets the origin point for all drawing calls to x, y (can be negative).
This is useful, for example, for centering a “camera” on a sprite that is moving around a world larger than the screen.
Equivalent to playdate.graphics.setDrawOffset() in the Lua API.
setClipRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int)>void playdate->graphics->setClipRect(int x, int y, int width, int height);
Sets the current clip rect, using world coordinates—that is, the given rectangle will be translated by the current drawing offset. The clip rect is cleared at the beginning of each update.
Equivalent to playdate.graphics.setClipRect() in the Lua API.
clearClipRect: Option<unsafe extern "C" fn()>void playdate->graphics->clearClipRect(void);
Clears the current clip rect.
Equivalent to playdate.graphics.clearClipRect() in the Lua API.
setLineCapStyle: Option<unsafe extern "C" fn(endCapStyle: LCDLineCapStyle)>void playdate->graphics->setLineCapStyle(LCDLineCapStyle endCapStyle);
Sets the end cap style used in the line drawing functions.
LCDLineCapStyle
typedef enum
{
kLineCapStyleButt,
kLineCapStyleSquare,
kLineCapStyleRound
} LCDLineCapStyle;Equivalent to playdate.graphics.setLineCapStyle() in the Lua API.
setFont: Option<unsafe extern "C" fn(font: *mut LCDFont)>void playdate->graphics->setFont(LCDFont* font);
Sets the font to use in subsequent drawText calls.
Equivalent to playdate.graphics.setFont() in the Lua API.
setTextTracking: Option<unsafe extern "C" fn(tracking: c_int)>void playdate->graphics->setTextTracking(int tracking);
Sets the tracking to use when drawing text.
Equivalent to playdate.graphics.font:setTracking() in the Lua API.
pushContext: Option<unsafe extern "C" fn(target: *mut LCDBitmap)>void playdate->graphics->pushContext(LCDBitmap* target);
Push a new drawing context for drawing into the given bitmap. If target is NULL, the drawing functions will use the display framebuffer.
Equivalent to playdate.graphics.pushContext() in the Lua API.
popContext: Option<unsafe extern "C" fn()>void playdate->graphics->popContext(void);
Pops a context off the stack (if any are left), restoring the drawing settings from before the context was pushed.
Equivalent to playdate.graphics.popContext() in the Lua API.
drawBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, flip: LCDBitmapFlip)>void playdate->graphics->drawBitmap(LCDBitmap* bitmap, int x, int y, LCDBitmapFlip flip);
Draws the bitmap with its upper-left corner at location x, y, using the given flip orientation.
tileBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, width: c_int, height: c_int, flip: LCDBitmapFlip)>void playdate->graphics->tileBitmap(LCDBitmap* bitmap, int x, int y, int width, int height, LCDBitmapFlip flip);
Draws the bitmap with its upper-left corner at location x, y tiled inside a width by height rectangle.
drawLine: Option<unsafe extern "C" fn(x1: c_int, y1: c_int, x2: c_int, y2: c_int, width: c_int, color: LCDColor)>void playdate->graphics->drawLine(int x1, int y1, int x2, int y2, int width, LCDColor color);
Draws a line from x1, y1 to x2, y2 with a stroke width of width.
Equivalent to playdate.graphics.drawLine() in the Lua API.
fillTriangle: Option<unsafe extern "C" fn(x1: c_int, y1: c_int, x2: c_int, y2: c_int, x3: c_int, y3: c_int, color: LCDColor)>void playdate->graphics->fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, LCDColor color);
Draws a filled triangle with points at x1, y1, x2, y2, and x3, y3.
LCDWindingRule
typedef enum
{
kPolygonFillNonZero,
kPolygonFillEvenOdd
} LCDPolygonFillRule;Equivalent to playdate.graphics.fillTriangle() in the Lua API.
drawRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, color: LCDColor)>void playdate->graphics->drawRect(int x, int y, int width, int height, LCDColor color);
Draws a width by height rect at x, y.
Equivalent to playdate.graphics.drawRect() in the Lua API.
fillRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, color: LCDColor)>void playdate->graphics->fillRect(int x, int y, int width, int height, LCDColor color);
Draws a filled width by height rect at x, y.
Equivalent to playdate.graphics.fillRect() in the Lua API.
drawEllipse: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, lineWidth: c_int, startAngle: c_float, endAngle: c_float, color: LCDColor)>void playdate->graphics->drawEllipse(int x, int y, int width, int height, int lineWidth, float startAngle, float endAngle, LCDColor color);
Draws an ellipse inside the rectangle {x, y, width, height} of width lineWidth (inset from the rectangle bounds). If startAngle != _endAngle, this draws an arc between the given angles. Angles are given in degrees, clockwise from due north.
fillEllipse: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int, startAngle: c_float, endAngle: c_float, color: LCDColor)>void playdate->graphics->fillEllipse(int x, int y, int width, int height, float startAngle, float endAngle, LCDColor color);
Fills an ellipse inside the rectangle {x, y, width, height}. If startAngle != _endAngle, this draws a wedge/Pacman between the given angles. Angles are given in degrees, clockwise from due north.
drawScaledBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, xscale: c_float, yscale: c_float)>void playdate->graphics->drawScaledBitmap(LCDBitmap* bitmap, int x, int y, float xscale, float yscale);
Draws the bitmap scaled to xscale and yscale with its upper-left corner at location x, y. Note that flip is not available when drawing scaled bitmaps but negative scale values will achieve the same effect.
drawText: Option<unsafe extern "C" fn(text: *const c_void, len: usize, encoding: PDStringEncoding, x: c_int, y: c_int) -> c_int>int playdate->graphics->drawText(const void* text, size_t len, PDStringEncoding encoding, int x, int y);
Draws the given text using the provided options. If no font has been set with setFont, the default system font Asheville Sans 14 Light is used. Note that len is the length of the decoded string—that is, the number of codepoints in the string, not the number of bytes; however, since the parser stops at the NUL terminator it’s safe to pass strlen(text) in here when you want to draw the entire string.
Equivalent to playdate.graphics.drawText() in the Lua API.
newBitmap: Option<unsafe extern "C" fn(width: c_int, height: c_int, bgcolor: LCDColor) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->newBitmap(int width, int height, LCDColor bgcolor);
Allocates and returns a new width by height LCDBitmap filled with bgcolor.
freeBitmap: Option<unsafe extern "C" fn(arg1: *mut LCDBitmap)>void playdate->graphics->freeBitmap(LCDBitmap*);
Frees the given bitmap.
loadBitmap: Option<unsafe extern "C" fn(path: *const c_char, outerr: *mut *const c_char) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->loadBitmap(const char* path, const char** outerr);
Allocates and returns a new LCDBitmap from the file at path. If there is no file at path, the function returns null.
copyBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->copyBitmap(LCDBitmap* bitmap);
Returns a new LCDBitmap that is an exact copy of bitmap.
loadIntoBitmap: Option<unsafe extern "C" fn(path: *const c_char, bitmap: *mut LCDBitmap, outerr: *mut *const c_char)>void playdate->graphics->loadIntoBitmap(const char* path, LCDBitmap* bitmap, const char** outerr);
Loads the image at path into the previously allocated bitmap.
getBitmapData: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, width: *mut c_int, height: *mut c_int, rowbytes: *mut c_int, mask: *mut *mut u8, data: *mut *mut u8)>void playdate->graphics->getBitmapData(LCDBitmap* bitmap, int* width, int* height, int* rowbytes, uint8_t** mask, uint8_t** data);
Gets various info about bitmap including its width and height and raw pixel data. The data is 1 bit per pixel packed format, in MSB order; in other words, the high bit of the first byte in data is the top left pixel of the image. If the bitmap has a mask, a pointer to its data is returned in mask, else NULL is returned.
clearBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, bgcolor: LCDColor)>void playdate->graphics->clearBitmap(LCDBitmap* bitmap, LCDColor bgcolor);
Clears bitmap, filling with the given bgcolor.
rotatedBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, rotation: c_float, xscale: c_float, yscale: c_float, allocedSize: *mut c_int) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->rotatedBitmap(LCDBitmap* bitmap, float rotation, float xscale, float yscale, int* allocedSize);
Returns a new, rotated and scaled LCDBitmap based on the given bitmap.
newBitmapTable: Option<unsafe extern "C" fn(count: c_int, width: c_int, height: c_int) -> *mut LCDBitmapTable>LCDBitmapTable* playdate->graphics->newBitmapTable(int count, int width, int height);
Allocates and returns a new LCDBitmapTable that can hold count width by height LCDBitmaps.
freeBitmapTable: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable)>void playdate->graphics->freeBitmapTable(LCDBitmapTable* table);
Frees the given bitmap table. Note that this will invalidate any bitmaps returned by getTableBitmap().
loadBitmapTable: Option<unsafe extern "C" fn(path: *const c_char, outerr: *mut *const c_char) -> *mut LCDBitmapTable>LCDBitmapTable* playdate->graphics->loadBitmapTable(const char* path, const char** outerr);
Allocates and returns a new LCDBitmap from the file at path. If there is no file at path, the function returns null.
loadIntoBitmapTable: Option<unsafe extern "C" fn(path: *const c_char, table: *mut LCDBitmapTable, outerr: *mut *const c_char)>void playdate->graphics->loadIntoBitmapTable(const char* path, LCDBitmapTable* table, const char** outerr);
Loads the imagetable at path into the previously allocated table.
getTableBitmap: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable, idx: c_int) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->getTableBitmap(LCDBitmapTable* table, int idx);
Returns the idx bitmap in table, If idx is out of bounds, the function returns NULL.
loadFont: Option<unsafe extern "C" fn(path: *const c_char, outErr: *mut *const c_char) -> *mut LCDFont>LCDFont* playdate->graphics->loadFont(const char* path, const char** outErr);
Returns the LCDFont object for the font file at path. In case of error, outErr points to a string describing the error. The returned font can be freed with playdate→system→realloc(font, 0) when it is no longer in use.
getFontPage: Option<unsafe extern "C" fn(font: *mut LCDFont, c: u32) -> *mut LCDFontPage>LCDFontPage* playdate->graphics->getFontPage(LCDFont* font, uint32_t c);
Returns an LCDFontPage object for the given character code. Each LCDFontPage contains information for 256 characters; specifically, if (c1 & ~0xff) == (c2 & ~0xff), then c1 and c2 belong to the same page and the same LCDFontPage can be used to fetch the character data for both instead of searching for the page twice.
getPageGlyph: Option<unsafe extern "C" fn(page: *mut LCDFontPage, c: u32, bitmap: *mut *mut LCDBitmap, advance: *mut c_int) -> *mut LCDFontGlyph>LCDFontGlyph* playdate->graphics->getPageGlyph(LCDFontPage* page, uint32_t c, LCDBitmap** bitmap, int* advance);
Returns an LCDFontGlyph object for character c in LCDFontPage page, and optionally returns the glyph’s bitmap and advance value.
getGlyphKerning: Option<unsafe extern "C" fn(glyph: *mut LCDFontGlyph, glyphcode: u32, nextcode: u32) -> c_int>int playdate->graphics->getGlyphKerning(LCDFontGlyph* glyph, uint32_t c1, uint32_t c2);
Returns the kerning adjustment between characters c1 and c2 as specified by the font.
getTextWidth: Option<unsafe extern "C" fn(font: *mut LCDFont, text: *const c_void, len: usize, encoding: PDStringEncoding, tracking: c_int) -> c_int>int playdate->graphics->getTextWidth(LCDFont* font, const void* text, size_t len, PDStringEncoding encoding, int tracking);
Returns the width of the given text in the given font. See the note above about the len argument.
PDStringEncoding
typedef enum
{
kASCIIEncoding,
kUTF8Encoding,
k16BitLEEncoding
} PDStringEncoding;getFrame: Option<unsafe extern "C" fn() -> *mut u8>uint8_t* playdate->graphics->getFrame(void);
Returns the current display frame buffer. Rows are 32-bit aligned, so the row stride is 52 bytes, with the extra 2 bytes per row ignored. Bytes are MSB-ordered; i.e., the pixel in column 0 is the 0x80 bit of the first byte of the row.
getDisplayFrame: Option<unsafe extern "C" fn() -> *mut u8>uint8_t* playdate->graphics->getDisplayFrame(void);
Returns the raw bits in the display buffer, the last completed frame.
getDebugBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>LCDBitmap* playdate->graphics->getDebugBitmap(void);
Only valid in the Simulator; function is NULL on device. Returns the debug framebuffer as a bitmap. White pixels drawn in the image are overlaid on the display in 50% transparent red.
copyFrameBufferBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>LCDBitmap* playdate->graphics->copyFrameBufferBitmap(void);
Returns a copy the contents of the working frame buffer as a bitmap. The caller is responsible for freeing the returned bitmap with playdate->graphics->freeBitmap().
markUpdatedRows: Option<unsafe extern "C" fn(start: c_int, end: c_int)>void playdate->graphics->markUpdatedRows(int start, int end);
After updating pixels in the buffer returned by getFrame(), you must tell the graphics system which rows were updated. This function marks a contiguous range of rows as updated (e.g., markUpdatedRows(0,LCD_ROWS-1) tells the system to update the entire display). Both “start” and “end” are included in the range.
display: Option<unsafe extern "C" fn()>void playdate->graphics->display(void);
Manually flushes the current frame buffer out to the display. This function is automatically called after each pass through the run loop, so there shouldn’t be any need to call it yourself.
setColorToPattern: Option<unsafe extern "C" fn(color: *mut LCDColor, bitmap: *mut LCDBitmap, x: c_int, y: c_int)>void playdate->graphics->setColorToPattern(LCDColor* color, LCDBitmap* bitmap, int x, int y);
Sets color to an 8 x 8 pattern using the given bitmap. x, y indicates the top left corner of the 8 x 8 pattern.
checkMaskCollision: Option<unsafe extern "C" fn(bitmap1: *mut LCDBitmap, x1: c_int, y1: c_int, flip1: LCDBitmapFlip, bitmap2: *mut LCDBitmap, x2: c_int, y2: c_int, flip2: LCDBitmapFlip, rect: LCDRect) -> c_int>int playdate->graphics->checkMaskCollision(LCDBitmap* bitmap1, int x1, int y1, LCDBitmapFlip flip1, LCDBitmap* bitmap2, int x2, int y2, LCDBitmapFlip flip2, LCDRect rect);
Returns 1 if any of the opaque pixels in bitmap1 when positioned at x1, y1 with flip1 overlap any of the opaque pixels in bitmap2 at x2, y2 with flip2 within the non-empty rect, or 0 if no pixels overlap or if one or both fall completely outside of rect.
setScreenClipRect: Option<unsafe extern "C" fn(x: c_int, y: c_int, width: c_int, height: c_int)>void playdate->graphics->setScreenClipRect(int x, int y, int width, int height);
Sets the current clip rect in screen coordinates.
Equivalent to playdate.graphics.setScreenClipRect() in the Lua API.
fillPolygon: Option<unsafe extern "C" fn(nPoints: c_int, coords: *mut c_int, color: LCDColor, fillrule: LCDPolygonFillRule)>void playdate->graphics->fillPolygon(int nPoints, int* points, LCDColor color, LCDPolygonFillRule fillrule);
Fills the polygon with vertices at the given coordinates (an array of 2*nPoints ints containing alternating x and y values) using the given color and fill, or winding, rule. See https://en.wikipedia.org/wiki/Nonzero-rule for an explanation of the winding rule. An edge between the last vertex and the first is assumed.
Equivalent to playdate.graphics.fillPolygon() in the Lua API.
getFontHeight: Option<unsafe extern "C" fn(font: *mut LCDFont) -> u8>uint8_t playdate->graphics->getFontHeight(LCDFont* font);
Returns the height of the given font.
getDisplayBufferBitmap: Option<unsafe extern "C" fn() -> *mut LCDBitmap>LCDBitmap* playdate->graphics->getDisplayBufferBitmap(void);
Returns a bitmap containing the contents of the display buffer. The system owns this bitmap—do not free it!
drawRotatedBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int, rotation: c_float, centerx: c_float, centery: c_float, xscale: c_float, yscale: c_float)>void playdate->graphics->drawRotatedBitmap(LCDBitmap* bitmap, int x, int y, float degrees, float centerx, float centery, float xscale, float yscale);
Draws the bitmap scaled to xscale and yscale then rotated by degrees with its center as given by proportions centerx and centery at x, y; that is: if centerx and centery are both 0.5 the center of the image is at (x,y), if centerx and centery are both 0 the top left corner of the image (before rotation) is at (x,y), etc.
setTextLeading: Option<unsafe extern "C" fn(lineHeightAdustment: c_int)>void playdate->graphics->setTextLeading(int leading);
Sets the leading adjustment (added to the leading specified in the font) to use when drawing text.
Equivalent to playdate.graphics.font:setLeading() in the Lua API.
setBitmapMask: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, mask: *mut LCDBitmap) -> c_int>int playdate->graphics->setBitmapMask(LCDBitmap* bitmap, LCDBitmap* mask);
Sets a mask image for the given bitmap. The set mask must be the same size as the target bitmap.
getBitmapMask: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>LCDBitmap* playdate->graphics->getBitmapMask(LCDBitmap* bitmap);
Gets a mask image for the given bitmap, or returns NULL if the bitmap doesn’t have a mask layer. The returned image points to bitmap’s data, so drawing into the mask image affects the source bitmap directly. The caller takes ownership of the returned LCDBitmap and is responsible for freeing it when it’s no longer in use.
setStencilImage: Option<unsafe extern "C" fn(stencil: *mut LCDBitmap, tile: c_int)>void playdate->graphics->setStencilImage(LCDBitmap* stencil, int tile);
Sets the stencil used for drawing. If the tile flag is set the stencil image will be tiled. Tiled stencils must have width equal to a multiple of 32 pixels. To clear the stencil, call playdate→graphics→setStencil(NULL);.
Equivalent to playdate.graphics.setStencilImage() in the Lua API.
makeFontFromData: Option<unsafe extern "C" fn(data: *mut LCDFontData, wide: c_int) -> *mut LCDFont>LCDFont* playdate->graphics->makeFontFromData(LCDFontData* data, int wide);
Returns an LCDFont object wrapping the LCDFontData data comprising the contents (minus 16-byte header) of an uncompressed pft file. wide corresponds to the flag in the header indicating whether the font contains glyphs at codepoints above U+1FFFF.
getTextTracking: Option<unsafe extern "C" fn() -> c_int>int playdate->graphics->getTextTracking(void);
Gets the tracking used when drawing text.
Equivalent to playdate.graphics.font:getTracking() in the Lua API.
setPixel: Option<unsafe extern "C" fn(x: c_int, y: c_int, c: LCDColor)>void playdate->graphics->setPixel(int x, int y, LCDColor color);
Sets the pixel at (x,y) in the current drawing context (by default the screen) to the given color. Be aware that setting a pixel at a time is not very efficient: In our testing, more than around 20,000 calls in a tight loop will drop the frame rate below 30 fps.
getBitmapPixel: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, x: c_int, y: c_int) -> LCDSolidColor>LCDSolidColor playdate->graphics->getBitmapPixel(LCDBitmap* bitmap, int x, int y);
Gets the color of the pixel at (x,y) in the given bitmap. If the coordinate is outside the bounds of the bitmap, or if the bitmap has a mask and the pixel is marked transparent, the function returns kColorClear; otherwise the return value is kColorWhite or kColorBlack.
getBitmapTableInfo: Option<unsafe extern "C" fn(table: *mut LCDBitmapTable, count: *mut c_int, width: *mut c_int)>void playdate->graphics->getBitmapTableInfo(LCDBitmapTable* table, int* count, int* cellswide);
Returns the bitmap table’s image count in the count pointer (if not NULL) and number of cells across in the cellswide pointer (ditto).
drawTextInRect: Option<unsafe extern "C" fn(text: *const c_void, len: usize, encoding: PDStringEncoding, x: c_int, y: c_int, width: c_int, height: c_int, wrap: PDTextWrappingMode, align: PDTextAlignment)>int playdate->graphics->drawTextInRect(const void* text, size_t len, PDStringEncoding encoding, int x, int y, int width, int height, PDTextWrappingMode wrap, PDTextAlignment align);
Draws the text in the given rectangle using the provided options. If no font has been set with setFont, the default system font Asheville Sans 14 Light is used. See the above note about the len argument.
The wrap argument is one of
PDTextWrappingMode
typedef enum
{
kWrapClip,
kWrapCharacter,
kWrapWord,
} PDTextWrappingMode;and align is one of
PDTextAlignment
typedef enum
{
kAlignTextLeft,
kAlignTextCenter,
kAlignTextRight
} PDTextAlignment;Trait Implementations§
Source§impl Clone for playdate_graphics
impl Clone for playdate_graphics
Source§fn clone(&self) -> playdate_graphics
fn clone(&self) -> playdate_graphics
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for playdate_graphics
impl Debug for playdate_graphics
Source§impl Default for playdate_graphics
impl Default for playdate_graphics
Source§impl Hash for playdate_graphics
impl Hash for playdate_graphics
Source§impl Ord for playdate_graphics
impl Ord for playdate_graphics
Source§impl PartialEq for playdate_graphics
impl PartialEq for playdate_graphics
Source§impl PartialOrd for playdate_graphics
impl PartialOrd for playdate_graphics
Source§fn partial_cmp(&self, other: &playdate_graphics) -> Option<Ordering>
fn partial_cmp(&self, other: &playdate_graphics) -> Option<Ordering>
impl Copy for playdate_graphics
impl Eq for playdate_graphics
impl StructuralPartialEq for playdate_graphics
Auto Trait Implementations§
impl Freeze for playdate_graphics
impl RefUnwindSafe for playdate_graphics
impl !Send for playdate_graphics
impl !Sync for playdate_graphics
impl Unpin for playdate_graphics
impl UnwindSafe for playdate_graphics
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 256 bytes