Debian Codegraph @

src/color2.rs

raw symbols SCIP
1 // Color deprecated methods
2
3 use craterust-analyzer cargo csscolorparser 0.8.3 crate/::Colorrust-analyzer cargo csscolorparser 0.8.3 color/Color#;
4
5 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
6
7 #[cfg(not(feature = "std"))]
8 use num_traitsrust-analyzer cargo num-traits 0.2.19 crate/::floatrust-analyzer cargo num-traits 0.2.19 float/::Floatrust-analyzer cargo num-traits 0.2.19 float/Float#;
9
10 impl Colorrust-analyzer cargo csscolorparser 0.8.3 color/Color# {
11 #[deprecated = "Use [new](#method.new) instead."]
12 /// Arguments:
13 ///
14 /// * `r`: Red value [0..1]
15 /// * `g`: Green value [0..1]
16 /// * `b`: Blue value [0..1]
17 pub fn from_rgbrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_rgb().(r: f32, g: f32, b: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
18 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] { rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r., grust-analyzer cargo csscolorparser 0.8.3 color/Color#g., brust-analyzer cargo csscolorparser 0.8.3 color/Color#b., arust-analyzer cargo csscolorparser 0.8.3 color/Color#a.: 1.0 }
19 }
20
21 #[deprecated = "Use [new](#method.new) instead."]
22 /// Arguments:
23 ///
24 /// * `r`: Red value [0..1]
25 /// * `g`: Green value [0..1]
26 /// * `b`: Blue value [0..1]
27 /// * `a`: Alpha value [0..1]
28 pub fn from_rgbarust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_rgba().(r: f32, g: f32, b: f32, a: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
29 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] { rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r., grust-analyzer cargo csscolorparser 0.8.3 color/Color#g., brust-analyzer cargo csscolorparser 0.8.3 color/Color#b., arust-analyzer cargo csscolorparser 0.8.3 color/Color#a. }
30 }
31
32 #[deprecated = "Use [from_rgba8](#method.from_rgba8) instead."]
33 /// Arguments:
34 ///
35 /// * `r`: Red value [0..255]
36 /// * `g`: Green value [0..255]
37 /// * `b`: Blue value [0..255]
38 pub fn from_rgb_u8rust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_rgb_u8().(r: u8, g: u8, b: u8) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
39 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
40 rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r.: r as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
41 grust-analyzer cargo csscolorparser 0.8.3 color/Color#g.: g as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
42 brust-analyzer cargo csscolorparser 0.8.3 color/Color#b.: b as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
43 arust-analyzer cargo csscolorparser 0.8.3 color/Color#a.: 1.0,
44 }
45 }
46
47 #[deprecated = "Use [from_rgba8](#method.from_rgba8) instead."]
48 /// Arguments:
49 ///
50 /// * `r`: Red value [0..255]
51 /// * `g`: Green value [0..255]
52 /// * `b`: Blue value [0..255]
53 /// * `a`: Alpha value [0..255]
54 pub fn from_rgba_u8rust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_rgba_u8().(r: u8, g: u8, b: u8, a: u8) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
55 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
56 rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r.: r as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
57 grust-analyzer cargo csscolorparser 0.8.3 color/Color#g.: g as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
58 brust-analyzer cargo csscolorparser 0.8.3 color/Color#b.: b as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
59 arust-analyzer cargo csscolorparser 0.8.3 color/Color#a.: a as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
60 }
61 }
62
63 #[deprecated = "Use [from_linear_rgba](#method.from_linear_rgba) instead."]
64 /// Arguments:
65 ///
66 /// * `r`: Red value [0..1]
67 /// * `g`: Green value [0..1]
68 /// * `b`: Blue value [0..1]
69 pub fn from_linear_rgbrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_linear_rgb().(r: f32, g: f32, b: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
70 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_linear_rgbarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_linear_rgba().(r, g, b, 1.0)
71 }
72
73 #[deprecated = "Use [from_linear_rgba8](#method.from_linear_rgba8) instead."]
74 /// Arguments:
75 ///
76 /// * `r`: Red value [0..255]
77 /// * `g`: Green value [0..255]
78 /// * `b`: Blue value [0..255]
79 pub fn from_linear_rgb_u8rust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_linear_rgb_u8().(r: u8, g: u8, b: u8) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
80 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_linear_rgbarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_linear_rgba().(r as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0, g as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0, b as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0, 1.0)
81 }
82
83 #[deprecated = "Use [from_linear_rgba8](#method.from_linear_rgba8) instead."]
84 /// Arguments:
85 ///
86 /// * `r`: Red value [0..255]
87 /// * `g`: Green value [0..255]
88 /// * `b`: Blue value [0..255]
89 /// * `a`: Alpha value [0..255]
90 pub fn from_linear_rgba_u8rust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_linear_rgba_u8().(r: u8, g: u8, b: u8, a: u8) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
91 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_linear_rgbarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_linear_rgba().(
92 r as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
93 g as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
94 b as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
95 a as f32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().255.0,
96 )
97 }
98
99 #[deprecated = "Use [from_hsva](#method.from_hsva) instead."]
100 /// Arguments:
101 ///
102 /// * `h`: Hue angle [0..360]
103 /// * `s`: Saturation [0..1]
104 /// * `v`: Value [0..1]
105 pub fn from_hsvrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_hsv().(h: f32, s: f32, v: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
106 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_hsvarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_hsva().(h, s, v, 1.0)
107 }
108
109 #[deprecated = "Use [from_hsla](#method.from_hsla) instead."]
110 /// Arguments:
111 ///
112 /// * `h`: Hue angle [0..360]
113 /// * `s`: Saturation [0..1]
114 /// * `l`: Lightness [0..1]
115 pub fn from_hslrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_hsl().(h: f32, s: f32, l: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
116 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_hslarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_hsla().(h, s, l, 1.0)
117 }
118
119 #[deprecated = "Use [from_hwba](#method.from_hwba) instead."]
120 /// Arguments:
121 ///
122 /// * `h`: Hue angle [0..360]
123 /// * `w`: Whiteness [0..1]
124 /// * `b`: Blackness [0..1]
125 pub fn from_hwbrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_hwb().(h: f32, w: f32, b: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
126 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_hwbarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_hwba().(h, w, b, 1.0)
127 }
128
129 #[deprecated = "Use [from_oklaba](#method.from_oklaba) instead."]
130 /// Arguments:
131 ///
132 /// * `l`: Perceived lightness
133 /// * `a`: How green/red the color is
134 /// * `b`: How blue/yellow the color is
135 pub fn from_oklabrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_oklab().(l: f32, a: f32, b: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
136 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_oklabarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_oklaba().(l, a, b, 1.0)
137 }
138
139 #[deprecated = "Use [from_laba](#method.from_laba) instead."]
140 /// Arguments:
141 ///
142 /// * `l`: Lightness
143 /// * `a`: Distance along the `a` axis
144 /// * `b`: Distance along the `b` axis
145 /// * `alpha`: Alpha [0..1]
146 pub fn from_labrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_lab().(l: f32, a: f32, b: f32, alpha: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
147 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_labarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_laba().(l, a, b, alpha)
148 }
149
150 #[deprecated = "Use [to_laba](#method.to_laba) instead."]
151 /// Returns: `[l, a, b, alpha]`
152 pub fn to_labrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]to_lab().(&self) -> [f32; 4] {
153 self.to_labarust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]to_laba().()
154 }
155
156 #[deprecated = "Use [from_lcha](#method.from_lcha) instead."]
157 /// Arguments:
158 ///
159 /// * `l`: Lightness
160 /// * `c`: Chroma
161 /// * `h`: Hue angle in radians
162 /// * `alpha`: Alpha [0..1]
163 pub fn from_lchrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]from_lch().(l: f32, c: f32, h: f32, alpha: f32) -> Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color] {
164 Selfrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]::from_lcharust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]from_lcha().(l, c, h, alpha)
165 }
166
167 #[deprecated = "Use [to_lcha](#method.to_lcha) instead."]
168 /// Returns: `[l, c, h, alpha]`
169 pub fn to_lchrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]to_lch().(&self) -> [f32; 4] {
170 self.to_lcharust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]to_lcha().()
171 }
172
173 #[deprecated]
174 /// Returns: `(r, g, b, a)`
175 ///
176 /// * Red, green, blue and alpha in the range [0..1]
177 pub fn rgbarust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]rgba().(&self) -> (f32, f32, f32, f32) {
178 (self.rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r., self.grust-analyzer cargo csscolorparser 0.8.3 color/Color#g., self.brust-analyzer cargo csscolorparser 0.8.3 color/Color#b., self.arust-analyzer cargo csscolorparser 0.8.3 color/Color#a.)
179 }
180
181 #[deprecated = "Use [to_rgba8](#method.to_rgba8) instead."]
182 /// Returns: `(r, g, b, a)`
183 ///
184 /// * Red, green, blue and alpha in the range [0..255]
185 pub fn rgba_u8rust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]rgba_u8().(&self) -> (u8, u8, u8, u8) {
186 (
187 (self.rrust-analyzer cargo csscolorparser 0.8.3 color/Color#r. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().255.0).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]round().() as u8,
188 (self.grust-analyzer cargo csscolorparser 0.8.3 color/Color#g. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().255.0).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]round().() as u8,
189 (self.brust-analyzer cargo csscolorparser 0.8.3 color/Color#b. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().255.0).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]round().() as u8,
190 (self.arust-analyzer cargo csscolorparser 0.8.3 color/Color#a. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().255.0).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]round().() as u8,
191 )
192 }
193
194 // --- Since version 0.7.2
195
196 #[deprecated = "Use [to_css_hex](#method.to_css_hex) instead."]
197 /// Get the RGB hexadecimal color string.
198 pub fn to_hex_stringrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]to_hex_string().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
199 self.to_css_hexrust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]to_css_hex().()
200 }
201
202 #[deprecated = "Use [to_css_rgb](#method.to_css_rgb) instead."]
203 /// Get the CSS `rgb()` format string.
204 pub fn to_rgb_stringrust-analyzer cargo csscolorparser 0.8.3 color2/impl#[Color]to_rgb_string().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
205 self.to_css_rgbrust-analyzer cargo csscolorparser 0.8.3 color/impl#[Color]to_css_rgb().()
206 }
207 }