XU XUv0.8.8
EN

API

#image

import: #image

counts: 3 函数, 16 方法, 3 类型, 0 常量, 0 方法集

Point / Rectangle / RGBA 像素缓冲。

struct Point

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

用途

公开结构体 `Point`。

参数

x int
值
y int
值

struct Rectangle

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

用途

公开结构体 `Rectangle`。

参数

min Point
下限
max Point
上限

struct RGBA

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

用途

公开结构体 `RGBA`。

参数

pix []int
字段([]int)
stride int
字段(int)
rect Rectangle
字段(Rectangle)

pt

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

用途

构造 Point。

参数

x int
值(int)
y int
值(int)

返回

Point — 该类型的值

rect

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

用途

构造 Rectangle。

参数

x0 int
x0(int)
y0 int
y0(int)
x1 int
x1(int)
y1 int
y1(int)

返回

Rectangle — 该类型的值

(Point) add

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

用途

`Point` 上的方法:相加。

参数

p Point
接收者 Point(值接收者)
q Point
q(Point)

返回

Point — 该类型的值

(Point) sub

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

用途

`Point` 上的方法:相减。

参数

p Point
接收者 Point(值接收者)
q Point
q(Point)

返回

Point — 该类型的值

(Point) eq

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

用途

在 `Point` 上调用 `eq`。

参数

p Point
接收者 Point(值接收者)
q Point
q(Point)

返回

bool — 是否成立

(Point) in_rect

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

用途

`Point` 上的方法:in矩形。

参数

p Point
接收者 Point(值接收者)
r Rectangle
rune(Unicode 码点)(Rectangle)

返回

bool — 是否成立

(Rectangle) dx

XuAPI
pub fn (r Rectangle) dx() int

用途

在 `Rectangle` 上调用 `dx`。

参数

r Rectangle
接收者 Rectangle(值接收者)

返回

int — 该类型的值

(Rectangle) dy

XuAPI
pub fn (r Rectangle) dy() int

用途

在 `Rectangle` 上调用 `dy`。

参数

r Rectangle
接收者 Rectangle(值接收者)

返回

int — 该类型的值

(Rectangle) empty

XuAPI
pub fn (r Rectangle) empty() bool

用途

在 `Rectangle` 上调用 `empty`。

参数

r Rectangle
接收者 Rectangle(值接收者)

返回

bool — 是否成立

(Rectangle) eq

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

用途

在 `Rectangle` 上调用 `eq`。

参数

r Rectangle
接收者 Rectangle(值接收者)
s Rectangle
源字符串(Rectangle)

返回

bool — 是否成立

(Rectangle) overlaps

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

用途

在 `Rectangle` 上调用 `overlaps`。

参数

r Rectangle
接收者 Rectangle(值接收者)
s Rectangle
源字符串(Rectangle)

返回

bool — 是否成立

(Rectangle) add

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

用途

`Rectangle` 上的方法:相加。

参数

r Rectangle
接收者 Rectangle(值接收者)
p Point
p(Point)

返回

Rectangle — 该类型的值

(Rectangle) intersect

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

用途

在 `Rectangle` 上调用 `intersect`。

参数

r Rectangle
接收者 Rectangle(值接收者)
s Rectangle
源字符串(Rectangle)

返回

Rectangle — 该类型的值

(Rectangle) union

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

用途

在 `Rectangle` 上调用 `union`。

参数

r Rectangle
接收者 Rectangle(值接收者)
s Rectangle
源字符串(Rectangle)

返回

Rectangle — 该类型的值

(Rectangle) canon

XuAPI
pub fn (r Rectangle) canon() Rectangle

用途

在 `Rectangle` 上调用 `canon`。

参数

r Rectangle
接收者 Rectangle(值接收者)

返回

Rectangle — 该类型的值

new_rgba

XuAPI
pub fn new_rgba(r Rectangle) RGBA

用途

构造 rgba。

参数

r Rectangle
rune(Unicode 码点)(Rectangle)

返回

RGBA — 该类型的值

(RGBA) pix_offset

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

用途

`RGBA` 上的方法:pixoffset。

参数

p RGBA
接收者 RGBA(值接收者)
x int
值(int)
y int
值(int)

返回

int — 该类型的值

(&mut RGBA) set_rgba

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

用途

`&mut RGBA` 上的方法:设置 rgba。

参数

p &mut RGBA
接收者 &mut RGBA(可变借用)
x int
值(int)
y int
值(int)
c color.RGBA
字节或字符码(color.RGBA)

(RGBA) at_rgba

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

用途

`RGBA` 上的方法:atrgba。

参数

p RGBA
接收者 RGBA(值接收者)
x int
值(int)
y int
值(int)

返回

color.RGBA — 该类型的值