1 | // Unsupported, not used in any public APIs. |
2 | // mod executor; |
3 | // Unsupported, because it's not used in publicly exposed APIs: |
4 | // mod font_lcd_config; |
5 | |
6 | mod alpha_type; |
7 | mod annotation; |
8 | mod bbh_factory; |
9 | mod bitmap; |
10 | mod blend_mode; |
11 | mod blender; |
12 | mod blur_types; |
13 | pub mod canvas; |
14 | mod clip_op; |
15 | mod color; |
16 | pub mod color_filter; |
17 | mod color_space; |
18 | mod color_table; |
19 | mod color_type; |
20 | pub mod contour_measure; |
21 | mod coverage_mode; |
22 | mod cubic_map; |
23 | mod data; |
24 | mod data_table; |
25 | pub mod document; |
26 | pub mod drawable; |
27 | mod flattenable; |
28 | pub mod font; |
29 | pub mod font_arguments; |
30 | pub mod font_metrics; |
31 | mod font_mgr; |
32 | pub mod font_parameters; |
33 | pub mod font_style; |
34 | mod font_types; |
35 | pub mod graphics; |
36 | pub mod image; |
37 | pub mod image_filter; |
38 | mod image_generator; |
39 | mod image_info; |
40 | mod m44; |
41 | mod mask_filter; |
42 | pub mod matrix; |
43 | mod mesh; |
44 | mod milestone; |
45 | pub mod paint; |
46 | pub mod path; |
47 | mod path_builder; |
48 | pub mod path_effect; |
49 | pub mod path_measure; |
50 | pub mod path_types; |
51 | pub mod path_utils; |
52 | mod picture; |
53 | pub mod picture_recorder; |
54 | mod pixel_ref; |
55 | mod pixmap; |
56 | mod point; |
57 | mod point3; |
58 | mod raster_handle_allocator; |
59 | mod rect; |
60 | pub mod region; |
61 | pub mod rrect; |
62 | mod rsxform; |
63 | pub mod sampling_options; |
64 | mod scalar_; |
65 | pub mod shader; |
66 | mod size; |
67 | pub mod stroke_rec; |
68 | pub mod surface; |
69 | mod surface_props; |
70 | mod swizzle; |
71 | mod text_blob; |
72 | mod texture_compression_type; |
73 | mod tile_mode; |
74 | pub mod tiled_image_utils; |
75 | mod time; |
76 | mod trace_memory_dump; |
77 | pub mod typeface; |
78 | mod types; |
79 | mod un_pre_multiply; |
80 | pub mod vertices; |
81 | pub mod yuva_info; |
82 | pub mod yuva_pixmaps; |
83 | |
84 | pub use alpha_type::*; |
85 | pub use annotation::annotate; |
86 | pub use bbh_factory::*; |
87 | pub use bitmap::*; |
88 | pub use blend_mode::*; |
89 | pub use blender::*; |
90 | pub use blur_types::*; |
91 | pub use canvas::{AutoCanvasRestore, Canvas, OwnedCanvas}; |
92 | pub use clip_op::*; |
93 | pub use color::*; |
94 | pub use color_filter::{color_filters, ColorFilter}; |
95 | pub use color_space::*; |
96 | pub use color_table::*; |
97 | pub use color_type::*; |
98 | pub use contour_measure::{ContourMeasure, ContourMeasureIter}; |
99 | pub use coverage_mode::*; |
100 | pub use cubic_map::*; |
101 | pub use data::*; |
102 | pub use data_table::*; |
103 | pub use document::Document; |
104 | pub use drawable::Drawable; |
105 | pub use flattenable::*; |
106 | pub use font::Font; |
107 | pub use font_arguments::FontArguments; |
108 | pub use font_metrics::FontMetrics; |
109 | pub use font_mgr::*; |
110 | pub use font_style::FontStyle; |
111 | pub use font_types::*; |
112 | pub use image::{images, Image}; |
113 | pub use image_filter::ImageFilter; |
114 | pub use image_generator::*; |
115 | pub use image_info::*; |
116 | pub use m44::*; |
117 | pub use mask_filter::*; |
118 | pub use matrix::Matrix; |
119 | pub use milestone::*; |
120 | pub use paint::Paint; |
121 | pub use tile_mode::*; |
122 | // We keep these around for the time being. |
123 | pub use paint::Cap as PaintCap; |
124 | pub use paint::Join as PaintJoin; |
125 | pub use paint::Style as PaintStyle; |
126 | pub use path::Path; |
127 | pub use path_builder::PathBuilder; |
128 | pub use path_effect::PathEffect; |
129 | pub use path_measure::PathMeasure; |
130 | pub use path_types::*; |
131 | pub use picture::*; |
132 | pub use picture_recorder::PictureRecorder; |
133 | pub use pixel_ref::*; |
134 | pub use pixmap::*; |
135 | pub use point::*; |
136 | pub use point3::*; |
137 | #[allow (unused)] |
138 | pub use raster_handle_allocator::*; |
139 | pub use rect::*; |
140 | pub use region::Region; |
141 | pub use rrect::RRect; |
142 | pub use rsxform::*; |
143 | #[allow (deprecated)] |
144 | pub use sampling_options::{ |
145 | CubicResampler, FilterMode, FilterOptions, MipmapMode, SamplingMode, SamplingOptions, |
146 | }; |
147 | pub use scalar_::*; |
148 | pub use shader::Shader; |
149 | pub use size::*; |
150 | pub use stroke_rec::StrokeRec; |
151 | pub use surface::{surfaces, Surface}; |
152 | pub use surface_props::*; |
153 | pub use swizzle::*; |
154 | pub use text_blob::*; |
155 | pub use texture_compression_type::*; |
156 | pub use time::*; |
157 | #[allow (unused)] |
158 | pub use trace_memory_dump::*; |
159 | pub use typeface::Typeface; |
160 | pub use types::*; |
161 | #[allow (unused)] |
162 | pub use un_pre_multiply::*; |
163 | pub use vertices::Vertices; |
164 | pub use yuva_info::YUVAInfo; |
165 | pub use yuva_pixmaps::{yuva_pixmap_info, YUVAPixmapInfo, YUVAPixmaps}; |
166 | |
167 | // |
168 | // Skia specific traits used for overloading functions. |
169 | // |
170 | |
171 | pub trait Contains<T> { |
172 | fn contains(&self, other: T) -> bool; |
173 | } |
174 | |
175 | pub trait QuickReject<T> { |
176 | fn quick_reject(&self, other: &T) -> bool; |
177 | } |
178 | |
179 | pub mod shaders { |
180 | pub use super::shader::shaders::*; |
181 | use crate::{prelude::*, scalar, ISize, Shader}; |
182 | use skia_bindings as sb; |
183 | |
184 | impl Shader { |
185 | pub fn fractal_perlin_noise( |
186 | base_frequency: (scalar, scalar), |
187 | num_octaves: usize, |
188 | seed: scalar, |
189 | tile_size: impl Into<Option<ISize>>, |
190 | ) -> Option<Self> { |
191 | fractal_noise(base_frequency, num_octaves, seed, tile_size) |
192 | } |
193 | |
194 | pub fn turbulence_perlin_noise( |
195 | base_frequency: (scalar, scalar), |
196 | num_octaves: usize, |
197 | seed: scalar, |
198 | tile_size: impl Into<Option<ISize>>, |
199 | ) -> Option<Self> { |
200 | turbulence(base_frequency, num_octaves, seed, tile_size) |
201 | } |
202 | } |
203 | |
204 | pub fn fractal_noise( |
205 | base_frequency: (scalar, scalar), |
206 | num_octaves: usize, |
207 | seed: scalar, |
208 | tile_size: impl Into<Option<ISize>>, |
209 | ) -> Option<Shader> { |
210 | Shader::from_ptr(unsafe { |
211 | sb::C_SkShaders_MakeFractalNoise( |
212 | base_frequency.0, |
213 | base_frequency.1, |
214 | num_octaves.try_into().unwrap(), |
215 | seed, |
216 | tile_size.into().native().as_ptr_or_null(), |
217 | ) |
218 | }) |
219 | } |
220 | |
221 | pub fn turbulence( |
222 | base_frequency: (scalar, scalar), |
223 | num_octaves: usize, |
224 | seed: scalar, |
225 | tile_size: impl Into<Option<ISize>>, |
226 | ) -> Option<Shader> { |
227 | Shader::from_ptr(unsafe { |
228 | sb::C_SkShaders_MakeTurbulence( |
229 | base_frequency.0, |
230 | base_frequency.1, |
231 | num_octaves.try_into().unwrap(), |
232 | seed, |
233 | tile_size.into().native().as_ptr_or_null(), |
234 | ) |
235 | }) |
236 | } |
237 | } |
238 | |