mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Update readme, slash configs
This commit is contained in:
@@ -22,11 +22,17 @@ const BLOCK_END: usize = 634;
|
||||
const PANE_LEN: usize = BLOCK_END - BLOCK_START;
|
||||
|
||||
/// First packet is for GA401 + GA402
|
||||
pub const USB_PREFIX1: [u8; 7] = [0x5e, 0xc0, 0x02, 0x01, 0x00, 0x73, 0x02];
|
||||
pub const USB_PREFIX1: [u8; 7] = [
|
||||
0x5e, 0xc0, 0x02, 0x01, 0x00, 0x73, 0x02
|
||||
];
|
||||
/// Second packet is for GA401 + GA402
|
||||
pub const USB_PREFIX2: [u8; 7] = [0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02];
|
||||
pub const USB_PREFIX2: [u8; 7] = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02
|
||||
];
|
||||
/// Third packet is for GA402 matrix
|
||||
pub const USB_PREFIX3: [u8; 7] = [0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02];
|
||||
pub const USB_PREFIX3: [u8; 7] = [
|
||||
0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02
|
||||
];
|
||||
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Default, Deserialize, PartialEq, Eq, Clone, Copy, Serialize, Debug)]
|
||||
@@ -34,7 +40,7 @@ pub struct Animations {
|
||||
pub boot: AnimBooting,
|
||||
pub awake: AnimAwake,
|
||||
pub sleep: AnimSleeping,
|
||||
pub shutdown: AnimShutdown,
|
||||
pub shutdown: AnimShutdown
|
||||
}
|
||||
|
||||
// TODO: move this out
|
||||
@@ -48,7 +54,7 @@ pub struct DeviceState {
|
||||
pub off_when_unplugged: bool,
|
||||
pub off_when_suspended: bool,
|
||||
pub off_when_lid_closed: bool,
|
||||
pub brightness_on_battery: Brightness,
|
||||
pub brightness_on_battery: Brightness
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
@@ -58,7 +64,7 @@ pub enum AnimeType {
|
||||
GA402,
|
||||
GU604,
|
||||
#[default]
|
||||
Unsupported,
|
||||
Unsupported
|
||||
}
|
||||
|
||||
impl FromStr for AnimeType {
|
||||
@@ -69,7 +75,7 @@ impl FromStr for AnimeType {
|
||||
"ga401" | "GA401" => Self::GA401,
|
||||
"ga402" | "GA402" => Self::GA402,
|
||||
"gu604" | "GU604" => Self::GU604,
|
||||
_ => Self::Unsupported,
|
||||
_ => Self::Unsupported
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -92,7 +98,7 @@ impl AnimeType {
|
||||
pub fn width(&self) -> usize {
|
||||
match self {
|
||||
AnimeType::GU604 => 70,
|
||||
_ => 74,
|
||||
_ => 74
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +107,7 @@ impl AnimeType {
|
||||
match self {
|
||||
AnimeType::GA401 => 36,
|
||||
AnimeType::GU604 => 43,
|
||||
_ => 39,
|
||||
_ => 39
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +116,7 @@ impl AnimeType {
|
||||
match self {
|
||||
AnimeType::GA401 => PANE_LEN * 2,
|
||||
AnimeType::GU604 => PANE_LEN * 3,
|
||||
_ => PANE_LEN * 3,
|
||||
_ => PANE_LEN * 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +127,7 @@ impl AnimeType {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct AnimeDataBuffer {
|
||||
data: Vec<u8>,
|
||||
anime: AnimeType,
|
||||
anime: AnimeType
|
||||
}
|
||||
|
||||
impl AnimeDataBuffer {
|
||||
@@ -131,7 +137,7 @@ impl AnimeDataBuffer {
|
||||
|
||||
AnimeDataBuffer {
|
||||
data: vec![0u8; len],
|
||||
anime,
|
||||
anime
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +180,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
|
||||
let mut buffers = match anime.anime {
|
||||
AnimeType::GA401 => vec![[0; 640]; 2],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported => vec![[0; 640]; 3],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported => vec![[0; 640]; 3]
|
||||
};
|
||||
|
||||
for (idx, chunk) in anime.data.as_slice().chunks(PANE_LEN).enumerate() {
|
||||
|
||||
@@ -20,7 +20,7 @@ impl AnimeDiagonal {
|
||||
Self(
|
||||
anime_type,
|
||||
vec![vec![0; anime_type.width()]; anime_type.height()],
|
||||
duration,
|
||||
duration
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ impl AnimeDiagonal {
|
||||
path: &Path,
|
||||
duration: Option<Duration>,
|
||||
bright: f32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
let data = std::fs::read(path).map_err(|e| {
|
||||
error!("Could not open {path:?}: {e:?}");
|
||||
@@ -86,7 +86,7 @@ impl AnimeDiagonal {
|
||||
png_pong::PngRaster::Rgba16(ras) => {
|
||||
Self::pixels_from_16bit(ras, &mut matrix, bright, false);
|
||||
}
|
||||
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format),
|
||||
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format)
|
||||
};
|
||||
|
||||
Ok(matrix)
|
||||
@@ -96,9 +96,9 @@ impl AnimeDiagonal {
|
||||
ras: &pix::Raster<P>,
|
||||
matrix: &mut AnimeDiagonal,
|
||||
bright: f32,
|
||||
grey: bool,
|
||||
grey: bool
|
||||
) where
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>
|
||||
{
|
||||
let width = ras.width();
|
||||
for (y, row) in ras.pixels().chunks(width as usize).enumerate() {
|
||||
@@ -121,9 +121,9 @@ impl AnimeDiagonal {
|
||||
ras: &pix::Raster<P>,
|
||||
matrix: &mut AnimeDiagonal,
|
||||
bright: f32,
|
||||
grey: bool,
|
||||
grey: bool
|
||||
) where
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch16>,
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch16>
|
||||
{
|
||||
let width = ras.width();
|
||||
for (y, row) in ras.pixels().chunks(width as usize).enumerate() {
|
||||
@@ -146,7 +146,7 @@ impl AnimeDiagonal {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => self.to_ga401_packets(),
|
||||
AnimeType::GU604 => self.to_gu604_packets(),
|
||||
_ => self.to_ga402_packets(),
|
||||
_ => self.to_ga402_packets()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ impl AnimeDiagonal {
|
||||
x: usize,
|
||||
y: usize,
|
||||
start_index: &mut usize,
|
||||
len: usize,
|
||||
len: usize
|
||||
) {
|
||||
buf[*start_index..*start_index + len].copy_from_slice(&anime.get_row(x, y, len));
|
||||
*start_index += len;
|
||||
@@ -307,7 +307,7 @@ impl AnimeDiagonal {
|
||||
x: usize,
|
||||
y: usize,
|
||||
start_index: &mut usize,
|
||||
len: usize,
|
||||
len: usize
|
||||
) {
|
||||
buf[*start_index..*start_index + len].copy_from_slice(&anime.get_row(x, y, len));
|
||||
*start_index += len;
|
||||
|
||||
@@ -24,7 +24,7 @@ pub enum AnimeError {
|
||||
DataBufferLength,
|
||||
PixelGifWidth(usize),
|
||||
PixelGifHeight(usize),
|
||||
ParseError(String),
|
||||
ParseError(String)
|
||||
}
|
||||
|
||||
impl fmt::Display for AnimeError {
|
||||
@@ -61,7 +61,7 @@ impl fmt::Display for AnimeError {
|
||||
AnimeError::PixelGifHeight(n) => write!(
|
||||
f,
|
||||
"The gif used for pixel-perfect gif is is taller than {n}"
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ pub struct AnimeFrame {
|
||||
/// the `asusd` daemon over dbus or converted to USB packet with
|
||||
/// `AnimePacketType::from(buffer)`
|
||||
data: AnimeDataBuffer,
|
||||
delay: Duration,
|
||||
delay: Duration
|
||||
}
|
||||
|
||||
impl AnimeFrame {
|
||||
@@ -44,7 +44,7 @@ pub enum AnimTime {
|
||||
/// Run for infinite time
|
||||
Infinite,
|
||||
/// Fade in, play for, fade out
|
||||
Fade(Fade),
|
||||
Fade(Fade)
|
||||
}
|
||||
|
||||
impl Default for AnimTime {
|
||||
@@ -59,7 +59,7 @@ impl Default for AnimTime {
|
||||
pub struct Fade {
|
||||
fade_in: Duration,
|
||||
show_for: Option<Duration>,
|
||||
fade_out: Duration,
|
||||
fade_out: Duration
|
||||
}
|
||||
|
||||
impl Fade {
|
||||
@@ -67,7 +67,7 @@ impl Fade {
|
||||
Self {
|
||||
fade_in,
|
||||
show_for,
|
||||
fade_out,
|
||||
fade_out
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ impl AnimeGif {
|
||||
file_name: &Path,
|
||||
duration: AnimTime,
|
||||
brightness: f32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
let mut matrix = AnimeDiagonal::new(anime_type, None);
|
||||
|
||||
@@ -142,7 +142,7 @@ impl AnimeGif {
|
||||
|
||||
frames.push(AnimeFrame {
|
||||
data: matrix.into_data_buffer(anime_type)?,
|
||||
delay: Duration::from_millis(wait as u64),
|
||||
delay: Duration::from_millis(wait as u64)
|
||||
});
|
||||
}
|
||||
Ok(Self(frames, duration))
|
||||
@@ -154,7 +154,7 @@ impl AnimeGif {
|
||||
file_name: &Path,
|
||||
anime_type: AnimeType,
|
||||
duration: AnimTime,
|
||||
brightness: f32,
|
||||
brightness: f32
|
||||
) -> Result<Self> {
|
||||
let image = AnimeDiagonal::from_png(file_name, None, brightness, anime_type)?;
|
||||
|
||||
@@ -170,7 +170,7 @@ impl AnimeGif {
|
||||
|
||||
let single = AnimeFrame {
|
||||
data: image.into_data_buffer(anime_type)?,
|
||||
delay: Duration::from_millis(30),
|
||||
delay: Duration::from_millis(30)
|
||||
};
|
||||
let frames = vec![single; frame_count as usize];
|
||||
|
||||
@@ -187,7 +187,7 @@ impl AnimeGif {
|
||||
translation: Vec2,
|
||||
duration: AnimTime,
|
||||
brightness: f32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
let mut frames = Vec::new();
|
||||
let mut decoder = gif::DecodeOptions::new();
|
||||
@@ -211,7 +211,7 @@ impl AnimeGif {
|
||||
brightness,
|
||||
pixels,
|
||||
decoder.width() as u32,
|
||||
anime_type,
|
||||
anime_type
|
||||
)?;
|
||||
|
||||
while let Some(frame) = decoder.read_next_frame()? {
|
||||
@@ -226,7 +226,7 @@ impl AnimeGif {
|
||||
brightness,
|
||||
pixels,
|
||||
width as u32,
|
||||
anime_type,
|
||||
anime_type
|
||||
)?;
|
||||
}
|
||||
for (y, row) in frame.buffer.chunks(frame.width as usize * 4).enumerate() {
|
||||
@@ -239,7 +239,7 @@ impl AnimeGif {
|
||||
(x + frame.left as usize) + ((y + frame.top as usize) * width as usize);
|
||||
image.get_mut()[pos] = Pixel {
|
||||
color: ((px[0] as u32 + px[1] as u32 + px[2] as u32) / 3),
|
||||
alpha: 1.0,
|
||||
alpha: 1.0
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ impl AnimeGif {
|
||||
|
||||
frames.push(AnimeFrame {
|
||||
data: <AnimeDataBuffer>::try_from(&image)?,
|
||||
delay: Duration::from_millis(wait as u64),
|
||||
delay: Duration::from_millis(wait as u64)
|
||||
});
|
||||
}
|
||||
Ok(Self(frames, duration))
|
||||
@@ -265,7 +265,7 @@ impl AnimeGif {
|
||||
translation: Vec2,
|
||||
duration: AnimTime,
|
||||
brightness: f32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
let image =
|
||||
AnimeImage::from_png(file_name, scale, angle, translation, brightness, anime_type)?;
|
||||
@@ -282,7 +282,7 @@ impl AnimeGif {
|
||||
|
||||
let single = AnimeFrame {
|
||||
data: <AnimeDataBuffer>::try_from(&image)?,
|
||||
delay: Duration::from_millis(30),
|
||||
delay: Duration::from_millis(30)
|
||||
};
|
||||
let frames = vec![single; frame_count as usize];
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ const HEIGHT: usize = 55;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AnimeGrid {
|
||||
anime_type: AnimeType,
|
||||
data: [[u8; WIDTH]; HEIGHT],
|
||||
data: [[u8; WIDTH]; HEIGHT]
|
||||
}
|
||||
|
||||
impl AnimeGrid {
|
||||
@@ -26,7 +26,7 @@ impl AnimeGrid {
|
||||
pub fn new(anime_type: AnimeType) -> Self {
|
||||
Self {
|
||||
anime_type,
|
||||
data: [[0u8; WIDTH]; HEIGHT],
|
||||
data: [[0u8; WIDTH]; HEIGHT]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ mod tests {
|
||||
0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
];
|
||||
assert_eq!(matrix.data(), &data_cmp);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::AnimeType;
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Pixel {
|
||||
pub color: u32,
|
||||
pub alpha: f32,
|
||||
pub alpha: f32
|
||||
}
|
||||
|
||||
impl Default for Pixel {
|
||||
@@ -21,7 +21,7 @@ impl Default for Pixel {
|
||||
fn default() -> Self {
|
||||
Pixel {
|
||||
color: 0,
|
||||
alpha: 0.0,
|
||||
alpha: 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ pub struct AnimeImage {
|
||||
/// The type of the display. The GA401 and GA402 use the same controller and
|
||||
/// therefore same ID, so the identifier must be by laptop model in
|
||||
/// `AnimeType`.
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
}
|
||||
|
||||
impl AnimeImage {
|
||||
@@ -88,7 +88,7 @@ impl AnimeImage {
|
||||
bright: f32,
|
||||
pixels: Vec<Pixel>,
|
||||
width: u32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
if !(0.0..=1.0).contains(&bright) {
|
||||
return Err(AnimeError::InvalidBrightness(bright));
|
||||
@@ -102,7 +102,7 @@ impl AnimeImage {
|
||||
led_pos: Self::generate_image_positioning(anime_type),
|
||||
img_pixels: pixels,
|
||||
width,
|
||||
anime_type,
|
||||
anime_type
|
||||
})
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.8,
|
||||
AnimeType::GU604 => 0.78,
|
||||
_ => 0.77,
|
||||
_ => 0.77
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.3,
|
||||
AnimeType::GU604 => 0.28,
|
||||
_ => 0.283,
|
||||
_ => 0.283
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ impl AnimeImage {
|
||||
AnimeType::GA401 => (33.0 + 0.5) * Self::scale_x(anime_type),
|
||||
|
||||
AnimeType::GU604 => (38.0 + 0.5) * Self::scale_x(anime_type),
|
||||
_ => (35.0 + 0.5) * Self::scale_x(anime_type),
|
||||
_ => (35.0 + 0.5) * Self::scale_x(anime_type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 55,
|
||||
AnimeType::GU604 => 62,
|
||||
_ => 61,
|
||||
_ => 61
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ impl AnimeImage {
|
||||
AnimeType::GA401 => (54.0 + 1.0) * Self::scale_y(anime_type),
|
||||
AnimeType::GU604 => 62.0 * Self::scale_y(anime_type),
|
||||
// GA402 may not have dead pixels and require only the physical LED count
|
||||
_ => 61.0 * Self::scale_y(anime_type),
|
||||
_ => 61.0 * Self::scale_y(anime_type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,11 +267,11 @@ impl AnimeImage {
|
||||
AnimeType::GA401 => match y {
|
||||
0 | 2 | 4 => 33,
|
||||
1 | 3 => 35, // Some rows are padded
|
||||
_ => 36 - y / 2,
|
||||
_ => 36 - y / 2
|
||||
},
|
||||
AnimeType::GU604 => AnimeImage::width(anime_type, y),
|
||||
// GA402 does not have padding, equivalent to width
|
||||
_ => AnimeImage::width(anime_type, y),
|
||||
_ => AnimeImage::width(anime_type, y)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +321,9 @@ impl AnimeImage {
|
||||
let pos = Vec3::new(led.x(), led.y(), 1.0);
|
||||
let x0 = led_from_px.mul_vec3(pos + Vec3::new(0.0, -0.5, 0.0));
|
||||
|
||||
const GROUP: [f32; 4] = [0.0, 0.5, 1.0, 1.5];
|
||||
const GROUP: [f32; 4] = [
|
||||
0.0, 0.5, 1.0, 1.5
|
||||
];
|
||||
for u in &GROUP {
|
||||
for v in &GROUP {
|
||||
let sample = x0 + *u * du + *v * dv;
|
||||
@@ -397,7 +399,7 @@ impl AnimeImage {
|
||||
|
||||
let led_from_cm = Mat3::from_scale(Vec2::new(
|
||||
1.0 / AnimeImage::scale_x(self.anime_type),
|
||||
1.0 / AnimeImage::scale_y(self.anime_type),
|
||||
1.0 / AnimeImage::scale_y(self.anime_type)
|
||||
));
|
||||
|
||||
let transform =
|
||||
@@ -420,7 +422,7 @@ impl AnimeImage {
|
||||
angle: f32,
|
||||
translation: Vec2,
|
||||
bright: f32,
|
||||
anime_type: AnimeType,
|
||||
anime_type: AnimeType
|
||||
) -> Result<Self> {
|
||||
let data = std::fs::read(path).map_err(|e| {
|
||||
error!("Could not open {path:?}: {e:?}");
|
||||
@@ -464,7 +466,7 @@ impl AnimeImage {
|
||||
width = ras.width();
|
||||
Self::pixels_from_16bit(ras, false)
|
||||
}
|
||||
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format),
|
||||
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format)
|
||||
};
|
||||
|
||||
let mut matrix = AnimeImage::new(
|
||||
@@ -474,7 +476,7 @@ impl AnimeImage {
|
||||
bright,
|
||||
pixels,
|
||||
width,
|
||||
anime_type,
|
||||
anime_type
|
||||
)?;
|
||||
|
||||
matrix.update();
|
||||
@@ -483,7 +485,7 @@ impl AnimeImage {
|
||||
|
||||
fn pixels_from_8bit<P>(ras: &pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
||||
where
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>
|
||||
{
|
||||
ras.pixels()
|
||||
.iter()
|
||||
@@ -495,14 +497,14 @@ impl AnimeImage {
|
||||
+ (<u8>::from(px.two()) / 3) as u32
|
||||
+ (<u8>::from(px.three()) / 3) as u32
|
||||
},
|
||||
alpha: <f32>::from(px.alpha()),
|
||||
alpha: <f32>::from(px.alpha())
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn pixels_from_16bit<P>(ras: &pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
||||
where
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch16>,
|
||||
P: pix::el::Pixel<Chan = pix::chan::Ch16>
|
||||
{
|
||||
ras.pixels()
|
||||
.iter()
|
||||
@@ -514,7 +516,7 @@ impl AnimeImage {
|
||||
+ ((<u16>::from(px.two()) / 3) >> 8) as u32
|
||||
+ ((<u16>::from(px.three()) / 3) >> 8) as u32
|
||||
},
|
||||
alpha: <f32>::from(px.alpha()),
|
||||
alpha: <f32>::from(px.alpha())
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -651,7 +653,7 @@ mod tests {
|
||||
Vec2::default(),
|
||||
AnimTime::Infinite,
|
||||
1.0,
|
||||
AnimeType::GA402,
|
||||
AnimeType::GA402
|
||||
)
|
||||
.unwrap();
|
||||
matrix.frames()[0].frame();
|
||||
|
||||
@@ -16,13 +16,13 @@ pub enum ActionLoader {
|
||||
AsusAnimation {
|
||||
file: PathBuf,
|
||||
time: AnimTime,
|
||||
brightness: f32,
|
||||
brightness: f32
|
||||
},
|
||||
/// Image designed to be pixel perfect using the slanted template
|
||||
AsusImage {
|
||||
file: PathBuf,
|
||||
time: AnimTime,
|
||||
brightness: f32,
|
||||
brightness: f32
|
||||
},
|
||||
/// Animated gif. If the file is a png a static gif is created using the
|
||||
/// `time` properties
|
||||
@@ -32,7 +32,7 @@ pub enum ActionLoader {
|
||||
angle: f32,
|
||||
translation: Vec2,
|
||||
time: AnimTime,
|
||||
brightness: f32,
|
||||
brightness: f32
|
||||
},
|
||||
Image {
|
||||
file: PathBuf,
|
||||
@@ -40,10 +40,10 @@ pub enum ActionLoader {
|
||||
angle: f32,
|
||||
translation: Vec2,
|
||||
time: AnimTime,
|
||||
brightness: f32,
|
||||
brightness: f32
|
||||
},
|
||||
/// A pause to be used between sequences
|
||||
Pause(Duration),
|
||||
Pause(Duration)
|
||||
}
|
||||
|
||||
/// All the possible `AniMe` actions that can be used. The enum is intended to
|
||||
@@ -64,7 +64,7 @@ pub enum ActionData {
|
||||
/// Placeholder
|
||||
TimeDate,
|
||||
/// Placeholder
|
||||
Matrix,
|
||||
Matrix
|
||||
}
|
||||
|
||||
impl ActionData {
|
||||
@@ -73,17 +73,14 @@ impl ActionData {
|
||||
ActionLoader::AsusAnimation {
|
||||
file,
|
||||
time,
|
||||
brightness,
|
||||
brightness
|
||||
} => ActionData::Animation(AnimeGif::from_diagonal_gif(
|
||||
file,
|
||||
*time,
|
||||
*brightness,
|
||||
anime_type,
|
||||
file, *time, *brightness, anime_type
|
||||
)?),
|
||||
ActionLoader::AsusImage {
|
||||
file,
|
||||
time,
|
||||
brightness,
|
||||
brightness
|
||||
} => match time {
|
||||
AnimTime::Infinite => {
|
||||
let image = AnimeDiagonal::from_png(file, None, *brightness, anime_type)?;
|
||||
@@ -91,11 +88,8 @@ impl ActionData {
|
||||
ActionData::Image(Box::new(data))
|
||||
}
|
||||
_ => ActionData::Animation(AnimeGif::from_diagonal_png(
|
||||
file,
|
||||
anime_type,
|
||||
*time,
|
||||
*brightness,
|
||||
)?),
|
||||
file, anime_type, *time, *brightness
|
||||
)?)
|
||||
},
|
||||
ActionLoader::ImageAnimation {
|
||||
file,
|
||||
@@ -103,29 +97,17 @@ impl ActionData {
|
||||
angle,
|
||||
translation,
|
||||
time,
|
||||
brightness,
|
||||
brightness
|
||||
} => {
|
||||
if let Some(ext) = file.extension() {
|
||||
if ext.to_string_lossy().to_lowercase() == "png" {
|
||||
return Ok(ActionData::Animation(AnimeGif::from_png(
|
||||
file,
|
||||
*scale,
|
||||
*angle,
|
||||
*translation,
|
||||
*time,
|
||||
*brightness,
|
||||
anime_type,
|
||||
file, *scale, *angle, *translation, *time, *brightness, anime_type
|
||||
)?));
|
||||
}
|
||||
}
|
||||
ActionData::Animation(AnimeGif::from_gif(
|
||||
file,
|
||||
*scale,
|
||||
*angle,
|
||||
*translation,
|
||||
*time,
|
||||
*brightness,
|
||||
anime_type,
|
||||
file, *scale, *angle, *translation, *time, *brightness, anime_type
|
||||
)?)
|
||||
}
|
||||
ActionLoader::Image {
|
||||
@@ -134,34 +116,23 @@ impl ActionData {
|
||||
angle,
|
||||
translation,
|
||||
brightness,
|
||||
time,
|
||||
time
|
||||
} => {
|
||||
match time {
|
||||
AnimTime::Infinite => {
|
||||
// If no time then create a plain static image
|
||||
let image = AnimeImage::from_png(
|
||||
file,
|
||||
*scale,
|
||||
*angle,
|
||||
*translation,
|
||||
*brightness,
|
||||
anime_type,
|
||||
file, *scale, *angle, *translation, *brightness, anime_type
|
||||
)?;
|
||||
let data = <AnimeDataBuffer>::try_from(&image)?;
|
||||
ActionData::Image(Box::new(data))
|
||||
}
|
||||
_ => ActionData::Animation(AnimeGif::from_png(
|
||||
file,
|
||||
*scale,
|
||||
*angle,
|
||||
*translation,
|
||||
*time,
|
||||
*brightness,
|
||||
anime_type,
|
||||
)?),
|
||||
file, *scale, *angle, *translation, *time, *brightness, anime_type
|
||||
)?)
|
||||
}
|
||||
}
|
||||
ActionLoader::Pause(duration) => ActionData::Pause(*duration),
|
||||
ActionLoader::Pause(duration) => ActionData::Pause(*duration)
|
||||
};
|
||||
Ok(a)
|
||||
}
|
||||
@@ -200,7 +171,7 @@ impl Sequences {
|
||||
pub fn iter(&self) -> ActionIterator<'_> {
|
||||
ActionIterator {
|
||||
actions: self,
|
||||
next_idx: 0,
|
||||
next_idx: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +179,7 @@ impl Sequences {
|
||||
/// Iteractor helper for iterating over all the actions in `Sequences`
|
||||
pub struct ActionIterator<'a> {
|
||||
actions: &'a Sequences,
|
||||
next_idx: usize,
|
||||
next_idx: usize
|
||||
}
|
||||
|
||||
impl<'a> Iterator for ActionIterator<'a> {
|
||||
|
||||
@@ -35,7 +35,7 @@ pub enum Brightness {
|
||||
Low = 1,
|
||||
#[default]
|
||||
Med = 2,
|
||||
High = 3,
|
||||
High = 3
|
||||
}
|
||||
|
||||
impl FromStr for Brightness {
|
||||
@@ -47,7 +47,7 @@ impl FromStr for Brightness {
|
||||
"Low" | "low" => Brightness::Low,
|
||||
"Med" | "med" => Brightness::Med,
|
||||
"High" | "high" => Brightness::High,
|
||||
_ => Brightness::Med,
|
||||
_ => Brightness::Med
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ impl From<u8> for Brightness {
|
||||
0 => Brightness::Off,
|
||||
1 => Brightness::Low,
|
||||
3 => Brightness::High,
|
||||
_ => Brightness::Med,
|
||||
_ => Brightness::Med
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ impl From<Brightness> for i32 {
|
||||
pub enum AnimBooting {
|
||||
#[default]
|
||||
GlitchConstruction = 0,
|
||||
StaticEmergence = 1,
|
||||
StaticEmergence = 1
|
||||
}
|
||||
|
||||
impl FromStr for AnimBooting {
|
||||
@@ -94,7 +94,7 @@ impl FromStr for AnimBooting {
|
||||
match s {
|
||||
"GlitchConstruction" => Ok(Self::GlitchConstruction),
|
||||
"StaticEmergence" => Ok(Self::StaticEmergence),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ impl From<i32> for AnimBooting {
|
||||
match value {
|
||||
0 => Self::GlitchConstruction,
|
||||
1 => Self::StaticEmergence,
|
||||
_ => Self::default(),
|
||||
_ => Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ impl From<AnimBooting> for i32 {
|
||||
pub enum AnimAwake {
|
||||
#[default]
|
||||
BinaryBannerScroll = 0,
|
||||
RogLogoGlitch = 1,
|
||||
RogLogoGlitch = 1
|
||||
}
|
||||
|
||||
impl FromStr for AnimAwake {
|
||||
@@ -134,7 +134,7 @@ impl FromStr for AnimAwake {
|
||||
match s {
|
||||
"BinaryBannerScroll" => Ok(Self::BinaryBannerScroll),
|
||||
"RogLogoGlitch" => Ok(Self::RogLogoGlitch),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ impl From<i32> for AnimAwake {
|
||||
match value {
|
||||
0 => Self::BinaryBannerScroll,
|
||||
1 => Self::RogLogoGlitch,
|
||||
_ => Self::default(),
|
||||
_ => Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ impl From<AnimAwake> for i32 {
|
||||
pub enum AnimSleeping {
|
||||
#[default]
|
||||
BannerSwipe = 0,
|
||||
Starfield = 1,
|
||||
Starfield = 1
|
||||
}
|
||||
|
||||
impl FromStr for AnimSleeping {
|
||||
@@ -174,7 +174,7 @@ impl FromStr for AnimSleeping {
|
||||
match s {
|
||||
"BannerSwipe" => Ok(Self::BannerSwipe),
|
||||
"Starfield" => Ok(Self::Starfield),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ impl From<i32> for AnimSleeping {
|
||||
match value {
|
||||
0 => Self::BannerSwipe,
|
||||
1 => Self::Starfield,
|
||||
_ => Self::default(),
|
||||
_ => Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ impl From<AnimSleeping> for i32 {
|
||||
pub enum AnimShutdown {
|
||||
#[default]
|
||||
GlitchOut = 0,
|
||||
SeeYa = 1,
|
||||
SeeYa = 1
|
||||
}
|
||||
|
||||
impl FromStr for AnimShutdown {
|
||||
@@ -214,7 +214,7 @@ impl FromStr for AnimShutdown {
|
||||
match s {
|
||||
"GlitchOut" => Ok(Self::GlitchOut),
|
||||
"SeeYa" => Ok(Self::SeeYa),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||
_ => Err(AnimeError::ParseError(s.to_owned()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,7 +224,7 @@ impl From<i32> for AnimShutdown {
|
||||
match value {
|
||||
0 => Self::GlitchOut,
|
||||
1 => Self::SeeYa,
|
||||
_ => Self::default(),
|
||||
_ => Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ pub const fn pkt_set_builtin_animations(
|
||||
boot: AnimBooting,
|
||||
awake: AnimAwake,
|
||||
sleep: AnimSleeping,
|
||||
shutdown: AnimShutdown,
|
||||
shutdown: AnimShutdown
|
||||
) -> [u8; PACKET_SIZE] {
|
||||
let mut pkt = [0; PACKET_SIZE];
|
||||
pkt[0] = DEV_PAGE;
|
||||
|
||||
@@ -52,7 +52,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -100,7 +100,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut matrix = AnimeImage::new(
|
||||
@@ -110,7 +110,7 @@ mod tests {
|
||||
0.0,
|
||||
vec![Pixel::default(); 1000],
|
||||
100,
|
||||
AnimeType::GA401,
|
||||
AnimeType::GA401
|
||||
)
|
||||
.unwrap();
|
||||
matrix.edge_outline();
|
||||
@@ -175,7 +175,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -223,7 +223,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
@@ -52,7 +52,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x2, 0x74, 0x2, 0x73, 0x2, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -100,7 +100,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt2_check = [
|
||||
0x5e, 0xc0, 0x2, 0xe7, 0x4, 0x73, 0x2, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
|
||||
@@ -148,7 +148,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut matrix = AnimeImage::new(
|
||||
@@ -158,7 +158,7 @@ mod tests {
|
||||
0.0,
|
||||
vec![Pixel::default(); 1000],
|
||||
100,
|
||||
AnimeType::GA402,
|
||||
AnimeType::GA402
|
||||
)
|
||||
.unwrap();
|
||||
matrix.edge_outline();
|
||||
@@ -218,7 +218,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
|
||||
@@ -266,7 +266,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt2_check = [
|
||||
0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||
@@ -314,7 +314,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
@@ -378,7 +378,7 @@ mod tests {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -426,7 +426,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt2_check = [
|
||||
0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
|
||||
@@ -474,7 +474,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
@@ -52,7 +52,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -100,7 +100,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt2_check = [
|
||||
0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -148,7 +148,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut matrix = AnimeImage::new(
|
||||
@@ -158,7 +158,7 @@ mod tests {
|
||||
0.0,
|
||||
vec![Pixel::default(); 1000],
|
||||
100,
|
||||
AnimeType::GU604,
|
||||
AnimeType::GU604
|
||||
)
|
||||
.unwrap();
|
||||
matrix.edge_outline();
|
||||
@@ -218,7 +218,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt1_check = [
|
||||
0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -266,7 +266,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
let pkt2_check = [
|
||||
0x5e, 0xc0, 0x02, 0xe7, 0x04, 0x73, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -314,7 +314,7 @@ mod tests {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
];
|
||||
|
||||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
Reference in New Issue
Block a user