Lines Matching +full:fill +full:- +full:range
15 use std::ops::Range;
33 ) -> impl Iterator<Item = Rect> + 'a { in split()
55 fn split_evenly(&self, (row, col): (usize, usize)) -> impl Iterator<Item = Rect> + '_ { in split_evenly()
56 fn compute_evenly_split(from: i32, to: i32, n: usize, idx: usize) -> i32 { in split_evenly()
57 let size = (to - from) as usize; in split_evenly()
75 ) -> impl Iterator<Item = Rect> { in split_grid()
108 /// Make the coordinate in the range of the rectangle
109 pub fn truncate(&self, p: (i32, i32)) -> (i32, i32) { in truncate()
116 /// 1. Layout specification - Split the parent drawing area into sub-drawing-areas
117 /// 2. Coordinate Translation - Allows guest coordinate system attached and used for drawing.
118 /// 3. Element based drawing - drawing area provides the environment the element can be drawn o…
126 fn clone(&self) -> Self { in clone()
149 fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { in fmt()
166 fn from(backend: DB) -> Self { in from()
172 fn from(backend: &'a Rc<RefCell<DB>>) -> Self { in from()
180 fn into_drawing_area(self) -> DrawingArea<Self, Shift>; in into_drawing_area()
184 fn into_drawing_area(self) -> DrawingArea<T, Shift> { in into_drawing_area()
196 ) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>> in draw_mesh()
198 DrawFunc: FnMut(&mut DB, MeshLine<X, Y>) -> Result<(), DrawingErrorKind<DB::ErrorType>>, in draw_mesh()
206 /// Get the range of X of the guest coordinate for current drawing area
207 pub fn get_x_range(&self) -> Range<X::ValueType> { in get_x_range()
211 /// Get the range of Y of the guest coordinate for current drawing area
212 pub fn get_y_range(&self) -> Range<Y::ValueType> { in get_y_range()
216 /// Get the range of X of the backend coordinate for current drawing area
217 pub fn get_x_axis_pixel_range(&self) -> Range<i32> { in get_x_axis_pixel_range()
221 /// Get the range of Y of the backend coordinate for current drawing area
222 pub fn get_y_axis_pixel_range(&self) -> Range<i32> { in get_y_axis_pixel_range()
229 pub fn get_base_pixel(&self) -> BackendCoord { in get_base_pixel()
233 /// Strip the applied coordinate specification and returns a shift-based drawing area
234 pub fn strip_coord_spec(&self) -> DrawingArea<DB, Shift> { in strip_coord_spec()
243 pub fn use_screen_coord(&self) -> DrawingArea<DB, Shift> { in use_screen_coord()
252 pub fn dim_in_pixel(&self) -> (u32, u32) { in dim_in_pixel()
254 (self.rect.x1 - self.rect.x0) as u32, in dim_in_pixel()
255 (self.rect.y1 - self.rect.y0) as u32, in dim_in_pixel()
260 pub fn relative_to_height(&self, p: f64) -> f64 { in relative_to_height()
261 f64::from((self.rect.y1 - self.rect.y0).max(0)) * (p.min(1.0).max(0.0)) in relative_to_height()
265 pub fn relative_to_width(&self, p: f64) -> f64 { in relative_to_width()
266 f64::from((self.rect.x1 - self.rect.x0).max(0)) * (p.min(1.0).max(0.0)) in relative_to_width()
269 /// Get the pixel range of this area
270 pub fn get_pixel_range(&self) -> (Range<i32>, Range<i32>) { in get_pixel_range()
275 fn backend_ops<R, O: FnOnce(&mut DB) -> Result<R, DrawingErrorKind<DB::ErrorType>>>( in backend_ops()
278 ) -> Result<R, DrawingAreaError<DB>> { in backend_ops()
288 /// Fill the entire drawing area with a color
289 pub fn fill<ColorType: Color>(&self, color: &ColorType) -> Result<(), DrawingAreaError<DB>> { in fill() method
305 ) -> Result<(), DrawingAreaError<DB>> { in draw_pixel()
311 pub fn present(&self) -> Result<(), DrawingAreaError<DB>> { in present()
315 /// Draw an high-level element
316 pub fn draw<'a, E, B>(&self, element: &'a E) -> Result<(), DrawingAreaError<DB>> in draw()
330 pub fn map_coordinate(&self, coord: &CT::From) -> BackendCoord { in map_coordinate()
339 /// - `text`: The text we want to estimate
340 /// - `font`: The font spec in which we want to draw the text
341 /// - **return**: The size of the text if drawn on this area
346 ) -> Result<(u32, u32), DrawingAreaError<DB>> { in estimate_text_size()
352 fn with_rc_cell(backend: Rc<RefCell<DB>>) -> Self { in with_rc_cell()
371 ) -> DrawingArea<DB, Shift> { in shrink()
386 pub fn apply_coord_spec<CT: CoordTranslate>(&self, coord_spec: CT) -> DrawingArea<DB, CT> { in apply_coord_spec()
401 ) -> DrawingArea<DB, Shift> { in margin()
410 x1: self.rect.x1 - right, in margin()
411 y1: self.rect.y1 - bottom, in margin()
419 pub fn split_vertically<S: SizeDesc>(&self, y: S) -> (Self, Self) { in split_vertically()
432 pub fn split_horizontally<S: SizeDesc>(&self, x: S) -> (Self, Self) { in split_horizontally()
445 pub fn split_evenly(&self, (row, col): (usize, usize)) -> Vec<Self> { in split_evenly()
466 ) -> Vec<Self> { in split_by_breakpoints()
485 ) -> Result<Self, DrawingAreaError<DB>> { in titled()
488 let x_padding = (self.rect.x1 - self.rect.x0) / 2; in titled()
521 ) -> Result<(), DrawingAreaError<DB>> { in draw_text()
528 pub fn into_coord_spec(self) -> CT { in into_coord_spec()
533 pub fn as_coord_spec(&self) -> &CT { in as_coord_spec()
538 pub fn as_coord_spec_mut(&mut self) -> &mut CT { in as_coord_spec_mut()
562 drawing_area.fill(&WHITE).expect("Drawing Failure"); in test_filling()
599 d.fill(*c).expect("Drawing Failure"); in test_split_evenly()
627 left.fill(&RED).expect("Drawing Error"); in test_split_horizontally()
628 right.fill(&BLUE).expect("Drawing Error"); in test_split_horizontally()
655 left.fill(&RED).expect("Drawing Error"); in test_split_vertically()
656 right.fill(&BLUE).expect("Drawing Error"); in test_split_vertically()
677 breaks[id as usize - 1] in test_split_grid()
706 .fill(colors[i % colors.len()]) in test_split_grid()
738 .fill(&WHITE) in test_titled()
749 assert_eq!(d, (1024 - 4, 768 - 2)); in test_margin()
760 .fill(&WHITE) in test_margin()
770 >::new(-100..100, 0..200, (0..1024, 0..768))); in test_ranges()
773 assert_eq!(x_range, -100..100); in test_ranges()
789 assert_eq!(0.0, drawing_area.relative_to_width(-0.2)); in test_relative_size()
790 assert_eq!(0.0, drawing_area.relative_to_height(-0.5)); in test_relative_size()
836 split[0].fill(&RED).unwrap(); in test_relative_split()
837 split[1].fill(&BLUE).unwrap(); in test_relative_split()
838 split[2].fill(&GREEN).unwrap(); in test_relative_split()
839 split[3].fill(&WHITE).unwrap(); in test_relative_split()
857 drawing_area.fill(&RED).unwrap(); in test_relative_shrink()