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
6mod alpha_type;
7mod annotation;
8mod bbh_factory;
9mod bitmap;
10mod blend_mode;
11mod blender;
12mod blur_types;
13pub mod canvas;
14mod clip_op;
15mod color;
16pub mod color_filter;
17mod color_space;
18mod color_table;
19mod color_type;
20pub mod contour_measure;
21mod coverage_mode;
22mod cubic_map;
23mod data;
24mod data_table;
25pub mod document;
26pub mod drawable;
27mod flattenable;
28pub mod font;
29pub mod font_arguments;
30pub mod font_metrics;
31mod font_mgr;
32pub mod font_parameters;
33pub mod font_style;
34mod font_types;
35pub mod graphics;
36pub mod image;
37pub mod image_filter;
38mod image_generator;
39mod image_info;
40mod m44;
41mod mask_filter;
42pub mod matrix;
43mod mesh;
44mod milestone;
45pub mod paint;
46pub mod path;
47mod path_builder;
48pub mod path_effect;
49pub mod path_measure;
50pub mod path_types;
51pub mod path_utils;
52mod picture;
53pub mod picture_recorder;
54mod pixel_ref;
55mod pixmap;
56mod point;
57mod point3;
58mod raster_handle_allocator;
59mod rect;
60pub mod region;
61pub mod rrect;
62mod rsxform;
63pub mod sampling_options;
64mod scalar_;
65pub mod shader;
66mod size;
67pub mod stroke_rec;
68pub mod surface;
69mod surface_props;
70mod swizzle;
71mod text_blob;
72mod texture_compression_type;
73mod tile_mode;
74pub mod tiled_image_utils;
75mod time;
76mod trace_memory_dump;
77pub mod typeface;
78mod types;
79mod un_pre_multiply;
80pub mod vertices;
81pub mod yuva_info;
82pub mod yuva_pixmaps;
83
84pub use alpha_type::*;
85pub use annotation::annotate;
86pub use bbh_factory::*;
87pub use bitmap::*;
88pub use blend_mode::*;
89pub use blender::*;
90pub use blur_types::*;
91pub use canvas::{AutoCanvasRestore, Canvas, OwnedCanvas};
92pub use clip_op::*;
93pub use color::*;
94pub use color_filter::{color_filters, ColorFilter};
95pub use color_space::*;
96pub use color_table::*;
97pub use color_type::*;
98pub use contour_measure::{ContourMeasure, ContourMeasureIter};
99pub use coverage_mode::*;
100pub use cubic_map::*;
101pub use data::*;
102pub use data_table::*;
103pub use document::Document;
104pub use drawable::Drawable;
105pub use flattenable::*;
106pub use font::Font;
107pub use font_arguments::FontArguments;
108pub use font_metrics::FontMetrics;
109pub use font_mgr::*;
110pub use font_style::FontStyle;
111pub use font_types::*;
112pub use image::{images, Image};
113pub use image_filter::ImageFilter;
114pub use image_generator::*;
115pub use image_info::*;
116pub use m44::*;
117pub use mask_filter::*;
118pub use matrix::Matrix;
119pub use milestone::*;
120pub use paint::Paint;
121pub use tile_mode::*;
122// We keep these around for the time being.
123pub use paint::Cap as PaintCap;
124pub use paint::Join as PaintJoin;
125pub use paint::Style as PaintStyle;
126pub use path::Path;
127pub use path_builder::PathBuilder;
128pub use path_effect::PathEffect;
129pub use path_measure::PathMeasure;
130pub use path_types::*;
131pub use picture::*;
132pub use picture_recorder::PictureRecorder;
133pub use pixel_ref::*;
134pub use pixmap::*;
135pub use point::*;
136pub use point3::*;
137#[allow(unused)]
138pub use raster_handle_allocator::*;
139pub use rect::*;
140pub use region::Region;
141pub use rrect::RRect;
142pub use rsxform::*;
143#[allow(deprecated)]
144pub use sampling_options::{
145 CubicResampler, FilterMode, FilterOptions, MipmapMode, SamplingMode, SamplingOptions,
146};
147pub use scalar_::*;
148pub use shader::Shader;
149pub use size::*;
150pub use stroke_rec::StrokeRec;
151pub use surface::{surfaces, Surface};
152pub use surface_props::*;
153pub use swizzle::*;
154pub use text_blob::*;
155pub use texture_compression_type::*;
156pub use time::*;
157#[allow(unused)]
158pub use trace_memory_dump::*;
159pub use typeface::Typeface;
160pub use types::*;
161#[allow(unused)]
162pub use un_pre_multiply::*;
163pub use vertices::Vertices;
164pub use yuva_info::YUVAInfo;
165pub use yuva_pixmaps::{yuva_pixmap_info, YUVAPixmapInfo, YUVAPixmaps};
166
167//
168// Skia specific traits used for overloading functions.
169//
170
171pub trait Contains<T> {
172 fn contains(&self, other: T) -> bool;
173}
174
175pub trait QuickReject<T> {
176 fn quick_reject(&self, other: &T) -> bool;
177}
178
179pub 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