XU XUv0.8.8
中文

API

#image/color

import: #image/color

counts: 8 fns, 5 methods, 7 types, 0 consts, 0 ifaces

Color types and channel conversion.

struct RGBA

XuAPI
pub struct RGBA {
    pub r int
    pub g int
    pub b int
    pub a int
}

Purpose

Color conversions aligned with `image/color` (RGBA/NRGBA/Gray/Alpha + RGB↔YCbCr / RGB↔CMYK). No Color interface: each type has rgba returning 16-bit alpha-premultiplied channels in RGBA16.

Parameters

r int
rune (Unicode code point)
g int
field (int)
b int
field (int)
a int
field (int)

struct NRGBA

XuAPI
pub struct NRGBA {
    pub r int
    pub g int
    pub b int
    pub a int
}

Purpose

Public struct `NRGBA`.

Parameters

r int
rune (Unicode code point)
g int
field (int)
b int
field (int)
a int
field (int)

struct Gray

XuAPI
pub struct Gray {
    pub y int
}

Purpose

Public struct `Gray`.

Parameters

y int
value

struct Alpha

XuAPI
pub struct Alpha {
    pub a int
}

Purpose

Public struct `Alpha`.

Parameters

a int
field (int)

struct YCbCr

XuAPI
pub struct YCbCr {
    pub y int
    pub cb int
    pub cr int
}

Purpose

Public struct `YCbCr`.

Parameters

y int
value
cb int
field (int)
cr int
field (int)

struct CMYK

XuAPI
pub struct CMYK {
    pub c int
    pub m int
    pub y int
    pub k int
}

Purpose

Public struct `CMYK`.

Parameters

c int
byte or character code
m int
field (int)
y int
value
k int
key or index

struct RGBA16

XuAPI
pub struct RGBA16 {
    pub r int
    pub g int
    pub b int
    pub a int
}

Purpose

Public struct `RGBA16`.

Parameters

r int
rune (Unicode code point)
g int
field (int)
b int
field (int)
a int
field (int)

rgba8

XuAPI
pub fn rgba8(r int, g int, b int, a int) RGBA

Purpose

rgba8; returns RGBA.

Parameters

r int
rune (Unicode code point) (int)
g int
g (int)
b int
b (int)
a int
value (int)

Returns

RGBA — a value of this type

nrgba8

XuAPI
pub fn nrgba8(r int, g int, b int, a int) NRGBA

Purpose

nrgba8; returns NRGBA.

Parameters

r int
rune (Unicode code point) (int)
g int
g (int)
b int
b (int)
a int
value (int)

Returns

NRGBA — a value of this type

gray8

XuAPI
pub fn gray8(y int) Gray

Purpose

gray8; returns Gray.

Parameters

y int
value (int)

Returns

Gray — a value of this type

alpha8

XuAPI
pub fn alpha8(a int) Alpha

Purpose

alpha8; returns Alpha.

Parameters

a int
value (int)

Returns

Alpha — a value of this type

(RGBA) rgba

XuAPI
pub fn (c RGBA) rgba() RGBA16

Purpose

Call `rgba` on `RGBA`.

Parameters

c RGBA
receiver RGBA (value receiver)

Returns

RGBA16 — a value of this type

(NRGBA) rgba

XuAPI
pub fn (c NRGBA) rgba() RGBA16

Purpose

Call `rgba` on `NRGBA`.

Parameters

c NRGBA
receiver NRGBA (value receiver)

Returns

RGBA16 — a value of this type

(Gray) rgba

XuAPI
pub fn (c Gray) rgba() RGBA16

Purpose

Call `rgba` on `Gray`.

Parameters

c Gray
receiver Gray (value receiver)

Returns

RGBA16 — a value of this type

(Alpha) rgba

XuAPI
pub fn (c Alpha) rgba() RGBA16

Purpose

Call `rgba` on `Alpha`.

Parameters

c Alpha
receiver Alpha (value receiver)

Returns

RGBA16 — a value of this type

rgb_to_ycbcr

XuAPI
pub fn rgb_to_ycbcr(r int, g int, b int) YCbCr

Purpose

Rgb to ycbcr.

Parameters

r int
rune (Unicode code point) (int)
g int
g (int)
b int
b (int)

Returns

YCbCr — a value of this type

ycbcr_to_rgb

XuAPI
pub fn ycbcr_to_rgb(y int, cb int, cr int) RGBA

Purpose

Ycbcr to rgb.

Parameters

y int
value (int)
cb int
cb (int)
cr int
cr (int)

Returns

RGBA — a value of this type

rgb_to_cmyk

XuAPI
pub fn rgb_to_cmyk(r int, g int, b int) CMYK

Purpose

Rgb to cmyk.

Parameters

r int
rune (Unicode code point) (int)
g int
g (int)
b int
b (int)

Returns

CMYK — a value of this type

cmyk_to_rgb

XuAPI
pub fn cmyk_to_rgb(c int, m int, y int, k int) RGBA

Purpose

Cmyk to rgb.

Parameters

c int
byte or character code (int)
m int
m (int)
y int
value (int)
k int
key or index (int)

Returns

RGBA — a value of this type

(CMYK) rgba

XuAPI
pub fn (c CMYK) rgba() RGBA16

Purpose

Call `rgba` on `CMYK`.

Parameters

c CMYK
receiver CMYK (value receiver)

Returns

RGBA16 — a value of this type