rive_rs/shapes/paint/
stroke_effect.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use std::fmt;
use std::rc::Rc;

use crate::core::ObjectRef;
use crate::shapes::paint::TrimPath;
use crate::shapes::{CommandPath, MetricsPath};

pub fn as_ref(object_ref: ObjectRef<'_>) -> impl StrokeEffect + '_ {
    object_ref.cast::<TrimPath>()
}

pub trait StrokeEffect: fmt::Debug {
    fn effect_path(&self, source: &mut MetricsPath) -> Rc<CommandPath>;
    fn invalidate_effect(&self);
}