Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
graphicsconsole.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_GRAPHICSCONSOLE_H
27#define _ULTIBO_GRAPHICSCONSOLE_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/globaltypes.h"
34#include "ultibo/globalconst.h"
35#include "ultibo/console.h"
36
38
42
45
47
55
66WINDOW_HANDLE STDCALL graphics_window_create_ex(CONSOLE_DEVICE *console, FONT_HANDLE font, uint32_t size, uint32_t state, uint32_t mode, uint32_t position);
67
74
81
88
95
103
111
119
129WINDOW_HANDLE STDCALL graphics_window_at(CONSOLE_DEVICE *console, uint32_t x, uint32_t y, BOOL visible);
130
138
147
155
163uint32_t STDCALL graphics_window_update_flag(WINDOW_HANDLE handle, uint32_t flag, BOOL clear);
164
171
178
185
193uint32_t STDCALL graphics_window_set_position(WINDOW_HANDLE handle, uint32_t position);
194
202
210
218
226
234
242
251
258
269uint32_t STDCALL graphics_window_get_viewport(WINDOW_HANDLE handle, uint32_t *x1, uint32_t *y1, uint32_t *x2, uint32_t *y2);
270
281uint32_t STDCALL graphics_window_set_viewport(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2);
282
289
297
305
313
321
328
335
342uint32_t STDCALL graphics_window_set_forecolor(WINDOW_HANDLE handle, uint32_t color);
343
350
357uint32_t STDCALL graphics_window_set_backcolor(WINDOW_HANDLE handle, uint32_t color);
358
365
373
382uint32_t STDCALL graphics_window_get_cursor_xy(WINDOW_HANDLE handle, uint32_t *x, uint32_t *y);
383
392uint32_t STDCALL graphics_window_set_cursor_xy(WINDOW_HANDLE handle, uint32_t x, uint32_t y);
393
400
408
415
423
430
438
445
453
460
467
474
481
488
497uint32_t STDCALL graphics_window_cursor_move(WINDOW_HANDLE handle, uint32_t x, uint32_t y);
498
506
513
525uint32_t STDCALL graphics_window_clear_ex(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color);
526
539uint32_t STDCALL graphics_window_draw_box(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color, uint32_t width);
540
553uint32_t STDCALL graphics_window_draw_line(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color, uint32_t width);
554
566uint32_t STDCALL graphics_window_draw_block(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color);
567
579uint32_t STDCALL graphics_window_draw_circle(WINDOW_HANDLE handle, uint32_t x, uint32_t y, uint32_t color, uint32_t width, uint32_t radius);
580
590uint32_t STDCALL graphics_window_draw_char(WINDOW_HANDLE handle, char ch, uint32_t x, uint32_t y);
591
604uint32_t STDCALL graphics_window_draw_char_ex(WINDOW_HANDLE handle, FONT_HANDLE font, char ch, uint32_t x, uint32_t y, uint32_t forecolor, uint32_t backcolor);
605
615uint32_t STDCALL graphics_window_draw_text(WINDOW_HANDLE handle, const char *text, uint32_t x, uint32_t y);
616
629uint32_t STDCALL graphics_window_draw_text_ex(WINDOW_HANDLE handle, FONT_HANDLE font, const char *text, uint32_t x, uint32_t y, uint32_t forecolor, uint32_t backcolor);
630
640uint32_t STDCALL graphics_window_draw_pixel(WINDOW_HANDLE handle, uint32_t x, uint32_t y, uint32_t color);
641
654uint32_t STDCALL graphics_window_draw_image(WINDOW_HANDLE handle, uint32_t x, uint32_t y, void *image, uint32_t width, uint32_t height, uint32_t format);
655
664uint32_t STDCALL graphics_window_get_pixel(WINDOW_HANDLE handle, uint32_t x, uint32_t y);
665
678uint32_t STDCALL graphics_window_get_image(WINDOW_HANDLE handle, uint32_t x, uint32_t y, void *image, uint32_t width, uint32_t height, uint32_t format);
679
690uint32_t STDCALL graphics_window_copy_image(WINDOW_HANDLE handle, CONSOLE_POINT *source, CONSOLE_POINT *dest, uint32_t width, uint32_t height);
691
703uint32_t STDCALL graphics_window_move_image(WINDOW_HANDLE handle, CONSOLE_POINT *source, CONSOLE_POINT *dest, uint32_t width, uint32_t height, uint32_t fillcolor);
704
714uint32_t STDCALL graphics_window_image_size(WINDOW_HANDLE handle, uint32_t width, uint32_t height, uint32_t format, uint32_t stride);
715
717
724
731
739
740#ifdef __cplusplus
741}
742#endif
743
744#endif // _ULTIBO_GRAPHICSCONSOLE_H
uint32_t STDCALL(* console_window_enumerate_cb)(CONSOLE_DEVICE *console, WINDOW_HANDLE handle, void *data)
Definition console.h:362
struct _CONSOLE_WINDOW CONSOLE_WINDOW
Definition console.h:228
struct _WINDOW_PROPERTIES WINDOW_PROPERTIES
Definition console.h:339
CURSOR_MODE
Definition console.h:136
struct _CONSOLE_DEVICE CONSOLE_DEVICE
Definition console.h:186
CURSOR_SHAPE
Definition console.h:148
CURSOR_STATE
Definition console.h:142
HANDLE WINDOW_HANDLE
Definition globaltypes.h:121
#define STDCALL
Definition globaltypes.h:45
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE FONT_HANDLE
Definition globaltypes.h:122
BOOL STDCALL graphics_window_check_flag(WINDOW_HANDLE handle, uint32_t flag)
Check an existing console window to determine if a flag is set or not.
uint32_t STDCALL graphics_window_show(WINDOW_HANDLE handle)
Make an existing console window visible and show it on screen.
WINDOW_HANDLE STDCALL graphics_window_create_ex(CONSOLE_DEVICE *console, FONT_HANDLE font, uint32_t size, uint32_t state, uint32_t mode, uint32_t position)
Create a new Graphics window.
uint32_t STDCALL graphics_window_get_cols(WINDOW_HANDLE handle)
Get the current columns of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_get_height(WINDOW_HANDLE handle)
Get the absolute height of an existing console window.
uint32_t STDCALL graphics_window_set_forecolor(WINDOW_HANDLE handle, uint32_t color)
Set the current foreground color of an existing console window.
uint32_t STDCALL graphics_window_set_cursor_mode(WINDOW_HANDLE handle, CURSOR_MODE cursormode)
Set the current cursor mode of an existing console window.
uint32_t STDCALL graphics_window_get_min_y(WINDOW_HANDLE handle)
Get the current minimum Y of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_clear_ex(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color)
Clear part of the the current viewport of an existing console window.
uint32_t STDCALL graphics_window_set_cursor_state(WINDOW_HANDLE handle, CURSOR_STATE cursorstate)
Set the current cursor state of an existing console window.
GRAPHICS_WINDOW *STDCALL graphics_window_check(CONSOLE_DEVICE *console, GRAPHICS_WINDOW *window)
Check if a console window entry is valid.
uint32_t STDCALL graphics_window_clear(WINDOW_HANDLE handle)
Clear the current viewport of an existing console window.
uint32_t STDCALL graphics_window_draw_char_ex(WINDOW_HANDLE handle, FONT_HANDLE font, char ch, uint32_t x, uint32_t y, uint32_t forecolor, uint32_t backcolor)
Draw a character on an existing console window.
uint32_t STDCALL graphics_window_get_backcolor(WINDOW_HANDLE handle)
Get the current background color of an existing console window.
uint32_t STDCALL graphics_window_get_state(WINDOW_HANDLE handle)
Get the window state of an existing console window.
BOOL STDCALL graphics_window_get_cursor_blink(WINDOW_HANDLE handle)
Get the current cursor blink state of an existing console window.
uint32_t STDCALL graphics_window_get_mode(WINDOW_HANDLE handle)
Get the window mode of an existing console window.
WINDOW_HANDLE STDCALL graphics_window_create(CONSOLE_DEVICE *console, uint32_t position)
Create a new Graphics window.
uint32_t STDCALL graphics_window_enumerate(CONSOLE_DEVICE *console, graphics_window_enumerate_cb callback, void *data)
Enumerate existing console windows on the specified console device.
uint32_t STDCALL graphics_window_draw_text(WINDOW_HANDLE handle, const char *text, uint32_t x, uint32_t y)
Draw a text string on an existing console window.
uint32_t STDCALL graphics_window_draw_line(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color, uint32_t width)
Draw a line on an existing console window.
CONSOLE_RECT STDCALL graphics_window_get_rect(WINDOW_HANDLE handle)
Get the rectangle X1,Y1,X2,Y2 of the window viewport for an existing console window.
WINDOW_HANDLE STDCALL graphics_window_find(CONSOLE_DEVICE *console, uint32_t position)
Find an existing console window in the position specified.
CURSOR_STATE STDCALL graphics_window_get_cursor_state(WINDOW_HANDLE handle)
Get the current cursor state of an existing console window.
uint32_t STDCALL graphics_window_get_width(WINDOW_HANDLE handle)
Get the absolute width of an existing console window.
uint32_t STDCALL graphics_window_reset_rect(WINDOW_HANDLE handle)
Reset the window viewport for an existing console window to the maximum size.
uint32_t STDCALL graphics_window_get_properties(WINDOW_HANDLE handle, WINDOW_PROPERTIES *properties)
Get the properties for the specified console window.
uint32_t STDCALL graphics_window_draw_circle(WINDOW_HANDLE handle, uint32_t x, uint32_t y, uint32_t color, uint32_t width, uint32_t radius)
Draw a circle on an existing console window.
uint32_t STDCALL graphics_window_reset_viewport(WINDOW_HANDLE handle)
Reset the window viewport for an existing console window to the maximum size.
uint32_t STDCALL graphics_window_cursor_move(WINDOW_HANDLE handle, uint32_t x, uint32_t y)
Move the cursor on an existing console window.
CURSOR_SHAPE STDCALL graphics_window_get_cursor_shape(WINDOW_HANDLE handle)
Get the current cursor shape of an existing console window.
uint32_t STDCALL graphics_window_set_cursor_blink(WINDOW_HANDLE handle, BOOL cursorblink)
Set the current cursor blink state of an existing console window.
uint32_t STDCALL graphics_window_draw_image(WINDOW_HANDLE handle, uint32_t x, uint32_t y, void *image, uint32_t width, uint32_t height, uint32_t format)
Draw an image on an existing console window.
uint32_t STDCALL graphics_window_get_image(WINDOW_HANDLE handle, uint32_t x, uint32_t y, void *image, uint32_t width, uint32_t height, uint32_t format)
Get an image from an existing console window.
uint32_t STDCALL graphics_window_image_size(WINDOW_HANDLE handle, uint32_t width, uint32_t height, uint32_t format, uint32_t stride)
Calculate the size in bytes of an image that is Width by Height in the color format specified.
uint32_t STDCALL graphics_window_copy_image(WINDOW_HANDLE handle, CONSOLE_POINT *source, CONSOLE_POINT *dest, uint32_t width, uint32_t height)
Copy an image from one place to another in an existing console window.
WINDOW_HANDLE STDCALL graphics_window_next(CONSOLE_DEVICE *console, BOOL visible)
Get the next console window starting with the active window.
CURSOR_MODE STDCALL graphics_window_get_cursor_mode(WINDOW_HANDLE handle)
Get the current cursor mode of an existing console window.
WINDOW_HANDLE STDCALL graphics_window_previous(CONSOLE_DEVICE *console, BOOL visible)
Get the previous console window starting with the active window.
uint32_t STDCALL graphics_window_cursor_off(WINDOW_HANDLE handle)
Disable the cursor on an existing console window.
uint32_t STDCALL graphics_window_get_count(CONSOLE_DEVICE *console)
Get the current console window count.
uint32_t STDCALL graphics_window_cursor_line(WINDOW_HANDLE handle)
Change the cursor to a vertical line on an existing console window.
uint32_t STDCALL graphics_window_cursor_on(WINDOW_HANDLE handle)
Enable the cursor on an existing console window.
WINDOW_HANDLE STDCALL graphics_window_at(CONSOLE_DEVICE *console, uint32_t x, uint32_t y, BOOL visible)
Find the console window that X and Y coordinates are within.
uint32_t STDCALL graphics_window_get_position(WINDOW_HANDLE handle)
Get the position of an existing console window.
uint32_t STDCALL graphics_window_set_cursor_shape(WINDOW_HANDLE handle, CURSOR_SHAPE cursorshape)
Set the current cursor shape of an existing console window.
uint32_t STDCALL graphics_window_get_format(WINDOW_HANDLE handle)
Get the color format of an existing console window.
uint32_t STDCALL graphics_window_set_cursor_xy(WINDOW_HANDLE handle, uint32_t x, uint32_t y)
Set the current cursor X and Y positions of an existing console window.
uint32_t STDCALL graphics_window_get_rows(WINDOW_HANDLE handle)
Get the current rows of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_destroy(WINDOW_HANDLE handle)
Close and Destroy an existing console window.
uint32_t STDCALL graphics_window_get_forecolor(WINDOW_HANDLE handle)
Get the current foreground color of an existing console window.
uint32_t STDCALL graphics_window_get_max_y(WINDOW_HANDLE handle)
Get the current maximum Y of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_draw_text_ex(WINDOW_HANDLE handle, FONT_HANDLE font, const char *text, uint32_t x, uint32_t y, uint32_t forecolor, uint32_t backcolor)
Draw a text string on an existing console window.
uint32_t STDCALL graphics_window_get_cursor_xy(WINDOW_HANDLE handle, uint32_t *x, uint32_t *y)
Get the current cursor X and Y positions of an existing console window.
uint32_t STDCALL graphics_window_set_viewport(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2)
Set the X1,Y1,X2,Y2 of the window viewport for an existing console window.
console_window_enumerate_cb graphics_window_enumerate_cb
Definition graphicsconsole.h:41
uint32_t STDCALL graphics_window_draw_char(WINDOW_HANDLE handle, char ch, uint32_t x, uint32_t y)
Draw a character on an existing console window.
uint32_t STDCALL graphics_window_cursor_bar(WINDOW_HANDLE handle)
Change the cursor to a horizontal bar on an existing console window.
uint32_t STDCALL graphics_window_set_position(WINDOW_HANDLE handle, uint32_t position)
Set the position of an existing console window.
CONSOLE_WINDOW GRAPHICS_WINDOW
Definition graphicsconsole.h:44
uint32_t STDCALL graphics_window_draw_pixel(WINDOW_HANDLE handle, uint32_t x, uint32_t y, uint32_t color)
Draw a single pixel on an existing console window.
uint32_t STDCALL graphics_window_draw_box(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color, uint32_t width)
Draw a rectangular box outline on an existing console window.
uint32_t STDCALL graphics_window_deactivate(WINDOW_HANDLE handle)
Make an existing console window inactive.
uint32_t STDCALL graphics_window_get_viewport(WINDOW_HANDLE handle, uint32_t *x1, uint32_t *y1, uint32_t *x2, uint32_t *y2)
Get the X1,Y1,X2,Y2 of the window viewport for an existing console window.
FONT_HANDLE STDCALL graphics_window_get_font(WINDOW_HANDLE handle)
Get the default font of an existing console window.
uint32_t STDCALL graphics_window_set_font(WINDOW_HANDLE handle, FONT_HANDLE font)
Set the default font of an existing console window.
uint32_t STDCALL graphics_window_get_min_x(WINDOW_HANDLE handle)
Get the current minimum X of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_get_max_x(WINDOW_HANDLE handle)
Get the current maximum X of the window viewport for an existing console window.
uint32_t STDCALL graphics_window_cursor_blink(WINDOW_HANDLE handle, BOOL enabled)
Set the blink state of the cursor on an existing console window.
uint32_t STDCALL graphics_window_activate(WINDOW_HANDLE handle)
Make an existing console window the active window.
uint32_t STDCALL graphics_window_get_pixel(WINDOW_HANDLE handle, uint32_t x, uint32_t y)
Get a single pixel from an existing console window.
uint32_t STDCALL graphics_window_cursor_block(WINDOW_HANDLE handle)
Change the cursor to a solid block on an existing console window.
uint32_t STDCALL graphics_window_draw_block(WINDOW_HANDLE handle, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color)
Draw a rectangular filled block on an existing console window.
uint32_t STDCALL graphics_window_move_image(WINDOW_HANDLE handle, CONSOLE_POINT *source, CONSOLE_POINT *dest, uint32_t width, uint32_t height, uint32_t fillcolor)
Move an image from one place to another in an existing console window.
uint32_t STDCALL graphics_window_update_flag(WINDOW_HANDLE handle, uint32_t flag, BOOL clear)
Set or clear a flag on an existing console window.
uint32_t STDCALL graphics_window_set_backcolor(WINDOW_HANDLE handle, uint32_t color)
Set the current background color of an existing console window.
uint32_t STDCALL graphics_window_hide(WINDOW_HANDLE handle)
Make an existing console window invisible and hide it on screen.
uint32_t STDCALL graphics_window_set_rect(WINDOW_HANDLE handle, CONSOLE_RECT *rect)
Set the rectangle X1,Y1,X2,Y2 of the window viewport for an existing console window.
WINDOW_HANDLE STDCALL graphics_window_get_active(CONSOLE_DEVICE *console)
Get the current console active window.
Definition console.h:163
Definition console.h:169