libghostty
Loading...
Searching...
No Matches
GhosttyKittyGraphicsPlacementRenderInfo Struct Reference

#include <ghostty/vt/kitty_graphics.h>

Data Fields

size_t size
uint32_t pixel_width
uint32_t pixel_height
uint32_t grid_cols
uint32_t grid_rows
int32_t viewport_col
int32_t viewport_row
bool viewport_visible
uint32_t source_x
uint32_t source_y
uint32_t source_width
uint32_t source_height

Detailed Description

The geometry of a storage placement, filled in by ghostty_kitty_graphics_placement_render_info().

It holds the results of ghostty_kitty_graphics_placement_pixel_size(), ghostty_kitty_graphics_placement_grid_size(), ghostty_kitty_graphics_placement_viewport_pos() and ghostty_kitty_graphics_placement_source_rect(), so you can get all of them in one call. That helps most when each call is expensive, such as through FFI or Cgo.

This is for inspecting the storage. To draw, use the render state's image list, which gives the same values for every image on screen. See "Drawing Images" in the Kitty Graphics documentation.

Later versions may add fields to the end of this struct. Set size with GHOSTTY_INIT_SIZED before each call, so the library knows which fields you have:

ghostty_kitty_graphics_placement_render_info(iter, image, terminal, &info);
GHOSTTY_API GhosttyResult ghostty_kitty_graphics_placement_render_info(GhosttyKittyGraphicsPlacementIterator iterator, GhosttyKittyGraphicsImage image, GhosttyTerminal terminal, GhosttyKittyGraphicsPlacementRenderInfo *out_info)
#define GHOSTTY_INIT_SIZED(type)
Definition types.h:359

Definition at line 597 of file kitty_graphics.h.

Field Documentation

◆ grid_cols

uint32_t grid_cols

The number of columns of cells the placement covers.

Definition at line 605 of file kitty_graphics.h.

◆ grid_rows

uint32_t grid_rows

The number of rows of cells the placement covers.

Definition at line 607 of file kitty_graphics.h.

◆ pixel_height

uint32_t pixel_height

The height to draw the image at, in pixels.

Definition at line 603 of file kitty_graphics.h.

◆ pixel_width

uint32_t pixel_width

The width to draw the image at, in pixels.

Definition at line 601 of file kitty_graphics.h.

◆ size

size_t size

The size of this struct in bytes. Set it with GHOSTTY_INIT_SIZED.

Definition at line 599 of file kitty_graphics.h.

◆ source_height

uint32_t source_height

The height of the part of the image to draw, in image pixels.

Definition at line 627 of file kitty_graphics.h.

◆ source_width

uint32_t source_width

The width of the part of the image to draw, in image pixels.

Definition at line 625 of file kitty_graphics.h.

◆ source_x

uint32_t source_x

The left edge of the part of the image to draw, in image pixels.

Definition at line 621 of file kitty_graphics.h.

◆ source_y

uint32_t source_y

The top edge of the part of the image to draw, in image pixels.

Definition at line 623 of file kitty_graphics.h.

◆ viewport_col

int32_t viewport_col

The column of the top-left cell, where 0 is the leftmost column of the viewport. Only meaningful when viewport_visible is true.

Definition at line 610 of file kitty_graphics.h.

◆ viewport_row

int32_t viewport_row

The row of the top-left cell, where 0 is the top row of the viewport. It is negative when the top of the placement scrolled above the viewport. Only meaningful when viewport_visible is true.

Definition at line 615 of file kitty_graphics.h.

◆ viewport_visible

bool viewport_visible

True when any part of the placement is in the viewport. False when it is entirely outside the viewport, or when the storage can't find its position: a virtual placement, or a placement relative to one.

Definition at line 619 of file kitty_graphics.h.


The documentation for this struct was generated from the following file: