summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/visualize
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-02-04 10:38:31 +0100
committerGitHub <noreply@github.com>2025-02-04 09:38:31 +0000
commit50ccd7d60f078f3617bfed5c4e8e1fd7d45ec340 (patch)
tree22c12abf76d2b2c20b49b569167ddf60fbe5b348 /crates/typst-library/src/visualize
parent5b3593e571826ae44a3aeb0e0f6f09face7291ac (diff)
Scope deprecations (#5798)
Diffstat (limited to 'crates/typst-library/src/visualize')
-rw-r--r--crates/typst-library/src/visualize/image/mod.rs1
-rw-r--r--crates/typst-library/src/visualize/mod.rs12
-rw-r--r--crates/typst-library/src/visualize/path.rs2
3 files changed, 9 insertions, 6 deletions
diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs
index 07ebdabe..9306eb6f 100644
--- a/crates/typst-library/src/visualize/image/mod.rs
+++ b/crates/typst-library/src/visualize/image/mod.rs
@@ -171,6 +171,7 @@ impl ImageElem {
/// #image.decode(changed)
/// ```
#[func(title = "Decode Image")]
+ #[deprecated = "`image.decode` is deprecated, directly pass bytes to `image` instead"]
pub fn decode(
span: Span,
/// The data to decode as an image. Can be a string for SVGs.
diff --git a/crates/typst-library/src/visualize/mod.rs b/crates/typst-library/src/visualize/mod.rs
index b0e627af..76849ac8 100644
--- a/crates/typst-library/src/visualize/mod.rs
+++ b/crates/typst-library/src/visualize/mod.rs
@@ -24,7 +24,7 @@ pub use self::shape::*;
pub use self::stroke::*;
pub use self::tiling::*;
-use crate::foundations::{category, Category, Scope, Type};
+use crate::foundations::{category, Category, Element, Scope, Type};
/// Drawing and data visualization.
///
@@ -49,8 +49,10 @@ pub(super) fn define(global: &mut Scope) {
global.define_elem::<CircleElem>();
global.define_elem::<PolygonElem>();
global.define_elem::<CurveElem>();
- global.define_elem::<PathElem>();
-
- // Compatibility.
- global.define("pattern", Type::of::<Tiling>());
+ global
+ .define("path", Element::of::<PathElem>())
+ .deprecated("the `path` function is deprecated, use `curve` instead");
+ global
+ .define("pattern", Type::of::<Tiling>())
+ .deprecated("the name `pattern` is deprecated, use `tiling` instead");
}
diff --git a/crates/typst-library/src/visualize/path.rs b/crates/typst-library/src/visualize/path.rs
index 6aacb319..5d3439c0 100644
--- a/crates/typst-library/src/visualize/path.rs
+++ b/crates/typst-library/src/visualize/path.rs
@@ -23,7 +23,7 @@ use crate::visualize::{FillRule, Paint, Stroke};
/// ```
///
/// # Deprecation
-/// This element is deprecated. The [`curve`] element should be used instead.
+/// This function is deprecated. The [`curve`] function should be used instead.
#[elem(Show)]
pub struct PathElem {
/// How to fill the path.