init
This commit is contained in:
commit
eca5344c66
10 changed files with 445 additions and 0 deletions
45
encoder/src/enc.rs
Normal file
45
encoder/src/enc.rs
Normal file
|
@ -0,0 +1,45 @@
|
|||
use crate::*;
|
||||
|
||||
pub fn rle_horizontal(_prev_frame: &Frame, frame: &Frame) -> EncodedFrame {
|
||||
let mut pixels = Vec::new();
|
||||
for y in 0..HEIGHT {
|
||||
for x in 0..WIDTH {
|
||||
pixels.push(frame[x][y]);
|
||||
}
|
||||
}
|
||||
EncodedFrame {
|
||||
encoding: Encoding::RLEHorizontal,
|
||||
head_u4: 0,
|
||||
data: rle_255_encode(&pixels),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rle_vertical(_prev_frame: &Frame, frame: &Frame) -> EncodedFrame {
|
||||
let mut pixels = Vec::new();
|
||||
for x in 0..WIDTH {
|
||||
for y in 0..HEIGHT {
|
||||
pixels.push(frame[x][y]);
|
||||
}
|
||||
}
|
||||
EncodedFrame {
|
||||
encoding: Encoding::RLEVertical,
|
||||
head_u4: 0,
|
||||
data: rle_255_encode(&pixels),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_white(_prev_frame: &Frame, _frame: &Frame) -> EncodedFrame {
|
||||
EncodedFrame {
|
||||
encoding: Encoding::FillWhite,
|
||||
head_u4: 0,
|
||||
data: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_black(_prev_frame: &Frame, _frame: &Frame) -> EncodedFrame {
|
||||
EncodedFrame {
|
||||
encoding: Encoding::FillBlack,
|
||||
head_u4: 0,
|
||||
data: Vec::new(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue