From da3ad2dca681c363317b2704cfdfddf4852a3d79 Mon Sep 17 00:00:00 2001 From: Nahua Date: Tue, 24 Jan 2023 01:02:07 +0100 Subject: [PATCH] gx: add missing documentation or update existing ones for public functions (#17094) --- vlib/gx/color.v | 8 ++++---- vlib/gx/image.v | 1 + vlib/gx/text.v | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/vlib/gx/color.v b/vlib/gx/color.v index 783fa5c50..57bc96a3f 100644 --- a/vlib/gx/color.v +++ b/vlib/gx/color.v @@ -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 pub fn (a Color) over(b Color) Color { 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}}' } -// 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 [inline] pub fn (c Color) rgba8() int { 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 [inline] pub fn (c Color) bgra8() int { 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 [inline] pub fn (c Color) abgr8() int { diff --git a/vlib/gx/image.v b/vlib/gx/image.v index 890e516a0..e61905267 100644 --- a/vlib/gx/image.v +++ b/vlib/gx/image.v @@ -9,6 +9,7 @@ pub: height int } +// is_empty returns true if the Image `i` is empty. pub fn (i Image) is_empty() bool { return i.obj == unsafe { nil } } diff --git a/vlib/gx/text.v b/vlib/gx/text.v index f32d28d8d..df385be58 100644 --- a/vlib/gx/text.v +++ b/vlib/gx/text.v @@ -20,6 +20,8 @@ pub: 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 { mut font_style := '' if cfg.bold { -- 2.30.2