Write missing documentation in iced_wgpu
This commit is contained in:
parent
8622e998f2
commit
de638f44a5
6 changed files with 17 additions and 18 deletions
|
|
@ -1,8 +1,4 @@
|
|||
//! Draw 2D graphics for your users.
|
||||
//!
|
||||
//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
|
||||
//! [`Frame`]. It can be used for animation, data visualization, game graphics,
|
||||
//! and more!
|
||||
//! Build and draw geometry.
|
||||
pub mod fill;
|
||||
pub mod path;
|
||||
pub mod stroke;
|
||||
|
|
|
|||
|
|
@ -135,15 +135,15 @@ impl Frame {
|
|||
|
||||
f(&mut frame);
|
||||
|
||||
let translation = Vector::new(region.x, region.y);
|
||||
let origin = Point::new(region.x, region.y);
|
||||
|
||||
match (self, frame) {
|
||||
(Self::TinySkia(target), Self::TinySkia(frame)) => {
|
||||
target.clip(frame, translation);
|
||||
target.clip(frame, origin);
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
(Self::Wgpu(target), Self::Wgpu(frame)) => {
|
||||
target.clip(frame, translation);
|
||||
target.clip(frame, origin);
|
||||
}
|
||||
#[allow(unreachable_patterns)]
|
||||
_ => unreachable!(),
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
)]
|
||||
#![deny(
|
||||
missing_debug_implementations,
|
||||
//missing_docs,
|
||||
missing_docs,
|
||||
unused_results,
|
||||
clippy::extra_unused_lifetimes,
|
||||
clippy::from_over_into,
|
||||
|
|
|
|||
|
|
@ -127,9 +127,9 @@ impl Frame {
|
|||
self.transform = self.stack.pop().expect("Pop transform");
|
||||
}
|
||||
|
||||
pub fn clip(&mut self, frame: Self, translation: Vector) {
|
||||
pub fn clip(&mut self, frame: Self, at: Point) {
|
||||
self.primitives.push(Primitive::Translate {
|
||||
translation,
|
||||
translation: Vector::new(at.x, at.y),
|
||||
content: Box::new(frame.into_primitive()),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//! Build and draw geometry.
|
||||
use crate::core::{Gradient, Point, Rectangle, Size, Vector};
|
||||
use crate::graphics::geometry::fill::{self, Fill};
|
||||
use crate::graphics::geometry::{
|
||||
|
|
@ -9,9 +10,7 @@ use lyon::geom::euclid;
|
|||
use lyon::tessellation;
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// The frame of a [`Canvas`].
|
||||
///
|
||||
/// [`Canvas`]: crate::widget::Canvas
|
||||
/// A frame for drawing some geometry.
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct Frame {
|
||||
size: Size,
|
||||
|
|
@ -353,10 +352,12 @@ impl Frame {
|
|||
self.pop_transform();
|
||||
}
|
||||
|
||||
/// Pushes the current transform in the transform stack.
|
||||
pub fn push_transform(&mut self) {
|
||||
self.transforms.previous.push(self.transforms.current);
|
||||
}
|
||||
|
||||
/// Pops a transform from the transform stack and sets it as the current transform.
|
||||
pub fn pop_transform(&mut self) {
|
||||
self.transforms.current = self.transforms.previous.pop().unwrap();
|
||||
}
|
||||
|
|
@ -373,14 +374,16 @@ impl Frame {
|
|||
|
||||
f(&mut frame);
|
||||
|
||||
let translation = Vector::new(region.x, region.y);
|
||||
let origin = Point::new(region.x, region.y);
|
||||
|
||||
self.clip(frame, translation);
|
||||
self.clip(frame, origin);
|
||||
}
|
||||
|
||||
pub fn clip(&mut self, frame: Frame, translation: Vector) {
|
||||
/// Draws the clipped contents of the given [`Frame`] with origin at the given [`Point`].
|
||||
pub fn clip(&mut self, frame: Frame, at: Point) {
|
||||
let size = frame.size();
|
||||
let primitives = frame.into_primitives();
|
||||
let translation = Vector::new(at.x, at.y);
|
||||
|
||||
let (text, meshes) = primitives
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
)]
|
||||
#![deny(
|
||||
missing_debug_implementations,
|
||||
//missing_docs,
|
||||
missing_docs,
|
||||
unsafe_code,
|
||||
unused_results,
|
||||
clippy::extra_unused_lifetimes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue