Files
phy/epaint/index.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

18 lines
19 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A simple 2D graphics library for turning simple 2D shapes and text into textured triangles."><title>epaint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="epaint" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../epaint/index.html">epaint</a><span class="version">0.30.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#coordinate-system" title="Coordinate system">Coordinate system</a></li><li><a href="#feature-flags" title="Feature flags">Feature flags</a></li></ul><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>epaint</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/epaint/lib.rs.html#1-145">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A simple 2D graphics library for turning simple 2D shapes and text into textured triangles.</p>
<p>Made for <a href="https://github.com/emilk/egui/"><code>egui</code></a>.</p>
<p>Create some <a href="enum.Shape.html" title="enum epaint::Shape"><code>Shape</code></a>:s and pass them to <a href="tessellator/fn.tessellate_shapes.html" title="fn epaint::tessellator::tessellate_shapes"><code>tessellate_shapes</code></a> to generate <a href="struct.Mesh.html" title="struct epaint::Mesh"><code>Mesh</code></a>:es
that you can then paint using some graphics API of your choice (e.g. OpenGL).</p>
<h3 id="coordinate-system"><a class="doc-anchor" href="#coordinate-system">§</a>Coordinate system</h3>
<p>The left-top corner of the screen is <code>(0.0, 0.0)</code>,
with X increasing to the right and Y increasing downwards.</p>
<p><code>epaint</code> uses logical <em>points</em> as its coordinate system.
Those related to physical <em>pixels</em> by the <code>pixels_per_point</code> scale factor.
For example, a high-dpi screen can have <code>pixels_per_point = 2.0</code>,
meaning there are two physical screen pixels for each logical point.</p>
<p>Angles are in radians, and are measured clockwise from the X-axis, which has angle=0.</p>
<h3 id="feature-flags"><a class="doc-anchor" href="#feature-flags">§</a>Feature flags</h3></div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.ColorMode"><code>pub use self::color::<a class="enum" href="color/enum.ColorMode.html" title="enum epaint::color::ColorMode">ColorMode</a>;</code></div></li><li><div class="item-name" id="reexport.ColorImage"><code>pub use self::image::<a class="struct" href="image/struct.ColorImage.html" title="struct epaint::image::ColorImage">ColorImage</a>;</code></div></li><li><div class="item-name" id="reexport.FontImage"><code>pub use self::image::<a class="struct" href="image/struct.FontImage.html" title="struct epaint::image::FontImage">FontImage</a>;</code></div></li><li><div class="item-name" id="reexport.ImageData"><code>pub use self::image::<a class="enum" href="image/enum.ImageData.html" title="enum epaint::image::ImageData">ImageData</a>;</code></div></li><li><div class="item-name" id="reexport.ImageDelta"><code>pub use self::image::<a class="struct" href="image/struct.ImageDelta.html" title="struct epaint::image::ImageDelta">ImageDelta</a>;</code></div></li><li><div class="item-name" id="reexport.PaintStats"><code>pub use self::stats::<a class="struct" href="stats/struct.PaintStats.html" title="struct epaint::stats::PaintStats">PaintStats</a>;</code></div></li><li><div class="item-name" id="reexport.TessellationOptions"><code>pub use self::tessellator::<a class="struct" href="tessellator/struct.TessellationOptions.html" title="struct epaint::tessellator::TessellationOptions">TessellationOptions</a>;</code></div></li><li><div class="item-name" id="reexport.Tessellator"><code>pub use self::tessellator::<a class="struct" href="tessellator/struct.Tessellator.html" title="struct epaint::tessellator::Tessellator">Tessellator</a>;</code></div></li><li><div class="item-name" id="reexport.FontFamily"><code>pub use self::text::<a class="enum" href="text/enum.FontFamily.html" title="enum epaint::text::FontFamily">FontFamily</a>;</code></div></li><li><div class="item-name" id="reexport.FontId"><code>pub use self::text::<a class="struct" href="text/struct.FontId.html" title="struct epaint::text::FontId">FontId</a>;</code></div></li><li><div class="item-name" id="reexport.Fonts"><code>pub use self::text::<a class="struct" href="text/struct.Fonts.html" title="struct epaint::text::Fonts">Fonts</a>;</code></div></li><li><div class="item-name" id="reexport.Galley"><code>pub use self::text::<a class="struct" href="text/struct.Galley.html" title="struct epaint::text::Galley">Galley</a>;</code></div></li><li><div class="item-name" id="reexport.TextureManager"><code>pub use self::textures::<a class="struct" href="textures/struct.TextureManager.html" title="struct epaint::textures::TextureManager">TextureManager</a>;</code></div></li><li><div class="item-name" id="reexport.tessellate_shapes"><code>pub use tessellator::<a class="fn" href="tessellator/fn.tessellate_shapes.html" title="fn epaint::tessellator::tessellate_shapes">tessellate_shapes</a>;</code></div><div class="desc docblock-short"><wbr><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.ahash"><code>pub use <a class="mod" href="../ahash/index.html" title="mod ahash">ahash</a>;</code></div></li><li><div class="item-name" id="reexport.ecolor"><code>pub use <a class="mod" href="../ecolor/index.html" title="mod ecolor">ecolor</a>;</code></div></li><li><div class="item-name" id="reexport.emath"><code>pub use <a class="mod" href="../emath/index.html" title="mod emath">emath</a>;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="color/index.html" title="mod epaint::color">color</a></div></li><li><div class="item-name"><a class="mod" href="image/index.html" title="mod epaint::image">image</a></div></li><li><div class="item-name"><a class="mod" href="mutex/index.html" title="mod epaint::mutex">mutex</a></div><div class="desc docblock-short">Helper module that adds extra checks when the <code>deadlock_detection</code> feature is turned on.</div></li><li><div class="item-name"><a class="mod" href="shape_transform/index.html" title="mod epaint::shape_transform">shape_<wbr>transform</a></div></li><li><div class="item-name"><a class="mod" href="stats/index.html" title="mod epaint::stats">stats</a></div><div class="desc docblock-short">Collect statistics about what is being painted.</div></li><li><div class="item-name"><a class="mod" href="tessellator/index.html" title="mod epaint::tessellator">tessellator</a></div><div class="desc docblock-short">Converts graphics primitives into textured triangles.</div></li><li><div class="item-name"><a class="mod" href="text/index.html" title="mod epaint::text">text</a></div><div class="desc docblock-short">Everything related to text, fonts, text layout, cursors etc.</div></li><li><div class="item-name"><a class="mod" href="textures/index.html" title="mod epaint::textures">textures</a></div></li><li><div class="item-name"><a class="mod" href="util/index.html" title="mod epaint::util">util</a></div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.CircleShape.html" title="struct epaint::CircleShape">Circle<wbr>Shape</a></div><div class="desc docblock-short">How to paint a circle.</div></li><li><div class="item-name"><a class="struct" href="struct.ClippedPrimitive.html" title="struct epaint::ClippedPrimitive">Clipped<wbr>Primitive</a></div><div class="desc docblock-short">A <a href="struct.Mesh.html" title="struct epaint::Mesh"><code>Mesh</code></a> or <a href="struct.PaintCallback.html" title="struct epaint::PaintCallback"><code>PaintCallback</code></a> within a clip rectangle.</div></li><li><div class="item-name"><a class="struct" href="struct.ClippedShape.html" title="struct epaint::ClippedShape">Clipped<wbr>Shape</a></div><div class="desc docblock-short">A <a href="enum.Shape.html" title="enum epaint::Shape"><code>Shape</code></a> within a clip rectangle.</div></li><li><div class="item-name"><a class="struct" href="struct.Color32.html" title="struct epaint::Color32">Color32</a></div><div class="desc docblock-short">This format is used for space-efficient color representation (32 bits).</div></li><li><div class="item-name"><a class="struct" href="struct.CubicBezierShape.html" title="struct epaint::CubicBezierShape">Cubic<wbr>Bezier<wbr>Shape</a></div><div class="desc docblock-short">A cubic <a href="https://en.wikipedia.org/wiki/B%C3%A9zier_curve">Bézier Curve</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.EllipseShape.html" title="struct epaint::EllipseShape">Ellipse<wbr>Shape</a></div><div class="desc docblock-short">How to paint an ellipse.</div></li><li><div class="item-name"><a class="struct" href="struct.Hsva.html" title="struct epaint::Hsva">Hsva</a></div><div class="desc docblock-short">Hue, saturation, value, alpha. All in the range [0, 1].
No premultiplied alpha.</div></li><li><div class="item-name"><a class="struct" href="struct.HsvaGamma.html" title="struct epaint::HsvaGamma">Hsva<wbr>Gamma</a></div><div class="desc docblock-short">Like Hsva but with the <code>v</code> value (brightness) being gamma corrected
so that it is somewhat perceptually even.</div></li><li><div class="item-name"><a class="struct" href="struct.Margin.html" title="struct epaint::Margin">Margin</a></div><div class="desc docblock-short">A value for all four sides of a rectangle,
often used to express padding or spacing.</div></li><li><div class="item-name"><a class="struct" href="struct.Mesh.html" title="struct epaint::Mesh">Mesh</a></div><div class="desc docblock-short">Textured triangles in two dimensions.</div></li><li><div class="item-name"><a class="struct" href="struct.Mesh16.html" title="struct epaint::Mesh16">Mesh16</a></div><div class="desc docblock-short">A version of <a href="struct.Mesh.html" title="struct epaint::Mesh"><code>Mesh</code></a> that uses 16-bit indices.</div></li><li><div class="item-name"><a class="struct" href="struct.PaintCallback.html" title="struct epaint::PaintCallback">Paint<wbr>Callback</a></div><div class="desc docblock-short">If you want to paint some 3D shapes inside an egui region, you can use this.</div></li><li><div class="item-name"><a class="struct" href="struct.PaintCallbackInfo.html" title="struct epaint::PaintCallbackInfo">Paint<wbr>Callback<wbr>Info</a></div><div class="desc docblock-short">Information passed along with <a href="struct.PaintCallback.html" title="struct epaint::PaintCallback"><code>PaintCallback</code></a> (<a href="enum.Shape.html#variant.Callback" title="variant epaint::Shape::Callback"><code>Shape::Callback</code></a>).</div></li><li><div class="item-name"><a class="struct" href="struct.PathShape.html" title="struct epaint::PathShape">Path<wbr>Shape</a></div><div class="desc docblock-short">A path which can be stroked and/or filled (if closed).</div></li><li><div class="item-name"><a class="struct" href="struct.PathStroke.html" title="struct epaint::PathStroke">Path<wbr>Stroke</a></div><div class="desc docblock-short">Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see <a href="color/enum.ColorMode.html" title="enum epaint::color::ColorMode"><code>ColorMode</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.Pos2.html" title="struct epaint::Pos2">Pos2</a></div><div class="desc docblock-short">A position on screen.</div></li><li><div class="item-name"><a class="struct" href="struct.QuadraticBezierShape.html" title="struct epaint::QuadraticBezierShape">Quadratic<wbr>Bezier<wbr>Shape</a></div><div class="desc docblock-short">A quadratic <a href="https://en.wikipedia.org/wiki/B%C3%A9zier_curve">Bézier Curve</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Rect.html" title="struct epaint::Rect">Rect</a></div><div class="desc docblock-short">A rectangular region of space.</div></li><li><div class="item-name"><a class="struct" href="struct.RectShape.html" title="struct epaint::RectShape">Rect<wbr>Shape</a></div><div class="desc docblock-short">How to paint a rectangle.</div></li><li><div class="item-name"><a class="struct" href="struct.Rgba.html" title="struct epaint::Rgba">Rgba</a></div><div class="desc docblock-short">0-1 linear space <code>RGBA</code> color with premultiplied alpha.</div></li><li><div class="item-name"><a class="struct" href="struct.Rounding.html" title="struct epaint::Rounding">Rounding</a></div><div class="desc docblock-short">How rounded the corners of things should be</div></li><li><div class="item-name"><a class="struct" href="struct.Shadow.html" title="struct epaint::Shadow">Shadow</a></div><div class="desc docblock-short">The color and fuzziness of a fuzzy shape.</div></li><li><div class="item-name"><a class="struct" href="struct.Stroke.html" title="struct epaint::Stroke">Stroke</a></div><div class="desc docblock-short">Describes the width and color of a line.</div></li><li><div class="item-name"><a class="struct" href="struct.TextShape.html" title="struct epaint::TextShape">Text<wbr>Shape</a></div><div class="desc docblock-short">How to paint some text on screen.</div></li><li><div class="item-name"><a class="struct" href="struct.TextureAtlas.html" title="struct epaint::TextureAtlas">Texture<wbr>Atlas</a></div><div class="desc docblock-short">Contains font data in an atlas, where each character occupied a small rectangle.</div></li><li><div class="item-name"><a class="struct" href="struct.TextureHandle.html" title="struct epaint::TextureHandle">Texture<wbr>Handle</a></div><div class="desc docblock-short">Used to paint images.</div></li><li><div class="item-name"><a class="struct" href="struct.Vec2.html" title="struct epaint::Vec2">Vec2</a></div><div class="desc docblock-short">A vector has a direction and length.
A <a href="struct.Vec2.html" title="struct epaint::Vec2"><code>Vec2</code></a> is often used to represent a size.</div></li><li><div class="item-name"><a class="struct" href="struct.Vertex.html" title="struct epaint::Vertex">Vertex</a></div><div class="desc docblock-short">The 2D vertex type.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.Primitive.html" title="enum epaint::Primitive">Primitive</a></div><div class="desc docblock-short">A rendering primitive - either a <a href="struct.Mesh.html" title="struct epaint::Mesh"><code>Mesh</code></a> or a <a href="struct.PaintCallback.html" title="struct epaint::PaintCallback"><code>PaintCallback</code></a>.</div></li><li><div class="item-name"><a class="enum" href="enum.Shape.html" title="enum epaint::Shape">Shape</a></div><div class="desc docblock-short">A paint primitive such as a circle or a piece of text.
Coordinates are all screen space points (not physical pixels).</div></li><li><div class="item-name"><a class="enum" href="enum.TextureId.html" title="enum epaint::TextureId">Texture<wbr>Id</a></div><div class="desc docblock-short">What texture to use in a <a href="struct.Mesh.html" title="struct epaint::Mesh"><code>Mesh</code></a> mesh.</div></li></ul><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.HAS_RAYON.html" title="constant epaint::HAS_RAYON">HAS_<wbr>RAYON</a></div><div class="desc docblock-short">Was epaint compiled with the <code>rayon</code> feature?</div></li><li><div class="item-name"><a class="constant" href="constant.WHITE_UV.html" title="constant epaint::WHITE_UV">WHITE_<wbr>UV</a></div><div class="desc docblock-short">The UV coordinate of a white region of the texture mesh.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.pos2.html" title="fn epaint::pos2">pos2</a></div><div class="desc docblock-short"><code>pos2(x, y) == Pos2::new(x, y)</code></div></li><li><div class="item-name"><a class="fn" href="fn.vec2.html" title="fn epaint::vec2">vec2</a></div><div class="desc docblock-short"><code>vec2(x, y) == Vec2::new(x, y)</code></div></li></ul></section></div></main></body></html>