1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gx: add missing documentation or update existing ones for public functions (#17094)

This commit is contained in:
Nahua 2023-01-24 01:02:07 +01:00 committed by GitHub
parent 8b6fceb0a3
commit da3ad2dca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -223,7 +223,7 @@ pub fn (c Color) / (c2 Color) Color {
} }
} }
// over - implements an `a` over `b` operation. // over implements an `a` over `b` operation.
// see https://keithp.com/~keithp/porterduff/p253-porter.pdf // see https://keithp.com/~keithp/porterduff/p253-porter.pdf
pub fn (a Color) over(b Color) Color { pub fn (a Color) over(b Color) Color {
aa := f32(a.a) / 255 aa := f32(a.a) / 255
@ -251,21 +251,21 @@ pub fn (c Color) str() string {
return 'Color{${c.r}, ${c.g}, ${c.b}, ${c.a}}' return 'Color{${c.r}, ${c.g}, ${c.b}, ${c.a}}'
} }
// rgba8 - convert a color value to an int in the RGBA8 order. // rgba8 converts a color value to an int in the RGBA8 order.
// see https://developer.apple.com/documentation/coreimage/ciformat // see https://developer.apple.com/documentation/coreimage/ciformat
[inline] [inline]
pub fn (c Color) rgba8() int { pub fn (c Color) rgba8() int {
return int(u32(c.r) << 24 | u32(c.g) << 16 | u32(c.b) << 8 | u32(c.a)) return int(u32(c.r) << 24 | u32(c.g) << 16 | u32(c.b) << 8 | u32(c.a))
} }
// bgra8 - convert a color value to an int in the BGRA8 order. // bgra8 converts a color value to an int in the BGRA8 order.
// see https://developer.apple.com/documentation/coreimage/ciformat // see https://developer.apple.com/documentation/coreimage/ciformat
[inline] [inline]
pub fn (c Color) bgra8() int { pub fn (c Color) bgra8() int {
return int(u32(c.b) << 24 | u32(c.g) << 16 | u32(c.r) << 8 | u32(c.a)) return int(u32(c.b) << 24 | u32(c.g) << 16 | u32(c.r) << 8 | u32(c.a))
} }
// abgr8 - convert a color value to an int in the ABGR8 order. // abgr8 converts a color value to an int in the ABGR8 order.
// see https://developer.apple.com/documentation/coreimage/ciformat // see https://developer.apple.com/documentation/coreimage/ciformat
[inline] [inline]
pub fn (c Color) abgr8() int { pub fn (c Color) abgr8() int {

View File

@ -9,6 +9,7 @@ pub:
height int height int
} }
// is_empty returns true if the Image `i` is empty.
pub fn (i Image) is_empty() bool { pub fn (i Image) is_empty() bool {
return i.obj == unsafe { nil } return i.obj == unsafe { nil }
} }

View File

@ -20,6 +20,8 @@ pub:
italic bool italic bool
} }
// to_css_string returns a CSS compatible string of the TextCfg `cfg`.
// For example: `'mono 14px serif'`.
pub fn (cfg TextCfg) to_css_string() string { pub fn (cfg TextCfg) to_css_string() string {
mut font_style := '' mut font_style := ''
if cfg.bold { if cfg.bold {