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