wip BrightnessGrid

This commit is contained in:
Vinzenz Schroeter 2024-06-23 15:12:03 +02:00
parent e0647bacd6
commit c554fbd800
13 changed files with 162 additions and 86 deletions

View file

@ -2,10 +2,12 @@
//!
//! prefix `sp_byte_grid_`
use servicepoint::{ByteGrid, DataRef, Grid};
use servicepoint::{DataRef, Grid, PrimitiveGrid};
use crate::c_slice::CByteSlice;
pub type ByteGrid = PrimitiveGrid<u8>;
/// Creates a new `ByteGrid` with the specified dimensions.
///
/// returns: `ByteGrid` initialized to 0.

View file

@ -5,8 +5,8 @@
use std::ptr::null_mut;
use servicepoint::{
Brightness, ByteGrid, Command, CompressionCode, Offset, Origin, Packet,
PixelGrid,
Brightness, BrightnessGrid, Command, CompressionCode, Cp473Grid, Offset,
Origin, Packet, PixelGrid,
};
use crate::bit_vec::CBitVec;
@ -126,7 +126,7 @@ pub unsafe extern "C" fn sp_command_brightness(brightness: u8) -> *mut Command {
pub unsafe extern "C" fn sp_command_char_brightness(
x: usize,
y: usize,
byte_grid: *mut ByteGrid,
byte_grid: *mut BrightnessGrid,
) -> *mut Command {
let byte_grid = *Box::from_raw(byte_grid);
Box::into_raw(Box::new(Command::CharBrightness(
@ -254,7 +254,7 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_xor(
pub unsafe extern "C" fn sp_command_cp437_data(
x: usize,
y: usize,
byte_grid: *mut ByteGrid,
byte_grid: *mut Cp473Grid,
) -> *mut Command {
let byte_grid = *Box::from_raw(byte_grid);
Box::into_raw(Box::new(Command::Cp437Data(Origin::new(x, y), byte_grid)))