pub struct Image {
pub width: usize,
pub height: usize,
pub top_left: TextureCoordinate,
pub bottom_right: TextureCoordinate,
pub image: Arc<ImageData>,
}
Expand description
The Image
Change
needs to support adding an image that spans multiple
rows and columns, as well as model the content for just one of those cells.
For instance, if some of the cells inside an image are replaced by textual
content, and the screen is scrolled, computing the diff change stream needs
to be able to express that a single cell holds a slice from a larger image.
The Image
struct expresses its dimensions in cells and references a region
in the shared source image data using texture coordinates.
A 4x3 cell image would set width=3
, height=3
, top_left=(0,0)
, bottom_right=(1,1)
.
The top left cell from that image, if it were to be included in a diff,
would be recorded as width=1
, height=1
, top_left=(0,0)
, bottom_right=(1/4,1/3)
.
Fields§
§width: usize
measured in cells
height: usize
measure in cells
top_left: TextureCoordinate
Texture coordinate for the top left of this image block. (0,0) is the top left of the ImageData. (1, 1) is the bottom right.
bottom_right: TextureCoordinate
Texture coordinates for the bottom right of this image block.
image: Arc<ImageData>
the image data