Ashet OS

namespace: ashet.draw

System Calls

syscall get_system_font(in font_name: str, out handle: Font)

Returns the font data for the given font name, if any.

syscall create_font(in data: bytestr, out handle: Font)

Creates a new custom font from the given data.

syscall is_system_font(in font: Font, out system_font: bool)

Returns true if the given font is a system-owned font.

syscall measure_text_size(in font: Font, in text: str, out size: Size)

Measures the size of a text string.

Note:

This function accepts strings using the LF line separator and will return the height of all lines and the width of the longest line.

syscall create_memory_framebuffer(in size: Size, out handle: Framebuffer)

Creates a new in-memory framebuffer that can be used for offscreen painting.

syscall create_video_framebuffer(in output: VideoOutput, out handle: Framebuffer)

Creates a new framebuffer based off a video output. Can be used to output pixels to the screen.

syscall create_window_framebuffer(in window: Window, out handle: Framebuffer)

Creates a new framebuffer that allows painting into a GUI window.

syscall create_widget_framebuffer(in widget: Widget, out handle: Framebuffer)

Creates a new framebuffer that allows painting into a widget.

syscall get_framebuffer_type(in fb: Framebuffer, out type: FramebufferType)

Returns the type of a framebuffer object.

syscall get_framebuffer_size(in fb: Framebuffer, out size: Size)

Returns the size of a framebuffer object.

syscall get_framebuffer_memory(in fb: Framebuffer, out memory: VideoMemory)

Returns the video memory for a *memory* framebuffer. Other framebuffer types are not allowed to be passed.

syscall invalidate_framebuffer(in fb: Framebuffer, in area: Rectangle)

Marks a portion of the framebuffer as changed and forces the OS to perform an update action if necessary.

Asynchronous Operations

async_call Render(in target: Framebuffer, in sequence: bytestr, in auto_invalidate: bool)

Renders the provided Ashet Graphics Protocol sequence into target framebuffer.

The function will run asynchronously and will return as soon as the rendering is done.

Note:

On machines without hardware acceleration, this syscall might be completed synchronously.