1[package]
2name = "draw"
3version = "0.1.0"
4edition = "2024"
5publish = false
6
7[features]
8default = ["wgpu"]
9# The renderer; `edit` needs only parley. It submits through wgpu, or without it through
10# OpenGL 2.1, for Mac OS X 10.6. On Windows it has Direct3D 11 and OpenGL besides, as Windows
11# 7 has no Direct3D 12, on macOS OpenGL, and in a browser the 2D canvas; its maker picks one.
12render = ["dep:base64", "dep:bytemuck", "dep:image", "dep:linebender_resource_handle", "dep:roxmltree", "dep:skrifa", "dep:swash"]
13wgpu = ["render", "dep:wgpu", "dep:windows", "dep:js-sys", "dep:wasm-bindgen", "dep:web-sys"]
14# Writes layers as PDF pages, text as real text in subset fonts.
15pdf = ["render", "dep:miniz_oxide", "dep:pdf-writer", "dep:subsetter"]
16
17[dependencies]
18parley.workspace = true
19# std's clock where there is one; the browser's on wasm32-unknown-unknown, whose std has none.
20web-time = "1.1"
21
22base64 = { version = "0.23.1", default-features = false, features = ["std"], optional = true }
23bytemuck = { version = "1.25", features = ["derive"], optional = true }
24image = { version = "0.25", default-features = false, features = ["gif", "jpeg", "png", "tiff"], optional = true }
25linebender_resource_handle = { version = "0.1.1", optional = true }
26miniz_oxide = { version = "0.8", optional = true }
27pdf-writer = { version = "0.15", optional = true }
28roxmltree = { version = "0.21", optional = true }
29subsetter = { version = "0.2.6", default-features = false, optional = true }
30# COLRv1 glyphs, which swash can't paint.
31skrifa = { version = "0.44.0", optional = true }
32swash = { version = "0.2.10", optional = true }
33wgpu = { workspace = true, optional = true }
34
35[target.'cfg(windows)'.dependencies]
36windows = { version = "0.62", default-features = false, optional = true, features = [
37 "Win32_Graphics_Direct3D",
38 "Win32_Graphics_Direct3D11",
39 "Win32_Graphics_DirectComposition",
40 "Win32_Graphics_Dxgi_Common",
41 "Win32_System_LibraryLoader",
42 "Win32_UI_WindowsAndMessaging",
43] }
44
45[target.'cfg(target_arch = "wasm32")'.dependencies]
46js-sys = { version = "0.3", optional = true }
47wasm-bindgen = { version = "0.2", optional = true }
48web-sys = { version = "0.3", optional = true, features = [
49 "CanvasGradient",
50 "CanvasRenderingContext2d",
51 "CanvasWindingRule",
52 "console",
53 "CssStyleDeclaration",
54 "Document",
55 "DomRect",
56 "Element",
57 "HtmlCanvasElement",
58 "HtmlElement",
59 "ImageData",
60 "Node",
61 "Window",
62] }
63
64[dev-dependencies]
65pollster = "0.4"
66png = "0.18"
67
68[[example]]
69name = "snowflakes"
70required-features = ["wgpu"]