struct Point
pub struct Point {
pub x int
pub y int
}用途
二维平面几何坐标点 (x, y)。
公开字段
xint- 值
yint- 值
#imagePoint / Rectangle / RGBA 像素缓冲。
struct Pointpub struct Point {
pub x int
pub y int
}二维平面几何坐标点 (x, y)。
x inty intstruct Rectanglepub struct Rectangle {
pub min Point
pub max Point
}轴对齐二维矩形区域,由左上/最小坐标 min 与右下/最大坐标 max 界定。
min Pointmax Pointstruct RGBApub struct RGBA {
pub pix []int
pub stride int
pub rect Rectangle
}基于连续内存的 32 位 RGBA 像素图像缓冲区。
pix []intstride intrect Rectanglestruct RGBA8pub struct RGBA8 {
pub pix []u8
pub stride int
pub rect Rectangle
}承载 pix、stride、rect 等属性的结构体。
pix []u8stride intrect Rectanglestruct RGB24pub struct RGB24 {
pub pix []u8
pub stride int
pub rect Rectangle
}承载 pix、stride、rect 等属性的结构体。
pix []u8stride intrect Rectanglestruct Gray8pub struct Gray8 {
pub pix []u8
pub stride int
pub rect Rectangle
}承载 pix、stride、rect 等属性的结构体。
pix []u8stride intrect Rectangleptpub fn pt(x int, y int) Point使用给定的水平与垂直坐标构造二维点 Point{x, y}。
x inty intPoint 结构体实例
rectpub fn rect(x0 int, y0 int, x1 int, y1 int) Rectangle使用给定的左上角 (x0, y0) 与右下角 (x1, y1) 坐标构造矩形 Rectangle。
x0 inty0 intx1 inty1 intRectangle 结构体实例
(Point) addpub fn (p Point) add(q Point) PointPoint 上的操作:相加。
p PointPoint 实例;按值接收。q PointPoint — 该类型的值
(Point) subpub fn (p Point) sub(q Point) PointPoint 上的操作:相减。
p PointPoint 实例;按值接收。q PointPoint — 该类型的值
(Point) eqpub fn (p Point) eq(q Point) bool判断当前对象与另一同类型对象是否完全相等。
p PointPoint 实例;按值接收。q Pointbool — 是否成立
(Point) in_rectpub fn (p Point) in_rect(r Rectangle) bool判断当前点坐标是否落在给定的矩形内部。
p PointPoint 实例;按值接收。r Rectanglebool — 是否成立
(Rectangle) dxpub fn (r Rectangle) dx() int计算并返回矩形的水平跨度/宽度(max.x - min.x)。
r RectangleRectangle 实例;按值接收。int — 该类型的值
(Rectangle) dypub fn (r Rectangle) dy() int计算并返回矩形的垂直跨度/高度(max.y - min.y)。
r RectangleRectangle 实例;按值接收。int — 该类型的值
(Rectangle) emptypub fn (r Rectangle) empty() bool判断几何区域是否为空(dx <= 0 或 dy <= 0)。
r RectangleRectangle 实例;按值接收。bool — 是否成立
(Rectangle) eqpub fn (r Rectangle) eq(s Rectangle) bool判断当前对象与另一同类型对象是否完全相等。
r RectangleRectangle 实例;按值接收。s Rectanglebool — 是否成立
(Rectangle) overlapspub fn (r Rectangle) overlaps(s Rectangle) bool判断当前矩形与另一矩形是否存在重叠相交区域。
r RectangleRectangle 实例;按值接收。s Rectanglebool — 是否成立
(Rectangle) addpub fn (r Rectangle) add(p Point) RectangleRectangle 上的操作:相加。
r RectangleRectangle 实例;按值接收。p PointRectangle — 该类型的值
(Rectangle) intersectpub fn (r Rectangle) intersect(s Rectangle) Rectangle计算两矩形的交集区域;若无交集则返回空矩形。
r RectangleRectangle 实例;按值接收。s RectangleRectangle — 该类型的值
(Rectangle) unionpub fn (r Rectangle) union(s Rectangle) Rectangle计算包含两个矩形的最小外接并集矩形。
r RectangleRectangle 实例;按值接收。s RectangleRectangle — 该类型的值
(Rectangle) canonpub fn (r Rectangle) canon() Rectangle规范化矩形坐标,确保 min 在 max 的左上方。
r RectangleRectangle 实例;按值接收。Rectangle — 该类型的值
new_rgbapub fn new_rgba(r Rectangle) RGBA构造 rgba。
r RectangleRGBA — 该类型的值
(RGBA) pix_offsetpub fn (p RGBA) pix_offset(x int, y int) intRGBA 上的操作:执行 pix offset 操作。
p RGBARGBA 实例;按值接收。x inty intint — 该类型的值
($&RGBA) set_rgbapub fn (p $&RGBA) set_rgba(x int, y int, c color.RGBA)$&RGBA 上的操作:设置 rgba。
p $&RGBARGBA 实例;以独占借用传入,方法可修改它,调用方仍持有实例。x inty intc color.RGBA不返回值。
(RGBA) at_rgbapub fn (p RGBA) at_rgba(x int, y int) color.RGBARGBA 上的操作:执行 at rgba 操作。
p RGBARGBA 实例;按值接收。x inty intcolor.RGBA — 该类型的值
new_rgba8pub fn new_rgba8(r Rectangle) RGBA8构造 rgba8。
r RectangleRGBA8 — 该类型的值
new_rgb24pub fn new_rgb24(r Rectangle) RGB24构造 rgb24。
r RectangleRGB24 — 该类型的值
new_gray8pub fn new_gray8(r Rectangle) Gray8构造 gray8。
r RectangleGray8 — 该类型的值
(&RGBA8) pix_offsetpub fn (p &RGBA8) pix_offset(x int, y int) int&RGBA8 上的操作:执行 pix offset 操作。
p &RGBA8RGBA8 实例;以只读借用传入,调用方仍持有实例。x inty intint — 该类型的值
($&RGBA8) set_rgbapub fn (p $&RGBA8) set_rgba(x int, y int, c color.RGBA)$&RGBA8 上的操作:设置 rgba。
p $&RGBA8RGBA8 实例;以独占借用传入,方法可修改它,调用方仍持有实例。x inty intc color.RGBA不返回值。
($&RGBA8) set_rgba_u8pub fn (p $&RGBA8) set_rgba_u8(x int, y int, r u8, g u8, b u8, a u8)$&RGBA8 上的操作:设置 rgba u8。
p $&RGBA8RGBA8 实例;以独占借用传入,方法可修改它,调用方仍持有实例。x inty intr u8g u8b u8a u8不返回值。
(&RGBA8) at_rgbapub fn (p &RGBA8) at_rgba(x int, y int) color.RGBA&RGBA8 上的操作:执行 at rgba 操作。
p &RGBA8RGBA8 实例;以只读借用传入,调用方仍持有实例。x inty intcolor.RGBA — 该类型的值
($&RGBA8) fill_rgbapub fn (p $&RGBA8) fill_rgba(r u8, g u8, b u8, a u8)$&RGBA8 上的操作:执行 fill rgba 操作。
p $&RGBA8RGBA8 实例;以独占借用传入,方法可修改它,调用方仍持有实例。r u8g u8b u8a u8不返回值。
(&RGBA8) to_rgbapub fn (p &RGBA8) to_rgba() RGBA&RGBA8 上的操作:转换为 rgba。
p &RGBA8RGBA8 实例;以只读借用传入,调用方仍持有实例。RGBA — 该类型的值
rgba8_from_rgbapub fn rgba8_from_rgba(src &RGBA) RGBA8执行 rgba8 from rgba 操作。
src &RGBARGBA8 — 该类型的值
(&RGB24) pix_offsetpub fn (p &RGB24) pix_offset(x int, y int) int&RGB24 上的操作:执行 pix offset 操作。
p &RGB24RGB24 实例;以只读借用传入,调用方仍持有实例。x inty intint — 该类型的值
($&RGB24) set_rgbpub fn (p $&RGB24) set_rgb(x int, y int, r u8, g u8, b u8)$&RGB24 上的操作:设置 rgb。
p $&RGB24RGB24 实例;以独占借用传入,方法可修改它,调用方仍持有实例。x inty intr u8g u8b u8不返回值。
(&RGB24) at_rgbapub fn (p &RGB24) at_rgba(x int, y int) color.RGBA&RGB24 上的操作:执行 at rgba 操作。
p &RGB24RGB24 实例;以只读借用传入,调用方仍持有实例。x inty intcolor.RGBA — 该类型的值
(&Gray8) pix_offsetpub fn (p &Gray8) pix_offset(x int, y int) int&Gray8 上的操作:执行 pix offset 操作。
p &Gray8Gray8 实例;以只读借用传入,调用方仍持有实例。x inty intint — 该类型的值
($&Gray8) set_ypub fn (p $&Gray8) set_y(x int, y int, v u8)$&Gray8 上的操作:设置 y。
p $&Gray8Gray8 实例;以独占借用传入,方法可修改它,调用方仍持有实例。x inty intv u8不返回值。
(&Gray8) at_ypub fn (p &Gray8) at_y(x int, y int) u8&Gray8 上的操作:执行 at y 操作。
p &Gray8Gray8 实例;以只读借用传入,调用方仍持有实例。x inty intu8 — 该类型的值