BitmapFormat

Enum BitmapFormat 

Source
pub enum BitmapFormat {
Show 16 variants Gif, Pcx, LbmIff, Tga, Fli, Flc, Bmp, Gl, Dl, Wpg, Png, Jpg, Mpg, Avi, RipScript, Unknown(SauceDataType, u8),
}
Expand description

Graphics format types supported by the SAUCE v00 specification.

BitmapFormat enumerates all bitmap, vector, and special graphics formats that can be stored with SAUCE metadata. Formats are organized by data type:

§Bitmap Formats (DataType::Bitmap)

Raster image and video formats with pixel dimensions (values 0-13):

  • Gif (0): Graphics Interchange Format
  • Pcx (1): ZSoft Paintbrush
  • LbmIff (2): Deluxe Paint (Amiga IFF/ILBM)
  • Tga (3): Truevision TARGA
  • Fli (4): Autodesk Animator
  • Flc (5): Autodesk Animator Pro
  • Bmp (6): Windows Bitmap
  • Gl (7): GRASP animation format
  • Dl (8): DL animation format
  • Wpg (9): WordPerfect Graphics
  • Png (10): Portable Network Graphics
  • Jpg (11): JPEG Image Format
  • Mpg (12): MPEG video
  • Avi (13): Audio Video Interleave

§Vector Formats (DataType::Vector)

Scalable graphics formats without pixel dimensions (values 0-3):

  • Dxf (0): AutoCAD Drawing Exchange Format
  • Dwg (1): AutoCAD Drawing Format
  • WpgVector (2): WordPerfect Graphics (vector)
  • ThreeDs (3): Autodesk 3D Studio

§Special Format

  • RipScript: Remote Imaging Protocol (Character DataType with FileType=3)
    • Fixed 640x350 pixel dimensions
    • 16-color display

§Unknown Variants

  • Unknown: Preserves unrecognized (DataType, FileType) pairs for forward compatibility

§Example

use icy_sauce::BitmapFormat;
use icy_sauce::SauceDataType;

let fmt = BitmapFormat::from_sauce(SauceDataType::Bitmap, 10);
assert_eq!(fmt, BitmapFormat::Png);
let (dt, ft) = fmt.to_sauce();
assert_eq!(ft, 10);

Variants§

§

Gif

GIF (Graphics Interchange Format)

§

Pcx

PCX (ZSoft Paintbrush)

§

LbmIff

LBM/IFF (Deluxe Paint - Amiga format)

§

Tga

TGA (Truevision TARGA)

§

Fli

FLI (Autodesk Animator)

§

Flc

FLC (Autodesk Animator Pro)

§

Bmp

BMP (Windows Bitmap)

§

Gl

GL (GRASP animation)

§

Dl

DL (DL animation)

§

Wpg

WPG (WordPerfect Graphics)

§

Png

PNG (Portable Network Graphics)

§

Jpg

JPG (JPEG Image Format)

§

Mpg

MPEG (Motion Picture Experts Group video)

§

Avi

AVI (Audio Video Interleave)

§

RipScript

RIPScript (Remote Imaging Protocol) - special character-based format

§

Unknown(SauceDataType, u8)

Unknown format (preserves original DataType and FileType for forward compatibility)

Implementations§

Source§

impl BitmapFormat

Source

pub fn from_sauce(data_type: SauceDataType, file_type: u8) -> Self

Parse a graphics format from SAUCE data type and file type bytes.

§Arguments
  • data_type - The SAUCE DataType field
  • file_type - The SAUCE FileType field
§Returns

The corresponding BitmapFormat, or BitmapFormat::Unknown if the combination is not recognized.

§Special Cases
  • RIPScript: DataType=Character with FileType=3
  • Bitmap formats: DataType=Bitmap with FileType 0-13
  • Vector formats: DataType=Vector with FileType 0-3
§Example
use icy_sauce::BitmapFormat;
use icy_sauce::SauceDataType;

let fmt = BitmapFormat::from_sauce(SauceDataType::Bitmap, 6);
assert_eq!(fmt, BitmapFormat::Bmp);
Source

pub fn to_sauce(&self) -> (SauceDataType, u8)

Convert to SAUCE data type and file type bytes.

§Returns

A tuple (data_type, file_type) suitable for writing to a SAUCE header.

§Example
use icy_sauce::BitmapFormat;
use icy_sauce::SauceDataType;

let (dt, ft) = BitmapFormat::Png.to_sauce();
assert_eq!(dt, SauceDataType::Bitmap);
assert_eq!(ft, 10);

Trait Implementations§

Source§

impl Clone for BitmapFormat

Source§

fn clone(&self) -> BitmapFormat

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BitmapFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BitmapFormat

Source§

fn eq(&self, other: &BitmapFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BitmapFormat

Source§

impl StructuralPartialEq for BitmapFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.