public void WriteTga(Image image, Stream dest) { try { _stream = dest; fixed(byte *b = &image.Data[0]) { StbImageWrite.stbi_write_tga_to_func(WriteCallback, null, image.Width, image.Height, image.Comp, b); } } finally { _stream = null; } }
/// <summary> /// /// </summary> /// <param name="image"></param> /// <param name="dest"></param> /// <param name="quality">Should be beetween 1 & 100</param> public void WriteJpg(Image image, Stream dest, int quality) { try { _stream = dest; fixed(byte *b = &image.Data[0]) { StbImageWrite.stbi_write_jpg_to_func(WriteCallback, null, image.Width, image.Height, image.Comp, b, quality); } } finally { _stream = null; } }
public void WriteHdr(Image image, Stream dest) { try { _stream = dest; var f = new float[image.Data.Length]; for (var i = 0; i < image.Data.Length; ++i) { f[i] = image.Data[i] / 255.0f; } fixed(float *fptr = f) { StbImageWrite.stbi_write_hdr_to_func(WriteCallback, null, image.Width, image.Height, image.Comp, fptr); } } finally { _stream = null; } }