XU XUv0.16.0

#image

import: #image

counts: 7 functions, 28 methods, 6 types, 0 constants, 0 method sets

Point / Rectangle / RGBA pixel buffer.

struct Point

XuAPI
pub struct Point {
    pub x int
    pub y int
}

Purpose

2D geometric point (x, y).

Public fields

x int
value
y int
value

struct Rectangle

XuAPI
pub struct Rectangle {
    pub min Point
    pub max Point
}

Purpose

2D axis-aligned rectangle bounded by min and max.

Public fields

min Point
minimum
max Point
maximum

struct RGBA

XuAPI
pub struct RGBA {
    pub pix []int
    pub stride int
    pub rect Rectangle
}

Purpose

32-bit RGBA pixel image buffer in contiguous memory.

Public fields

pix []int
field ([]int)
stride int
field (int)
rect Rectangle
field (Rectangle)

struct RGBA8

XuAPI
pub struct RGBA8 {
    pub pix []u8
    pub stride int
    pub rect Rectangle
}

Purpose

Structure encapsulating pix, stride, rect.

Public fields

pix []u8
field ([]u8)
stride int
field (int)
rect Rectangle
field (Rectangle)

struct RGB24

XuAPI
pub struct RGB24 {
    pub pix []u8
    pub stride int
    pub rect Rectangle
}

Purpose

Structure encapsulating pix, stride, rect.

Public fields

pix []u8
field ([]u8)
stride int
field (int)
rect Rectangle
field (Rectangle)

struct Gray8

XuAPI
pub struct Gray8 {
    pub pix []u8
    pub stride int
    pub rect Rectangle
}

Purpose

Structure encapsulating pix, stride, rect.

Public fields

pix []u8
field ([]u8)
stride int
field (int)
rect Rectangle
field (Rectangle)

pt

XuAPI
pub fn pt(x int, y int) Point

Purpose

Construct a 2D Point{x, y} from coordinates.

Parameters

x int
horizontal coordinate
y int
vertical coordinate

Returns

Point struct instance

rect

XuAPI
pub fn rect(x0 int, y0 int, x1 int, y1 int) Rectangle

Purpose

Construct a Rectangle from coordinates (x0, y0) to (x1, y1).

Parameters

x0 int
min x
y0 int
min y
x1 int
max x
y1 int
max y

Returns

Rectangle struct instance

(Point) add

XuAPI
pub fn (p Point) add(q Point) Point

Purpose

Operation on Point: add.

Parameters

p Point
The Point instance used by this call (value receiver).
q Point
q (Point)

Returns

Point — a value of this type

(Point) sub

XuAPI
pub fn (p Point) sub(q Point) Point

Purpose

Operation on Point: subtract.

Parameters

p Point
The Point instance used by this call (value receiver).
q Point
q (Point)

Returns

Point — a value of this type

(Point) eq

XuAPI
pub fn (p Point) eq(q Point) bool

Purpose

Report whether this object equals the other.

Parameters

p Point
The Point instance used by this call (value receiver).
q Point
q (Point)

Returns

bool — true or false

(Point) in_rect

XuAPI
pub fn (p Point) in_rect(r Rectangle) bool

Purpose

Report whether the point lies inside the given rectangle.

Parameters

p Point
The Point instance used by this call (value receiver).
r Rectangle
rune (Unicode code point) (Rectangle)

Returns

bool — true or false

(Rectangle) dx

XuAPI
pub fn (r Rectangle) dx() int

Purpose

Compute horizontal span (max.x - min.x).

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).

Returns

int — a value of this type

(Rectangle) dy

XuAPI
pub fn (r Rectangle) dy() int

Purpose

Compute vertical span (max.y - min.y).

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).

Returns

int — a value of this type

(Rectangle) empty

XuAPI
pub fn (r Rectangle) empty() bool

Purpose

Report whether the geometry rectangle is empty (dx <= 0 or dy <= 0).

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).

Returns

bool — true or false

(Rectangle) eq

XuAPI
pub fn (r Rectangle) eq(s Rectangle) bool

Purpose

Report whether this object equals the other.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).
s Rectangle
s (Rectangle)

Returns

bool — true or false

(Rectangle) overlaps

XuAPI
pub fn (r Rectangle) overlaps(s Rectangle) bool

Purpose

Report whether this rectangle overlaps with the other.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).
s Rectangle
s (Rectangle)

Returns

bool — true or false

(Rectangle) add

XuAPI
pub fn (r Rectangle) add(p Point) Rectangle

Purpose

Operation on Rectangle: add.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).
p Point
p (Point)

Returns

Rectangle — a value of this type

(Rectangle) intersect

XuAPI
pub fn (r Rectangle) intersect(s Rectangle) Rectangle

Purpose

Compute the intersection rectangle of the two.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).
s Rectangle
s (Rectangle)

Returns

Rectangle — a value of this type

(Rectangle) union

XuAPI
pub fn (r Rectangle) union(s Rectangle) Rectangle

Purpose

Compute the minimal bounding union rectangle containing both.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).
s Rectangle
s (Rectangle)

Returns

Rectangle — a value of this type

(Rectangle) canon

XuAPI
pub fn (r Rectangle) canon() Rectangle

Purpose

Return canonical rectangle ensuring min <= max.

Parameters

r Rectangle
The Rectangle instance used by this call (value receiver).

Returns

Rectangle — a value of this type

new_rgba

XuAPI
pub fn new_rgba(r Rectangle) RGBA

Purpose

Construct rgba.

Parameters

r Rectangle
rune (Unicode code point) (Rectangle)

Returns

RGBA — a value of this type

(RGBA) pix_offset

XuAPI
pub fn (p RGBA) pix_offset(x int, y int) int

Purpose

Operation on RGBA: pix offset.

Parameters

p RGBA
The RGBA instance used by this call (value receiver).
x int
value (int)
y int
value (int)

Returns

int — a value of this type

($&RGBA) set_rgba

XuAPI
pub fn (p $&RGBA) set_rgba(x int, y int, c color.RGBA)

Purpose

Operation on $&RGBA: set rgba.

Parameters

p $&RGBA
The RGBA instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
c color.RGBA
byte or character code (color.RGBA)

Returns

This call does not return a value.

(RGBA) at_rgba

XuAPI
pub fn (p RGBA) at_rgba(x int, y int) color.RGBA

Purpose

Operation on RGBA: at rgba.

Parameters

p RGBA
The RGBA instance used by this call (value receiver).
x int
value (int)
y int
value (int)

Returns

color.RGBA — a value of this type

new_rgba8

XuAPI
pub fn new_rgba8(r Rectangle) RGBA8

Purpose

Construct rgba8.

Parameters

r Rectangle
rune (Unicode code point) (Rectangle)

Returns

RGBA8 — a value of this type

new_rgb24

XuAPI
pub fn new_rgb24(r Rectangle) RGB24

Purpose

Construct rgb24.

Parameters

r Rectangle
rune (Unicode code point) (Rectangle)

Returns

RGB24 — a value of this type

new_gray8

XuAPI
pub fn new_gray8(r Rectangle) Gray8

Purpose

Construct gray8.

Parameters

r Rectangle
rune (Unicode code point) (Rectangle)

Returns

Gray8 — a value of this type

(&RGBA8) pix_offset

XuAPI
pub fn (p &RGBA8) pix_offset(x int, y int) int

Purpose

Operation on &RGBA8: pix offset.

Parameters

p &RGBA8
The RGBA8 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

int — a value of this type

($&RGBA8) set_rgba

XuAPI
pub fn (p $&RGBA8) set_rgba(x int, y int, c color.RGBA)

Purpose

Operation on $&RGBA8: set rgba.

Parameters

p $&RGBA8
The RGBA8 instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
c color.RGBA
byte or character code (color.RGBA)

Returns

This call does not return a value.

($&RGBA8) set_rgba_u8

XuAPI
pub fn (p $&RGBA8) set_rgba_u8(x int, y int, r u8, g u8, b u8, a u8)

Purpose

Operation on $&RGBA8: set rgba u8.

Parameters

p $&RGBA8
The RGBA8 instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
r u8
rune (Unicode code point) (u8)
g u8
g (u8)
b u8
b (u8)
a u8
value (u8)

Returns

This call does not return a value.

(&RGBA8) at_rgba

XuAPI
pub fn (p &RGBA8) at_rgba(x int, y int) color.RGBA

Purpose

Operation on &RGBA8: at rgba.

Parameters

p &RGBA8
The RGBA8 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

color.RGBA — a value of this type

($&RGBA8) fill_rgba

XuAPI
pub fn (p $&RGBA8) fill_rgba(r u8, g u8, b u8, a u8)

Purpose

Operation on $&RGBA8: fill rgba.

Parameters

p $&RGBA8
The RGBA8 instance used by this call (exclusive borrow).
r u8
rune (Unicode code point) (u8)
g u8
g (u8)
b u8
b (u8)
a u8
value (u8)

Returns

This call does not return a value.

(&RGBA8) to_rgba

XuAPI
pub fn (p &RGBA8) to_rgba() RGBA

Purpose

Operation on &RGBA8: convert to rgba.

Parameters

p &RGBA8
The RGBA8 instance used by this call (borrow).

Returns

RGBA — a value of this type

rgba8_from_rgba

XuAPI
pub fn rgba8_from_rgba(src &RGBA) RGBA8

Purpose

Rgba8 from rgba.

Parameters

src &RGBA
source (read-only borrow; caller keeps the original; type &RGBA)

Returns

RGBA8 — a value of this type

(&RGB24) pix_offset

XuAPI
pub fn (p &RGB24) pix_offset(x int, y int) int

Purpose

Operation on &RGB24: pix offset.

Parameters

p &RGB24
The RGB24 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

int — a value of this type

($&RGB24) set_rgb

XuAPI
pub fn (p $&RGB24) set_rgb(x int, y int, r u8, g u8, b u8)

Purpose

Operation on $&RGB24: set rgb.

Parameters

p $&RGB24
The RGB24 instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
r u8
rune (Unicode code point) (u8)
g u8
g (u8)
b u8
b (u8)

Returns

This call does not return a value.

(&RGB24) at_rgba

XuAPI
pub fn (p &RGB24) at_rgba(x int, y int) color.RGBA

Purpose

Operation on &RGB24: at rgba.

Parameters

p &RGB24
The RGB24 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

color.RGBA — a value of this type

(&Gray8) pix_offset

XuAPI
pub fn (p &Gray8) pix_offset(x int, y int) int

Purpose

Operation on &Gray8: pix offset.

Parameters

p &Gray8
The Gray8 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

int — a value of this type

($&Gray8) set_y

XuAPI
pub fn (p $&Gray8) set_y(x int, y int, v u8)

Purpose

Operation on $&Gray8: set y.

Parameters

p $&Gray8
The Gray8 instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
v u8
value (u8)

Returns

This call does not return a value.

(&Gray8) at_y

XuAPI
pub fn (p &Gray8) at_y(x int, y int) u8

Purpose

Operation on &Gray8: at y.

Parameters

p &Gray8
The Gray8 instance used by this call (borrow).
x int
value (int)
y int
value (int)

Returns

u8 — a value of this type