本文へスキップ

SVG

外部リソースを読み込まずに、完全なインライン SVG ドキュメントを描画します。

デモを読み込み中…

#インポート

quickgui から Svg をインポートします。

use quickgui::*;

#使い方

svg(Svg::from_bytes(ICON).expect("svg"))
    .size(72.0, 72.0)
    .text_color(Color::rgb8(37, 99, 235))

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

pub fn from_bytes(source: impl AsRef<[u8]>) -> Result<Self, SvgError>

Parse an SVG or SVGZ document from memory with strict source-size limits. System fonts are loaded lazily only when the document may contain a `<text>` element. External and embedded raster images are deliberately ignored, keeping parsing and rasterization bounded for UI icons.

from_svgpub fn from_svg(source: impl AsRef<str>) -> Result<Self, SvgError>—

Parse an SVG document from UTF-8 text.

pub fn from_svg(source: impl AsRef<str>) -> Result<Self, SvgError>
ソースを見る
openpub fn open(path: impl AsRef<Path>) -> Result<Self, SvgError>—

Read and parse an SVG or SVGZ file synchronously. Applications should call this during setup or on their own background executor rather than from latency-sensitive input handling.

pub fn open(path: impl AsRef<Path>) -> Result<Self, SvgError>
ソースを見る
widthpub fn width(&self) -> f32—

Configures width for this part.

pub fn width(&self) -> f32
ソースを見る
heightpub fn height(&self) -> f32—

Configures height for this part.

pub fn height(&self) -> f32
ソースを見る
sizepub fn size(&self) -> Size—

Configures size for this part.

pub fn size(&self) -> Size
ソースを見る
source_byte_lenpub fn source_byte_len(&self) -> usize—

Configures source byte len for this part.

pub fn source_byte_len(&self) -> usize
ソースを見る
pub fn svg(source: impl Into<Svg>) -> Element

Create a monochrome SVG element with intrinsic sizing and inherited text color.