/* This file is part of DarkFi (https://dark.fi)
*
* Copyright (C) 2020-2025 Dyne.org foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
use async_trait::async_trait;
use rand::{rngs::OsRng, Rng};
use parking_lot::Mutex as SyncMutex;
use std::sync::{Arc, OnceLock, Weak};
use crate::{
error::{Error, Result},
expr::{Op, SExprCode, SExprMachine, SExprVal},
gfx::{
GfxBufferId, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, Rectangle, RenderApi, Vertex,
},
mesh::Color,
prop::{
PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyPtr, PropertyRect,
PropertyUint32, Role,
},
scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
util::{enumerate, unixtime},
ExecutorPtr,
};
use super::{DrawUpdate, OnModify, UIObject};
pub mod shape;
use shape::VectorShape;
macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::vector_art", $($arg)*); } }
macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::vector_art", $($arg)*); } }
pub type VectorArtPtr = Arc;
pub struct VectorArt {
node: SceneNodeWeak,
render_api: RenderApi,
tasks: SyncMutex>>,
shape: VectorShape,
dc_key: u64,
is_visible: PropertyBool,
rect: PropertyRect,
z_index: PropertyUint32,
priority: PropertyUint32,
parent_rect: SyncMutex