зеркало из https://github.com/mozilla/gecko-dev.git
servo: Add a TGA image writer
Source-Repo: https://github.com/servo/servo Source-Revision: 228c1cf950090c2f53ff3fe58a74bacd096169d5
This commit is contained in:
Родитель
8921fb748a
Коммит
58b6a16cb4
|
@ -0,0 +1,24 @@
|
|||
import gfx::surface;
|
||||
import io::writer_util;
|
||||
|
||||
fn encode(writer: io::writer, surface: surface::image_surface) {
|
||||
assert surface.format == gfx::surface::fo_rgba_8888;
|
||||
|
||||
writer.write_u8(0u8); // identsize
|
||||
writer.write_u8(0u8); // colourmaptype
|
||||
writer.write_u8(2u8); // imagetype
|
||||
|
||||
writer.write_le_u16(0u16); // colourmapstart
|
||||
writer.write_le_u16(0u16); // colourmaplength
|
||||
writer.write_u8(16u8); // colourmapbits
|
||||
|
||||
writer.write_le_u16(0u16); // xstart
|
||||
writer.write_le_u16(0u16); // ystart
|
||||
writer.write_le_u16(surface.size.width as u16); // width
|
||||
writer.write_le_u16(surface.size.height as u16); // height
|
||||
writer.write_u8(32u8); // bits
|
||||
writer.write_u8(0x30u8); // descriptor
|
||||
|
||||
writer.write(surface.buffer);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче