make BitVec type alias pub
This commit is contained in:
		
							parent
							
								
									c7dc935984
								
							
						
					
					
						commit
						d0598446e6
					
				
					 3 changed files with 10 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -2,14 +2,14 @@ use bitvec::order::Msb0;
 | 
			
		|||
use bitvec::prelude::BitSlice;
 | 
			
		||||
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.
 | 
			
		||||
#[derive(Debug, Clone, PartialEq)]
 | 
			
		||||
pub struct Bitmap {
 | 
			
		||||
    width: usize,
 | 
			
		||||
    height: usize,
 | 
			
		||||
    bit_vec: SpBitVec,
 | 
			
		||||
    bit_vec: BitVec,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Bitmap {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,9 @@
 | 
			
		|||
use bitvec::prelude::BitVec;
 | 
			
		||||
 | 
			
		||||
use crate::{
 | 
			
		||||
    command_code::CommandCode,
 | 
			
		||||
    compression::into_decompressed,
 | 
			
		||||
    packet::{Header, Packet},
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +142,7 @@ pub enum Command {
 | 
			
		|||
    /// once the starting row is full, overwriting will continue on column 0.
 | 
			
		||||
    ///
 | 
			
		||||
    /// 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.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -152,7 +150,7 @@ pub enum Command {
 | 
			
		|||
    /// once the starting row is full, overwriting will continue on column 0.
 | 
			
		||||
    ///
 | 
			
		||||
    /// 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.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +158,7 @@ pub enum Command {
 | 
			
		|||
    /// once the starting row is full, overwriting will continue on column 0.
 | 
			
		||||
    ///
 | 
			
		||||
    /// 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.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +166,7 @@ pub enum Command {
 | 
			
		|||
    /// once the starting row is full, overwriting will continue on column 0.
 | 
			
		||||
    ///
 | 
			
		||||
    /// 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.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -374,7 +372,7 @@ impl Command {
 | 
			
		|||
    /// Helper method for Packets into `BitmapLinear*`-Commands
 | 
			
		||||
    fn packet_into_linear_bitmap(
 | 
			
		||||
        packet: Packet,
 | 
			
		||||
    ) -> Result<(SpBitVec, CompressionCode), TryFromPacketError> {
 | 
			
		||||
    ) -> Result<(BitVec, CompressionCode), TryFromPacketError> {
 | 
			
		||||
        let Packet {
 | 
			
		||||
            header:
 | 
			
		||||
                Header {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,6 @@
 | 
			
		|||
use std::time::Duration;
 | 
			
		||||
 | 
			
		||||
pub use bitvec;
 | 
			
		||||
use bitvec::prelude::{BitVec, Msb0};
 | 
			
		||||
 | 
			
		||||
pub use crate::bitmap::Bitmap;
 | 
			
		||||
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::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 brightness;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue