re-export constants from base lib
This commit is contained in:
		
							parent
							
								
									99c1884ddc
								
							
						
					
					
						commit
						992c30b2bc
					
				
					 7 changed files with 98 additions and 92 deletions
				
			
		| 
						 | 
				
			
			@ -8,6 +8,35 @@
 | 
			
		|||
#include <stdint.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pixel count on whole screen
 | 
			
		||||
 */
 | 
			
		||||
#define PIXEL_COUNT (PIXEL_WIDTH * PIXEL_HEIGHT)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display height in pixels
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```rust
 | 
			
		||||
 * # use servicepoint::{PIXEL_HEIGHT, PIXEL_WIDTH, Bitmap};
 | 
			
		||||
 * let grid = Bitmap::new(PIXEL_WIDTH, PIXEL_HEIGHT);
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
#define PIXEL_HEIGHT (TILE_HEIGHT * TILE_SIZE)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display width in pixels
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```rust
 | 
			
		||||
 * # use servicepoint::{PIXEL_HEIGHT, PIXEL_WIDTH, Bitmap};
 | 
			
		||||
 * let grid = Bitmap::new(PIXEL_WIDTH, PIXEL_HEIGHT);
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
#define PIXEL_WIDTH (TILE_WIDTH * TILE_SIZE)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Count of possible brightness values
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -23,40 +52,60 @@
 | 
			
		|||
 */
 | 
			
		||||
#define SP_BRIGHTNESS_MIN 0
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pixel count on whole screen
 | 
			
		||||
 */
 | 
			
		||||
#define SP_PIXEL_COUNT (SP_PIXEL_WIDTH * SP_PIXEL_HEIGHT)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display height in pixels
 | 
			
		||||
 */
 | 
			
		||||
#define SP_PIXEL_HEIGHT (SP_TILE_HEIGHT * SP_TILE_SIZE)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display width in pixels
 | 
			
		||||
 */
 | 
			
		||||
#define SP_PIXEL_WIDTH (SP_TILE_WIDTH * SP_TILE_SIZE)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display tile count in the y-direction
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```rust
 | 
			
		||||
 * # use servicepoint::{Cp437Grid, TILE_HEIGHT, TILE_WIDTH};
 | 
			
		||||
 * let grid = Cp437Grid::new(TILE_WIDTH, TILE_HEIGHT);
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
#define SP_TILE_HEIGHT 20
 | 
			
		||||
#define TILE_HEIGHT 20
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * size of a single tile in one dimension
 | 
			
		||||
 */
 | 
			
		||||
#define SP_TILE_SIZE 8
 | 
			
		||||
#define TILE_SIZE 8
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Display tile count in the x-direction
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```rust
 | 
			
		||||
 * # use servicepoint::{Cp437Grid, TILE_HEIGHT, TILE_WIDTH};
 | 
			
		||||
 * let grid = Cp437Grid::new(TILE_WIDTH, TILE_HEIGHT);
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
#define SP_TILE_WIDTH 56
 | 
			
		||||
#define TILE_WIDTH 56
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Specifies the kind of compression to use.
 | 
			
		||||
 * Specifies the kind of compression to use. Availability depends on features.
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```rust
 | 
			
		||||
 * # use servicepoint::*;
 | 
			
		||||
 * // create command without payload compression
 | 
			
		||||
 * # let pixels = Bitmap::max_sized();
 | 
			
		||||
 * _ = BitmapCommand {
 | 
			
		||||
 *     origin: Origin::ZERO,
 | 
			
		||||
 *     bitmap: pixels,
 | 
			
		||||
 *     compression: CompressionCode::Uncompressed
 | 
			
		||||
 * };
 | 
			
		||||
 *
 | 
			
		||||
 * // create command with payload compressed with lzma and appropriate header flags
 | 
			
		||||
 * # let pixels = Bitmap::max_sized();
 | 
			
		||||
 * _ = BitmapCommand {
 | 
			
		||||
 *     origin: Origin::ZERO,
 | 
			
		||||
 *     bitmap: pixels,
 | 
			
		||||
 *     compression: CompressionCode::Lzma
 | 
			
		||||
 * };
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
enum SPCompressionCode
 | 
			
		||||
enum CompressionCode
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
  : uint16_t
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
| 
						 | 
				
			
			@ -64,26 +113,26 @@ enum SPCompressionCode
 | 
			
		|||
    /**
 | 
			
		||||
     * no compression
 | 
			
		||||
     */
 | 
			
		||||
    SP_COMPRESSION_CODE_UNCOMPRESSED = 0,
 | 
			
		||||
    COMPRESSION_CODE_UNCOMPRESSED = 0,
 | 
			
		||||
    /**
 | 
			
		||||
     * compress using flate2 with zlib header
 | 
			
		||||
     */
 | 
			
		||||
    SP_COMPRESSION_CODE_ZLIB = 26490,
 | 
			
		||||
    COMPRESSION_CODE_ZLIB = 26490,
 | 
			
		||||
    /**
 | 
			
		||||
     * compress using bzip2
 | 
			
		||||
     */
 | 
			
		||||
    SP_COMPRESSION_CODE_BZIP2 = 25210,
 | 
			
		||||
    COMPRESSION_CODE_BZIP2 = 25210,
 | 
			
		||||
    /**
 | 
			
		||||
     * compress using lzma
 | 
			
		||||
     */
 | 
			
		||||
    SP_COMPRESSION_CODE_LZMA = 27770,
 | 
			
		||||
    COMPRESSION_CODE_LZMA = 27770,
 | 
			
		||||
    /**
 | 
			
		||||
     * compress using Zstandard
 | 
			
		||||
     */
 | 
			
		||||
    SP_COMPRESSION_CODE_ZSTD = 31347,
 | 
			
		||||
    COMPRESSION_CODE_ZSTD = 31347,
 | 
			
		||||
};
 | 
			
		||||
#ifndef __cplusplus
 | 
			
		||||
typedef uint16_t SPCompressionCode;
 | 
			
		||||
typedef uint16_t CompressionCode;
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -1173,7 +1222,7 @@ size_t sp_char_grid_width(const CharGrid *char_grid);
 | 
			
		|||
 */
 | 
			
		||||
Command *sp_command_bitmap_linear(size_t offset,
 | 
			
		||||
                                  SPBitVec *bit_vec,
 | 
			
		||||
                                  SPCompressionCode compression);
 | 
			
		||||
                                  CompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set pixel data according to an and-mask starting at the offset.
 | 
			
		||||
| 
						 | 
				
			
			@ -1204,7 +1253,7 @@ Command *sp_command_bitmap_linear(size_t offset,
 | 
			
		|||
 */
 | 
			
		||||
Command *sp_command_bitmap_linear_and(size_t offset,
 | 
			
		||||
                                      SPBitVec *bit_vec,
 | 
			
		||||
                                      SPCompressionCode compression);
 | 
			
		||||
                                      CompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set pixel data according to an or-mask starting at the offset.
 | 
			
		||||
| 
						 | 
				
			
			@ -1235,7 +1284,7 @@ Command *sp_command_bitmap_linear_and(size_t offset,
 | 
			
		|||
 */
 | 
			
		||||
Command *sp_command_bitmap_linear_or(size_t offset,
 | 
			
		||||
                                     SPBitVec *bit_vec,
 | 
			
		||||
                                     SPCompressionCode compression);
 | 
			
		||||
                                     CompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a window of pixels to the specified values.
 | 
			
		||||
| 
						 | 
				
			
			@ -1262,7 +1311,7 @@ Command *sp_command_bitmap_linear_or(size_t offset,
 | 
			
		|||
Command *sp_command_bitmap_linear_win(size_t x,
 | 
			
		||||
                                      size_t y,
 | 
			
		||||
                                      Bitmap *bitmap,
 | 
			
		||||
                                      SPCompressionCode compression);
 | 
			
		||||
                                      CompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set pixel data according to a xor-mask starting at the offset.
 | 
			
		||||
| 
						 | 
				
			
			@ -1293,7 +1342,7 @@ Command *sp_command_bitmap_linear_win(size_t x,
 | 
			
		|||
 */
 | 
			
		||||
Command *sp_command_bitmap_linear_xor(size_t offset,
 | 
			
		||||
                                      SPBitVec *bit_vec,
 | 
			
		||||
                                      SPCompressionCode compression);
 | 
			
		||||
                                      CompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set the brightness of all tiles to the same value.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue