summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/visualize
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-library/src/visualize')
-rw-r--r--crates/typst-library/src/visualize/image/mod.rs25
-rw-r--r--crates/typst-library/src/visualize/mod.rs13
-rw-r--r--crates/typst-library/src/visualize/path.rs3
3 files changed, 14 insertions, 27 deletions
diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs
index 9306eb6f..18d40caa 100644
--- a/crates/typst-library/src/visualize/image/mod.rs
+++ b/crates/typst-library/src/visualize/image/mod.rs
@@ -50,6 +50,17 @@ pub struct ImageElem {
/// supported [formats]($image.format).
///
/// For more details about paths, see the [Paths section]($syntax/#paths).
+ ///
+ /// ```example
+ /// #let original = read("diagram.svg")
+ /// #let changed = original.replace(
+ /// "#2B80FF", // blue
+ /// green.to-hex(),
+ /// )
+ ///
+ /// #image(bytes(original))
+ /// #image(bytes(changed))
+ /// ```
#[required]
#[parse(
let source = args.expect::<Spanned<DataSource>>("source")?;
@@ -156,20 +167,6 @@ pub struct ImageElem {
#[allow(clippy::too_many_arguments)]
impl ImageElem {
/// Decode a raster or vector graphic from bytes or a string.
- ///
- /// This function is deprecated. The [`image`] function now accepts bytes
- /// directly.
- ///
- /// ```example
- /// #let original = read("diagram.svg")
- /// #let changed = original.replace(
- /// "#2B80FF", // blue
- /// green.to-hex(),
- /// )
- ///
- /// #image.decode(original)
- /// #image.decode(changed)
- /// ```
#[func(title = "Decode Image")]
#[deprecated = "`image.decode` is deprecated, directly pass bytes to `image` instead"]
pub fn decode(
diff --git a/crates/typst-library/src/visualize/mod.rs b/crates/typst-library/src/visualize/mod.rs
index 76849ac8..72a42065 100644
--- a/crates/typst-library/src/visualize/mod.rs
+++ b/crates/typst-library/src/visualize/mod.rs
@@ -24,19 +24,11 @@ pub use self::shape::*;
pub use self::stroke::*;
pub use self::tiling::*;
-use crate::foundations::{category, Category, Element, Scope, Type};
-
-/// Drawing and data visualization.
-///
-/// If you want to create more advanced drawings or plots, also have a look at
-/// the [CetZ](https://github.com/johannes-wolf/cetz) package as well as more
-/// specialized [packages]($universe) for your use case.
-#[category]
-pub static VISUALIZE: Category;
+use crate::foundations::{Element, Scope, Type};
/// Hook up all visualize definitions.
pub(super) fn define(global: &mut Scope) {
- global.start_category(VISUALIZE);
+ global.start_category(crate::Category::Visualize);
global.define_type::<Color>();
global.define_type::<Gradient>();
global.define_type::<Tiling>();
@@ -55,4 +47,5 @@ pub(super) fn define(global: &mut Scope) {
global
.define("pattern", Type::of::<Tiling>())
.deprecated("the name `pattern` is deprecated, use `tiling` instead");
+ global.reset_category();
}
diff --git a/crates/typst-library/src/visualize/path.rs b/crates/typst-library/src/visualize/path.rs
index 5d3439c0..c1cfde94 100644
--- a/crates/typst-library/src/visualize/path.rs
+++ b/crates/typst-library/src/visualize/path.rs
@@ -21,9 +21,6 @@ use crate::visualize::{FillRule, Paint, Stroke};
/// ((50%, 0pt), (40pt, 0pt)),
/// )
/// ```
-///
-/// # Deprecation
-/// This function is deprecated. The [`curve`] function should be used instead.
#[elem(Show)]
pub struct PathElem {
/// How to fill the path.