pub fn from_tga<R: Read>(data: &mut R) -> Image {
        let header = TgaHeader::from_data(data);
        // only 24 bit RLE is implemented, origins from the left
        assert_eq!(header.bit_depth, 24);
        assert_eq!(header.image_type, 10);
        assert!(header.origin == 0b00 || header.origin == 0b10);

        let pixel_count = header.image_width * header.image_height;
        let flipped = header.origin == 0b00;
        let pixels = read_image_data_rle(data, pixel_count, header.image_width, flipped);
        Image {
            width: header.image_width,
            height: header.image_height,
            flipped,
            pixels,
        }
    }
/// Parse the given TGA data into a bitmap image.
Parse the given TGA data into a bitmap image.
Parse the given TGA data into a bitmap image .
pub fn from_tga<R: Read>(data: &mut R) -> Image {
        let header = TgaHeader::from_data(data);
        // only 24 bit RLE is implemented, origins from the left
        assert_eq!(header.bit_depth, 24);
        assert_eq!(header.image_type, 10);
        assert!(header.origin == 0b00 || header.origin == 0b10);
        let pixel_count = header.image_width * header.image_height;
        let flipped = header.origin == 0b00;
        let pixels = read_image_data_rle(data, pixel_count, header.image_width, flipped);
        Image {
            width: header.image_width,
            height: header.image_height,
            flipped,
            pixels,
        }
    }
pub fn from_tga < R : Read > ( data : & mut R ) -> Image { let header = TgaHeader :: from_data ( data ) ; // only 24 bit RLE is implemented, origins from the left assert_eq ! ( header bit_depth 24 ) ; assert_eq ! ( header image_type 10 ) ; assert ! ( header origin 0b00 header origin 0b10 ) ; let pixel_count = header . image_width * header . image_height ; let flipped = header . origin == 0b00 ; let pixels = read_image_data_rle ( data , pixel_count , header . image_width , flipped ) ; Image { width : header . image_width , height : header . image_height , flipped , pixels , } }
Parse the given TGA data into a bitmap image.
Parse the given TGA data into a bitmap image .
data
&mut R