1mod blend;
4mod canvas;
5mod clip;
6mod command;
7mod context;
8pub mod paint;
9mod stroke;
10
11pub use crate::shape::{Shape, Styled};
12pub use blend::{BlendMode, BlendSpace, FillRule, MaskMode};
13pub use canvas::Canvas;
14pub use clip::{ClipGeometry, ClipMode, PathClip, RectClip, ShapeClip};
15pub use command::DrawCommand;
16pub use context::{DrawContext, Drawable, RenderQuality};
17
18pub use paint::{
19 GradientExtend, GradientSpace, GradientUnits, ImagePattern, LinearGradient, Paint,
20 RadialGradient, SweepGradient,
21};
22pub use stroke::{LineCap, LineJoin, MAX_STROKE_VERBS, StrokeStyle};
23
24use std::sync::Arc;
25
26use crate::validation::ValidationState;
27use crate::{Path2D, Rect, Transform, ValidationError, ValidationLimits};
28
29pub fn validate_rect(bounds: Rect, path: &str, field: &str) -> Result<(), ValidationError> {
31 if !bounds.is_finite()
32 || bounds.right < bounds.left
33 || bounds.bottom < bounds.top
34 || !bounds.width().is_finite()
35 || !bounds.height().is_finite()
36 {
37 return Err(ValidationError::invalid(
38 path,
39 field,
40 "Require finite, noninverted rectangle bounds and finite spans",
41 ));
42 }
43 Ok(())
44}
45
46#[cfg(test)]
47mod tests;