use crate::{ commands::wrap_command, macros::{wrap_fields, wrap_functions}, mem::{heap_move_nonnull, heap_remove}, }; use servicepoint::{ BinaryOperation, BitVecCommand, CompressionCode, DisplayBitVec, Offset, }; use std::ptr::NonNull; wrap_command!(BitVec); wrap_fields!(BitVecCommand; prop bitvec: DisplayBitVec { mut get(); move set(value); }; prop offset: Offset { get(); set(value); }; prop operation: BinaryOperation { get(); set(value); }; prop compression: CompressionCode { get(); set(value); }; ); wrap_functions!(associate BitVecCommand; /// Set pixel data starting at the pixel offset on screen. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// /// The [`BinaryOperation`] will be applied on the display comparing old and sent bit. /// /// `new_bit = old_bit op sent_bit` /// /// For example, [`BinaryOperation::Or`] can be used to turn on some pixels without affecting other pixels. /// /// The contained [`DisplayBitVec`] is always uncompressed. fn new( bitvec: NonNull, offset: usize, operation: BinaryOperation, compression: CompressionCode, ) -> NonNull { heap_move_nonnull(BitVecCommand { bitvec: unsafe { heap_remove(bitvec) }, offset, operation, compression, }) } );