Reformat using cargofmt
This commit is contained in:
@@ -7,8 +7,6 @@ use image::DynamicImage;
|
||||
|
||||
use rect::Rect;
|
||||
|
||||
|
||||
|
||||
/// A handle to a painter thread.
|
||||
///
|
||||
/// This also holds a channel to the painter thread,
|
||||
@@ -33,16 +31,12 @@ impl Handle {
|
||||
/// Push an image update.
|
||||
pub fn update_image(&self, full_image: &mut DynamicImage) {
|
||||
// Crop the image to the area
|
||||
let image = full_image.crop(
|
||||
self.area.x,
|
||||
self.area.y,
|
||||
self.area.w,
|
||||
self.area.h,
|
||||
);
|
||||
let image = full_image.crop(self.area.x, self.area.y, self.area.w, self.area.h);
|
||||
|
||||
// Push a new image to the thread
|
||||
// TODO: return this result
|
||||
self.image_sender.send(image)
|
||||
self.image_sender
|
||||
.send(image)
|
||||
.expect("Failed to send image update to painter");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// Reexport modules
|
||||
pub mod painter;
|
||||
pub mod handle;
|
||||
pub mod painter;
|
||||
|
||||
@@ -7,8 +7,6 @@ use color::Color;
|
||||
use pix::client::Client;
|
||||
use rect::Rect;
|
||||
|
||||
|
||||
|
||||
/// A painter that paints on a pixelflut panel.
|
||||
pub struct Painter {
|
||||
client: Client,
|
||||
@@ -19,7 +17,12 @@ pub struct Painter {
|
||||
|
||||
impl Painter {
|
||||
/// Create a new painter.
|
||||
pub fn new(client: Client, area: Rect, offset: (u32, u32), image: Option<DynamicImage>) -> Painter {
|
||||
pub fn new(
|
||||
client: Client,
|
||||
area: Rect,
|
||||
offset: (u32, u32),
|
||||
image: Option<DynamicImage>,
|
||||
) -> Painter {
|
||||
Painter {
|
||||
client,
|
||||
area,
|
||||
@@ -61,15 +64,11 @@ impl Painter {
|
||||
// Get the pixel at this location
|
||||
let pixel = image.get_pixel(x, y);
|
||||
|
||||
// Get the channels
|
||||
let channels = pixel.channels();
|
||||
// Get the channels
|
||||
let channels = pixel.channels();
|
||||
|
||||
// Define the color
|
||||
let color = Color::from(
|
||||
channels[0],
|
||||
channels[1],
|
||||
channels[2],
|
||||
);
|
||||
// Define the color
|
||||
let color = Color::from(channels[0], channels[1], channels[2]);
|
||||
|
||||
// Set the pixel
|
||||
self.client.write_pixel(
|
||||
|
||||
Reference in New Issue
Block a user