mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 10:00:14 +01:00
make BitVec type alias pub
This commit is contained in:
parent
c7dc935984
commit
d0598446e6
|
@ -2,14 +2,14 @@ use bitvec::order::Msb0;
|
||||||
use bitvec::prelude::BitSlice;
|
use bitvec::prelude::BitSlice;
|
||||||
use bitvec::slice::IterMut;
|
use bitvec::slice::IterMut;
|
||||||
|
|
||||||
use crate::{BitVec, DataRef, Grid, SpBitVec, PIXEL_HEIGHT, PIXEL_WIDTH};
|
use crate::{BitVec, DataRef, Grid, PIXEL_HEIGHT, PIXEL_WIDTH};
|
||||||
|
|
||||||
/// A grid of pixels stored in packed bytes.
|
/// A grid of pixels stored in packed bytes.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct Bitmap {
|
pub struct Bitmap {
|
||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
bit_vec: SpBitVec,
|
bit_vec: BitVec,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bitmap {
|
impl Bitmap {
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
use bitvec::prelude::BitVec;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
command_code::CommandCode,
|
command_code::CommandCode,
|
||||||
compression::into_decompressed,
|
compression::into_decompressed,
|
||||||
packet::{Header, Packet},
|
packet::{Header, Packet},
|
||||||
Bitmap, Brightness, BrightnessGrid, CompressionCode, Cp437Grid, Origin,
|
Bitmap, Brightness, BrightnessGrid, CompressionCode, Cp437Grid, Origin,
|
||||||
Pixels, PrimitiveGrid, SpBitVec, Tiles, TILE_SIZE,
|
Pixels, PrimitiveGrid, BitVec, Tiles, TILE_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type alias for documenting the meaning of the u16 in enum values
|
/// Type alias for documenting the meaning of the u16 in enum values
|
||||||
|
@ -144,7 +142,7 @@ pub enum Command {
|
||||||
/// once the starting row is full, overwriting will continue on column 0.
|
/// once the starting row is full, overwriting will continue on column 0.
|
||||||
///
|
///
|
||||||
/// The contained [BitVec] is always uncompressed.
|
/// The contained [BitVec] is always uncompressed.
|
||||||
BitmapLinear(Offset, SpBitVec, CompressionCode),
|
BitmapLinear(Offset, BitVec, CompressionCode),
|
||||||
|
|
||||||
/// Set pixel data according to an and-mask starting at the offset.
|
/// Set pixel data according to an and-mask starting at the offset.
|
||||||
///
|
///
|
||||||
|
@ -152,7 +150,7 @@ pub enum Command {
|
||||||
/// once the starting row is full, overwriting will continue on column 0.
|
/// once the starting row is full, overwriting will continue on column 0.
|
||||||
///
|
///
|
||||||
/// The contained [BitVec] is always uncompressed.
|
/// The contained [BitVec] is always uncompressed.
|
||||||
BitmapLinearAnd(Offset, SpBitVec, CompressionCode),
|
BitmapLinearAnd(Offset, BitVec, CompressionCode),
|
||||||
|
|
||||||
/// Set pixel data according to an or-mask starting at the offset.
|
/// Set pixel data according to an or-mask starting at the offset.
|
||||||
///
|
///
|
||||||
|
@ -160,7 +158,7 @@ pub enum Command {
|
||||||
/// once the starting row is full, overwriting will continue on column 0.
|
/// once the starting row is full, overwriting will continue on column 0.
|
||||||
///
|
///
|
||||||
/// The contained [BitVec] is always uncompressed.
|
/// The contained [BitVec] is always uncompressed.
|
||||||
BitmapLinearOr(Offset, SpBitVec, CompressionCode),
|
BitmapLinearOr(Offset, BitVec, CompressionCode),
|
||||||
|
|
||||||
/// Set pixel data according to a xor-mask starting at the offset.
|
/// Set pixel data according to a xor-mask starting at the offset.
|
||||||
///
|
///
|
||||||
|
@ -168,7 +166,7 @@ pub enum Command {
|
||||||
/// once the starting row is full, overwriting will continue on column 0.
|
/// once the starting row is full, overwriting will continue on column 0.
|
||||||
///
|
///
|
||||||
/// The contained [BitVec] is always uncompressed.
|
/// The contained [BitVec] is always uncompressed.
|
||||||
BitmapLinearXor(Offset, SpBitVec, CompressionCode),
|
BitmapLinearXor(Offset, BitVec, CompressionCode),
|
||||||
|
|
||||||
/// Kills the udp daemon on the display, which usually results in a restart.
|
/// Kills the udp daemon on the display, which usually results in a restart.
|
||||||
///
|
///
|
||||||
|
@ -374,7 +372,7 @@ impl Command {
|
||||||
/// Helper method for Packets into `BitmapLinear*`-Commands
|
/// Helper method for Packets into `BitmapLinear*`-Commands
|
||||||
fn packet_into_linear_bitmap(
|
fn packet_into_linear_bitmap(
|
||||||
packet: Packet,
|
packet: Packet,
|
||||||
) -> Result<(SpBitVec, CompressionCode), TryFromPacketError> {
|
) -> Result<(BitVec, CompressionCode), TryFromPacketError> {
|
||||||
let Packet {
|
let Packet {
|
||||||
header:
|
header:
|
||||||
Header {
|
Header {
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
pub use bitvec;
|
pub use bitvec;
|
||||||
use bitvec::prelude::{BitVec, Msb0};
|
|
||||||
|
|
||||||
pub use crate::bitmap::Bitmap;
|
pub use crate::bitmap::Bitmap;
|
||||||
pub use crate::brightness::{Brightness, BrightnessGrid};
|
pub use crate::brightness::{Brightness, BrightnessGrid};
|
||||||
|
@ -51,7 +50,8 @@ pub use crate::grid::Grid;
|
||||||
pub use crate::origin::{Origin, Pixels, Tiles};
|
pub use crate::origin::{Origin, Pixels, Tiles};
|
||||||
pub use crate::primitive_grid::PrimitiveGrid;
|
pub use crate::primitive_grid::PrimitiveGrid;
|
||||||
|
|
||||||
type SpBitVec = BitVec<u8, Msb0>;
|
/// An alias for the specific type of [bitvec::prelude::BitVec] used.
|
||||||
|
pub type BitVec = bitvec::prelude::BitVec<u8, bitvec::prelude::Msb0>;
|
||||||
|
|
||||||
mod bitmap;
|
mod bitmap;
|
||||||
mod brightness;
|
mod brightness;
|
||||||
|
|
Loading…
Reference in a new issue