pub trait GameBoy2bpp {
// Required method
fn into_gb2bpp(self) -> Vec<u8> ⓘ;
}
Required Methods§
fn into_gb2bpp(self) -> Vec<u8> ⓘ
Implementations on Foreign Types§
Source§impl GameBoy2bpp for DynamicImage
impl GameBoy2bpp for DynamicImage
Source§fn into_gb2bpp(self) -> Vec<u8> ⓘ
fn into_gb2bpp(self) -> Vec<u8> ⓘ
Converts the image into the Game Boy 2bpp (2 bits per pixel) format.
This format is used for Game Boy graphics, where each pixel is represented by 2 bits, allowing for 4 shades of gray. The image is divided into 8x8 tiles, and each tile is encoded row by row. Each row consists of two bytes:
- The first byte contains the least significant bits of the 8 pixels in the row.
- The second byte contains the most significant bits of the 8 pixels in the row.
The input image must have dimensions that are multiples of 8, as the Game Boy graphics system operates on 8x8 tiles.
§Panics
This function will panic if the input image dimensions are not multiples of 8.
§Returns
A Vec<u8>
containing the image data in Game Boy 2bpp format.