|
muteki
|
Display canvas (LCD) API. More...
#include <muteki/ui/common.h>Go to the source code of this file.
Functions | |
| short | GetFontType (void) |
| Get the current font type. | |
| void | SetFontType (short font_type) |
Set the current font type to font_type. | |
| void | WriteAlignString (short x, short y, const void *s, short max_length, int align, unsigned int flags) |
Draw a string s with specified alignment at (x, y) px. | |
| void | WriteChar (short x, short y, UTF16 c, unsigned int flags) |
Draw a UTF-16 character c aligned to the top left corner at (x, y) px. | |
| void | WriteString (short x, short y, const void *s, unsigned int flags) |
Draw a string s aligned to the top left corner at (x, y) px. | |
| void | Printf (const char *format,...) SYS_IS_PRINTF(1 |
| Format and draw a string. | |
| void void | PrintfXY (short x, short y, const char *format,...) SYS_IS_PRINTF(3 |
Format and draw a string aligned to the top left corner at (x, y) px. | |
| void void int | ShowGraphic (short x, short y, lcd_surface_t *surface, unsigned short flags) |
| Draw a surface onto current active LCD. | |
| unsigned int | SetCursorSize (unsigned int new_size) |
| Set the size of the cursor on the current canvas. | |
| unsigned int | GetCursorSize (void) |
| Get the size of the cursor on the current canvas. | |
| void | SetCursorPosition (short x, short y) |
| Move the cursor position on the current canvas to the specified coordinate. | |
| void | GetCursorPosition (short *x, short *y) |
| Get the cursor position on the current canvas. | |
| short | SetCursorType (short new_type) |
| Set the type of the cursor on the current canvas. | |
| short | GetCursorType (void) |
| Get the type of the cursor on the current canvas. | |
| void | CursorLock (void) |
| Lock the cursor on the current canvas. | |
| void | CursorUnlock (void) |
| Unlock the cursor on the current canvas. | |
| int | SetTransparentColor (int color) |
| Set display canvas transparent color. | |
| int | rgbSetBkColor (int color) |
| Set display canvas background fill color. | |
| int | rgbSetColor (int color) |
| Set display canvas foreground fill color. | |
| short | SetPenStyle (short dash, unsigned int *dash_pattern) |
| Set the stroke dash pattern. | |
| short | GetPenStyle (unsigned int *dash_pattern) |
| Get the stroke dash pattern. | |
| short | GetPenSize (void) |
| Get the stroke width. | |
| short | SetPenSize (short size) |
| Set the stroke width. | |
| int | GetPixel (short x, short y) |
| Get the RGB value of a pixel on the current active surface. | |
| int | SetPixel (short x, short y, int color) |
| Set the pixel color on the current active surface with the given pixel. | |
| size_t | GetImage (short x0, short y0, short x1, short y1, lcd_surface_t *surface) |
| Copy a rectangle of pixels from current active LCD and save it to the specified buffer. | |
| void | PutImage (short x, short y, lcd_surface_t *surface, unsigned short flags) |
| Copy pixels from a surface to current active LCD. | |
| void | SetDrawArea (short x0, short y0, short x1, short y1) |
| Set the drawing area of the current active LCD. | |
| void | GetDrawArea (short *x0, short *y0, short *x1, short *y1) |
| Get the drawing area of the current active LCD. | |
| void | DrawLine (short x0, short y0, short x1, short y1, unsigned int flags) |
| Stroke a line on the current active LCD. | |
| void | DrawRect (short x0, short y0, short x1, short y1, unsigned int flags) |
| Stroke a rectangle on the current active LCD. | |
| void | FillRect (short x0, short y0, short x1, short y1, unsigned int flags) |
| Fill a rectangle on the current active LCD. | |
| void | DrawRoundRect (short x0, short y0, short x1, short y1, short rx, short ry, unsigned int flags) |
| Stroke a rounded corner rectangle on the current active LCD. | |
| void | DrawCircle (short x, short y, short r, unsigned int flags) |
| Stroke a circle on the current active LCD. | |
| void | FillCircle (short x, short y, short r, unsigned int flags) |
| Fill a circle on the current active LCD. | |
| void | DrawEllipse (short x, short y, short rx, short ry, unsigned int flags) |
| Stroke an ellipse on the current active LCD. | |
| void | FillEllipse (short x, short y, short rx, short ry, unsigned int flags) |
| Fill an ellipse on the current active LCD. | |
| void | InverseSetArea (short x0, short y0, short x1, short y1) |
| Invert color within a rectangle. | |
| void | ClearScreen (bool fill_with_fg) |
| Fill the current display canvas with background color, effectively clearing it. | |
| void | ScrollDown (short x0, short y0, short x1, short y1, short amount) |
Move a rectangle down by amount pixels. | |
| void | ScrollLeft (short x0, short y0, short x1, short y1, short amount) |
Move a rectangle left by amount pixels. | |
| void | ScrollRight (short x0, short y0, short x1, short y1, short amount) |
Move a rectangle right by amount pixels. | |
| void | ScrollUp (short x0, short y0, short x1, short y1, short amount) |
Move a rectangle up by amount pixels. | |
| lcd_t * | CreateVirtualLCD (short width, short height, short width_bytes) |
| Create a virtual LCD descriptor. | |
| void | DeleteVirtualLCD (lcd_t *lcd) |
| Dispose a previously created virtual LCD descriptor. | |
| lcd_t * | SetActiveLCD (lcd_t *new_lcd) |
| Set an LCD descriptor as active. | |
| lcd_t * | GetActiveLCD (void) |
| Get the current active LCD descriptor. | |
| lcd_t * | CreateCompatibleLCD (lcd_t *source) |
| Copy an LCD descriptor (excluding surface). | |
| lcd_surface_t * | SetDCObject (lcd_t *lcd, lcd_surface_t *new_surface) |
| Link a surface (device context) to an LCD descriptor. | |
| short | GetMaxScrX (void) |
| Get X coordinate of the rightmost visible pixels on the current canvas. | |
| short | GetMaxScrY (void) |
| Get Y coordinate of the bottom-most visible pixels on the current canvas. | |
Display canvas (LCD) API.
Note that the term "display canvas", "canvas" and "LCD" may be used interchangeably below. This may get rectified in a future release.
|
extern |
Fill the current display canvas with background color, effectively clearing it.
0x1007e | fill_with_fg | Fill with foreground color instead of background color. |
Copy an LCD descriptor (excluding surface).
This function allocates a new LCD descriptor and copies everything from the source descriptor to the new one. The new descriptor will not be linked to the source descriptor's lcd_t::surface, and lcd_t::saved_cursor will be updated to the latest cursor states assigned to the current active LCD descriptor. If the target platform supports LCD descriptor locking, a new critical section object will be created for the new descriptor.
0x1008e | source | The source LCD descriptor. |
|
extern |
Create a virtual LCD descriptor.
Virtual LCDs allow the program to draw using the LCD/canvas API without committing the pixels to the screen immediately.
0x10087 | width | Width of the virtual LCD. |
| height | Height of the virtual LCD. |
| width_bytes | If set to a value larger than the value calculated from width, the pixel buffer will be allocated according to this value instead (i.e. width_bytes * height). |
|
extern |
Lock the cursor on the current canvas.
0x10063
|
extern |
Unlock the cursor on the current canvas.
0x10064
|
extern |
Dispose a previously created virtual LCD descriptor.
0x10088 | lcd | Pointer to a virtual LCD descriptor. |
|
extern |
Stroke a circle on the current active LCD.
0x10079 | x | X coordinate of the center. |
| y | Y coordinate of the center. |
| r | Radius of the circle. |
| flags | Blit processing flags. |
|
extern |
Stroke an ellipse on the current active LCD.
0x1007b | x | X coordinate of the center. |
| y | Y coordinate of the center. |
| rx | Horizontal radius of the ellipse. |
| ry | Vertical radius of the ellipse. |
| flags | Blit processing flags. |
|
extern |
Stroke a line on the current active LCD.
0x10075 | x0 | X coordinate of the first point. |
| y0 | Y coordinate of the first point. |
| x1 | X coordinate of the second point. |
| y1 | Y coordinate of the second point. |
| flags | Blit processing flags. |
|
extern |
Stroke a rectangle on the current active LCD.
0x10076 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| flags | Blit processing flags. |
|
extern |
Stroke a rounded corner rectangle on the current active LCD.
0x10078 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| rx | Horizontal radius in pixels. |
| ry | Vertical radius in pixels. |
| flags | Blit processing flags. |
|
extern |
Fill a circle on the current active LCD.
0x1007a | x | X coordinate of the center. |
| y | Y coordinate of the center. |
| r | Radius of the circle. |
| flags | Blit processing flags. |
|
extern |
Fill an ellipse on the current active LCD.
0x1007c | x | X coordinate of the center. |
| y | Y coordinate of the center. |
| rx | Horizontal radius of the ellipse. |
| ry | Vertical radius of the ellipse. |
| flags | Blit processing flags. |
|
extern |
Fill a rectangle on the current active LCD.
0x10077 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| flags | Blit processing flags. |
|
extern |
Get the current active LCD descriptor.
0x1008d
|
extern |
Get the cursor position on the current canvas.
0x10060 | [out] | x | The x coordinate of the cursor. |
| [out] | y | The y coordinate of the cursor. |
|
extern |
Get the size of the cursor on the current canvas.
0x1005e
|
extern |
Get the type of the cursor on the current canvas.
0x10062
|
extern |
Get the drawing area of the current active LCD.
0x10074 | [out] | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| [out] | y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| [out] | x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| [out] | y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
|
extern |
Get the current font type.
0x1004ffont_type.
|
extern |
Copy a rectangle of pixels from current active LCD and save it to the specified buffer.
This is similar to using _BitBlt() on the active LCD surface but with a seemingly different implementation and a different function signature. Surface initialization is done implicitly by this function although calling GetImageSize() in user code is still required in order to allocate a buffer of appropriate size.
0x10071 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| surface | Target buffer that will hold the surface. |
|
extern |
Get X coordinate of the rightmost visible pixels on the current canvas.
This is usually tied to the physical resolution of the display. Therefore it can be used to determine the display size. The display size can be calculated by adding 1 to the return values of both GetMaxScr* calls.
0x10190
|
extern |
Get Y coordinate of the bottom-most visible pixels on the current canvas.
This is usually tied to the physical resolution of the display. Therefore it can be used to determine the display size. The display size can be calculated by adding 1 to the return values of both GetMaxScr* calls.
0x10191| short GetPenSize | ( | void | ) |
Get the stroke width.
0x1006d| short GetPenStyle | ( | unsigned int * | dash_pattern | ) |
Get the stroke dash pattern.
0x1006c | [out] | dash_pattern | If not NULL, the current dash bit pattern. |
| int GetPixel | ( | short | x, |
| short | y | ||
| ) |
Get the RGB value of a pixel on the current active surface.
0x1006f | x | X coordinate. |
| y | Y coordinate. |
|
extern |
Invert color within a rectangle.
0x1007d | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
|
extern |
Format and draw a string.
Handles line wraps and screen scrolling automatically.
0x10057 | format | The format string. |
| ... | Any subsequent values. |
|
extern |
Format and draw a string aligned to the top left corner at (x, y) px.
0x10058 | x | X coordinate of the corner. |
| y | Y coordinate of the corner. |
| format | The format string passed to the built-in sprintf(). |
| ... | Any subsequent values passed to the built-in sprintf(). |
|
extern |
Copy pixels from a surface to current active LCD.
This is very similar to ShowGraphic() except that it does not check whether or not surface is NULL and there is no indication of whether or not the process was completed successfully.
0x10072 | x | X coordinate. |
| y | Y coordinate. |
| surface | The surface descriptor. |
| flags | Processing flags. |
NULL check and a return value.
|
extern |
Set display canvas background fill color.
0x10067 | color | The integer RGB value representing a new color. |
|
extern |
Set display canvas foreground fill color.
0x10068 | color | The integer RGB value representing a new color. |
|
extern |
Move a rectangle down by amount pixels.
0x10080 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| amount | Amount of pixels to move. |
|
extern |
Move a rectangle left by amount pixels.
0x10081 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| amount | Amount of pixels to move. |
|
extern |
Move a rectangle right by amount pixels.
0x10082 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| amount | Amount of pixels to move. |
|
extern |
Move a rectangle up by amount pixels.
0x10083 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
| amount | Amount of pixels to move. |
Set an LCD descriptor as active.
0x1008b | new_lcd | Pointer to the new LCD descriptor. If NULL, only return the current active LCD descriptor. |
new_lcd replaced it.
|
extern |
Move the cursor position on the current canvas to the specified coordinate.
0x1005f | x | The new x coordinate of the cursor. |
| y | The new y coordinate of the cursor. |
|
extern |
Set the size of the cursor on the current canvas.
0x1005d | new_size | The new cursor size. |
|
extern |
Set the type of the cursor on the current canvas.
0x10061 | new_type | The new cursor type. |
|
extern |
Link a surface (device context) to an LCD descriptor.
The drawing area lcd_t::drawing_area will also be reset to cover the entire surface.
If the display is portrait as indicated by the lcd_t::rotation value, the LCD descriptor's width/height fields will be updated to reflect the dimension shown to the user (i.e. swap width and height).
0x10093 | lcd | The LCD descriptor. |
| new_surface | The descriptor of the new surface to be linked to lcd. |
lcd.
|
extern |
Set the drawing area of the current active LCD.
The new values will be rejected if they are out of bounds (specifically when x0 or x1 are negative or x1 or y1 are less than x0 and y0 respectively), although x1 and y1 will be automatically capped at the physical display size if they are larger than that instead of failing outright.
0x10073 | x0 | X coordinate of the top-left corner, in pixels (inclusive). |
| y0 | Y coordinate of the top-left corner, in pixels (inclusive). |
| x1 | X coordinate of the bottom-right corner, in pixels (inclusive). |
| y1 | Y coordinate of the bottom-right corner, in pixels (inclusive). |
|
extern |
Set the current font type to font_type.
0x10051 | font_type | The font type. |
font_type. | short SetPenSize | ( | short | size | ) |
Set the stroke width.
0x1006e | size | New stroke width in pixels. |
| short SetPenStyle | ( | short | dash, |
| unsigned int * | dash_pattern | ||
| ) |
Set the stroke dash pattern.
The dash bit patterns are simple 32-bit bitfields (in big endian). Each bit 1 represents a foreground colored pixel and bit 0 represents a background pixel, from left to right, MSB to LSB. For example, stroke-dasharray 1 7 4 4 2 6 4 4 can be encoded as 10000000111100001100000011110000. With endian swapped, the final dash_pattern would be 0xf0c0f080.
0x1006b | dash | New predefined dash pattern. Set to DASH_CUSTOM to specify a custom pattern. | |
| [in,out] | dash_pattern | New dash bit pattern. Will be set to the previous dash bit pattern once this function returns. |
| int SetPixel | ( | short | x, |
| short | y, | ||
| int | color | ||
| ) |
Set the pixel color on the current active surface with the given pixel.
When the surface uses indexed color, the color that is the closest to the palette will be picked.
0x10070 | x | X coordinate. |
| y | Y coordinate. |
| color | The RGB color value. |
|
extern |
Set display canvas transparent color.
This color will be removed from the image and replaced with transparency effect.
0x10065 | color | The integer RGB value representing a new color. |
|
extern |
Draw a surface onto current active LCD.
If surface is set to NULL this will fail gracefully.
0x10059 | x | X coordinate. |
| y | Y coordinate. |
| surface | The surface descriptor. |
| flags | Processing flags. |
| 0 | The operation was completed successfully. |
| -1 | The operation failed with error. |
|
extern |
Draw a string s with specified alignment at (x, y) px.
The anchor point will be located at the top of the string to be drawn. The align parameter then controls whether the anchor point will be at the left, center or right of the string.
If the string is too long, it will be truncated to max_length. After truncation, the last few characters may get replaced with ... depending on the font selection.
0x10052 | x | X coordinate of the anchor point. |
| y | Y coordinate of the anchor point. |
| s | String to be drawn. Exact encoding depends on the process flags being used. |
| max_length | The maximum length of the string in pixels. |
| align | String alignment. |
| flags | String processing flags |
|
extern |
Draw a UTF-16 character c aligned to the top left corner at (x, y) px.
0x10053 | x | X coordinate of the corner. |
| y | Y coordinate of the corner. |
| c | UTF-16 codepoint of the character. |
| flags | Process flags. |
|
extern |
Draw a string s aligned to the top left corner at (x, y) px.
0x10054 | x | X coordinate of the corner. | |
| y | Y coordinate of the corner. | |
| [in] | s | String to be drawn. Exact encoding depends on the process flags being used. |
| flags | Process flags. |