mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 04:07:12 -06:00
Make renderer and SVG module dependencies explicit
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Affine, Arc, BezPath, Ink, Node, Pixmap, Shape, images, ink, paint};
|
||||
|
||||
/// `key`'s pixels in the shared image store; `touch` marks them used.
|
||||
pub(crate) fn lookup(key: &images::ImageKey, touch: bool) -> Option<Arc<Pixmap>> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{BezPath, Document, FillRule, Node, NodeKind, Rect, SymbolBoxes, brush_fx, fx};
|
||||
|
||||
/// Bounds of everything `n` paints, as the renderer culls it: its members, strokes, brush art and
|
||||
/// geometry effects, and the shadows and glows of it and its members. Symbol instances are
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::options::{AntiAlias, RenderOptions};
|
||||
use super::threads::single_threaded_context;
|
||||
use super::*;
|
||||
use super::{Affine, Arc, BezPath, Document, FillRule, HashMap, Ink, Node, Rect, RenderContext, SymbolBoxes, TextObject, live};
|
||||
|
||||
/// Hasher for pointer-keyed caches: a multiply-xorshift (SipHash showed up in frame profiles).
|
||||
#[derive(Default, Clone, Copy)]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::predicates::{has_fx, has_object_fx};
|
||||
use super::raster::doc_raster_ppi;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, Document, Effect, FillRule, GeomContext, Node, NodeKind, Rect, Renderer, Shape, SymbolBoxes, effects,
|
||||
};
|
||||
|
||||
fn node_bezpath(n: &Node) -> Option<BezPath> {
|
||||
match &n.kind {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use super::raster::ViewCrop;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, Channels, Cms, DefaultHasher, FillRule, Hash, Hasher, Node, NodeId, NodeKind, PathEl, Point, RasterFx,
|
||||
Rect, Size, Weak, effects,
|
||||
};
|
||||
|
||||
/// What [`Renderer::raster_fx`] paints effects around.
|
||||
pub(super) struct Content<'a> {
|
||||
|
||||
@@ -6,7 +6,10 @@ use super::raster::{
|
||||
DRAG_PIXEL_BUDGET, PIXEL_BUDGET, PixelEntry, ViewCrop, content_changing, doc_raster_ppi, drag_scale, draw_placed, draw_scaled, filter_region,
|
||||
filter_region_within, hard_edged, image_size, linear_key, looks_around, pan_margin,
|
||||
};
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, Channels, DefaultHasher, Document, FillRule, Frame, GeomContext, Hash, Hasher, Ink, Node, PixelFx,
|
||||
RasterFx, Rect, RenderContext, Renderer, Shape, blend_mode, effects, fill_rule, paint, peniko,
|
||||
};
|
||||
|
||||
impl Renderer {
|
||||
/// Paint `content` through the content-changing effects of `rfx` (Gaussian Blur, Feather, the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::bounds::drawn_bounds;
|
||||
use super::*;
|
||||
use super::{Affine, AppearanceItem, Effect, Frame, Node, NodeKind, RasterFx, Rect, SymbolBoxes, Vec2, effects};
|
||||
|
||||
fn visible(effects: &[Effect]) -> bool {
|
||||
effects.iter().any(|e| e.visible)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::entries::{Drawn, Inputs, Made, raster_bytes};
|
||||
use super::*;
|
||||
use super::{Affine, Document, EdgeMode, Filter, FilterPrimitive, Ink, RasterFx, Rect, RenderContext, Vec2, effects, peniko};
|
||||
|
||||
pub(super) fn shadow_filter(dx: f64, dy: f64, blur: f64, color: peniko::Color) -> Filter {
|
||||
Filter::from_primitive(FilterPrimitive::DropShadowOnly {
|
||||
|
||||
@@ -5,7 +5,10 @@ use super::raster::{
|
||||
DRAG_PIXEL_BUDGET, MAX_RASTERIZE, PIXEL_BUDGET, ViewCrop, content_changing, doc_raster_ppi, image_size, linear_key, pan_margin, pcolor, shade,
|
||||
shade_filter, shadow_filter, silhouette,
|
||||
};
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Arc, BezPath, FillRule, Frame, GeomContext, Ink, Node, NodeKind, RasterFx, Rect, RenderContext, Renderer, Shape, Vec2, blend_mode,
|
||||
effects, fill_rule, peniko,
|
||||
};
|
||||
|
||||
impl Renderer {
|
||||
/// Drop shadow / outer glow `fx` (shadow-cache slot `i` of `n`) as a cached raster: the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{BezPath, Rect, kurbo};
|
||||
|
||||
/// Most dashes a dotted guide is drawn with (1.5 on, 2.5 off on screen); a longer one is solid.
|
||||
pub(crate) const MAX_GUIDE_DASHES: f64 = 100_000.0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Affine, AppearanceItem, Arc, BezPath, Node, NodeKind, StrokeLayer, brush_fx, effects};
|
||||
|
||||
/// Most pixels from the origin that a shape handed to the rasterizer may reach, or a stroke be
|
||||
/// wide. A document's art stays within 4 million points, 2.6 billion pixels at the closest zoom.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::geometry::region_pixels;
|
||||
use super::*;
|
||||
use super::{Arc, NodeId, Rect, encode, proof};
|
||||
|
||||
/// Largest raster an export may ask [`Renderer::render_region`] for, per side. The CPU rasteriser
|
||||
/// addresses at most `u16::MAX` pixels per side (and panics at that edge).
|
||||
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_geom::{Rect, Vec2};
|
||||
use vello_cpu::RenderContext;
|
||||
use vello_cpu::peniko::{self, ColorStop};
|
||||
|
||||
use super::*;
|
||||
use super::{BlendMode, Compose, FillRule, Mix, vello_cpu};
|
||||
use crate::Frame;
|
||||
|
||||
/// Set the context paint (colours as frame `f` paints them). Returns false if nothing should be
|
||||
|
||||
@@ -12,7 +12,11 @@ use super::options::{AntiAlias, ISOLATION_DIM, MAX_CONTEXT_SIDE, RenderOptions,
|
||||
use super::paint::{SUBSTITUTED, blend_mode, fill_rule};
|
||||
use super::text_geom::{TextGeom, text_geom, text_geom_snapped};
|
||||
use super::threads::{default_threads, single_threaded_context};
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, BlendMode, Compose, Composite, Document, FillRule, FrameCache, HashMap, Ink, Mix, Node, NodeId, NodeKind,
|
||||
Pixmap, Rect, RenderContext, Renderer, Resources, Shape, StrokeAlign, StrokeLayer, SymbolBoxes, TextObject, TraceView, brush_fx, effects, fx,
|
||||
group, ink, kurbo, live, lru, peniko, proof, vello_cpu,
|
||||
};
|
||||
|
||||
mod images;
|
||||
mod nodes;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Arc, BezPath, Document, FillRule, Frame, HashMap, Pixmap, Rect, RenderContext, Renderer, Shape, blob_key, blob_pixmap, fill_rule,
|
||||
image_mip, ink, lookup, mip_level, peniko, vello_cpu,
|
||||
};
|
||||
use crate::images;
|
||||
|
||||
impl Renderer {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Arc, BezPath, ClipEntry, ClipPaintEntry, Compose, Composite, Document, FillRule, Frame, GeomEntry, ISOLATION_DIM, Ink, MAX_GUIDE_DASHES,
|
||||
Node, NodeId, NodeKind, Rect, RenderContext, RenderOptions, Renderer, Shape, SymbolBoxes, TraceView, blend_mode, brush_fx, effects, fx, group,
|
||||
holds_instance, holds_plugin_effect, kurbo, lru, mask_value, painted_items, plain_image, polygon_length, rects_overlap, single_plain_fill,
|
||||
text_geom_snapped,
|
||||
};
|
||||
|
||||
impl Renderer {
|
||||
/// Cached cull bounds of a node (containers union their cached children), symbol instances
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, BlendMode, Compose, FillRule, Frame, Ink, Mix, Node, Rect, RenderContext, Renderer, Shape, SliceEntry,
|
||||
Slices, StrokeAlign, StrokeEntry, StrokeLayer, TextGeom, blend_mode, drawable, effects, fill_rule, fx, kurbo, lru, owns_stroke, peniko,
|
||||
rects_overlap,
|
||||
};
|
||||
use crate::paint;
|
||||
|
||||
impl Renderer {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BezPath, BlendMode, FillRule, Frame, MAX_INLINE_DEPTH, MISSING_INLINE_LOGGED, Node, NodeKind, PlacedEntry,
|
||||
PlacedKey, Rect, RenderContext, Renderer, SUBSTITUTED, Shape, TextGeom, TextObject, blend_mode, blob_pixmap, depends_on_document, fx, holds_type,
|
||||
image_mip, ink, kurbo, lru, peniko, place, proof, stain_bits, text_geom, text_geom_snapped, vello_cpu,
|
||||
};
|
||||
use crate::paint;
|
||||
|
||||
impl Renderer {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Affine, Arc, BezPath, Node, Rect, Shape, TextObject, lru};
|
||||
|
||||
/// The whole text's glyph outlines as one path, and which of them each run draws.
|
||||
pub(crate) struct TextGeom {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{RenderContext, vello_cpu};
|
||||
|
||||
/// A render context on the calling thread. vello_cpu's `RenderContext::new` defaults to a
|
||||
/// multithreaded dispatcher, which panics on filter effects (glows, shadows, blur).
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
use super::output::{sanitize_id, valid_xml_value, xml_attr_escape};
|
||||
use super::paint::{StrokePlan, has_raster, pixel_gradient};
|
||||
use super::text::OUTLINE_TOLERANCE;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, BezPath, BlendMode, Document, FillRule, Node, NodeKind, Paint, PathData, Props, Rect, StrokeLayer, Writer, Written,
|
||||
WrittenShape, blend_css, css, fmt_num, stroke, xml_escape,
|
||||
};
|
||||
|
||||
/// A symbol's `<symbol>` def and the instance transforms that can `<use>` it.
|
||||
pub(super) struct SymbolDef {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
use super::nodes::{MASK, doc_path};
|
||||
use super::output::sanitize_id;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, BezPath, BlendMode, Color, FillLayer, FillRule, GradientKind, GradientPaint, HashMap, ImageBlob, ImageMode, LineCap, LineJoin,
|
||||
LinkedImage, Node, NodeKind, Paint, PathData, Point, Props, Rect, StrokeAlign, StrokeLayer, Writer, Written, base64_encode, blend_css, fmt_num,
|
||||
stroke, xml_escape,
|
||||
};
|
||||
|
||||
/// Image `b` as SVG viewers show it: PNG, JPEG, GIF, WebP and SVG as they are, other formats (a
|
||||
/// CMYK TIFF) as PNG.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
use super::output::xml_text;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, AppearanceItem, Arc, BTreeSet, BezPath, BlendMode, CharStyle, FillRule, FontDb, FontFace, GradientKind, HashMap, Justify, Node, NodeId,
|
||||
NodeKind, Paint, PathData, Props, Rect, StrokeAlign, TextKind, TextObject, Writer, base64_encode, css, css_string, fmt_num, font_descriptor,
|
||||
xml_escape,
|
||||
};
|
||||
|
||||
/// `chars` (sorted) as a CSS `unicode-range` (`U+41-5A,U+61`).
|
||||
fn unicode_range(chars: &BTreeSet<char>) -> String {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Affine, Arc, BezPath, BlendMode, Color, FillRule, GradientStop, HashMap, Node, Point, XNode, roxmltree};
|
||||
|
||||
/// `n` with every object id (its descendants' and its mask art's too) zeroed, to compare art.
|
||||
pub(super) fn without_ids(n: &Node) -> Node {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
use super::convert::{aff, bezpath, blend, clip_shapes, gradient_stops, is_plain, made_up, rule, uncut, unique_name, without_ids};
|
||||
use super::layers::filter_names;
|
||||
use super::prepass::link;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Appearance, AppearanceItem, Arc, BlendMode, Color, Dash, FillLayer, FillRule, Gradient, GradientGeom, GradientKind, GradientPaint,
|
||||
GradientStop, ImageBlob, ImageObject, Importer, LineCap, LineJoin, Node, NodeKind, Paint, PathData, PatternDef, Point, Rect, Reuse, StrokeLayer,
|
||||
Vec2, fnv1a, fx, shapes, spread, text, vector_effect,
|
||||
};
|
||||
|
||||
/// How many clip paths deep (`<clipPath clip-path>`) an object's clip is read.
|
||||
const MAX_CLIP_NEST: usize = 16;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::convert::made_up;
|
||||
use super::importer::{CSS_PX_PER_IN, PT_PER_IN};
|
||||
use super::*;
|
||||
use super::{Affine, Arc, FromStr, HashSet, Node, NodeId, NodeKind, Rect, Unit, XNode, roxmltree};
|
||||
|
||||
/// What marks a nested `<g>` as a sublayer rather than a group: our export writes it on the layers
|
||||
/// it writes inside layers. (Inkscape's `inkscape:groupmode="layer"` counts too.)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use super::convert::{MADE_UP_ID, href};
|
||||
use super::layers::{INKSCAPE, marked_layer};
|
||||
use super::*;
|
||||
use super::{
|
||||
Cow, ForeignAttribute, HashMap, HashSet, ImportOptions, MAX_SVG_SCRIPTS, Node, SVG_EVENTS, XNode, css, css_transform, files, roxmltree,
|
||||
symbol_units, vector_effect,
|
||||
};
|
||||
|
||||
/// What usvg would lose, found in the XML before it runs ([`prepass`]).
|
||||
#[derive(Default)]
|
||||
|
||||
Reference in New Issue
Block a user