PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/decoders/image/all.d

http://github.com/wilkie/djehuty
D | 59 lines | 35 code | 15 blank | 9 comment | 8 complexity | f39aaab30317db5f7b6d9555a5d48177 MD5 | raw file
 1module decoders.image.all;
 2
 3import graphics.bitmap;
 4
 5import core.string;
 6import core.stream;
 7
 8import decoders.decoder;
 9import decoders.image.decoder;
10
11public import decoders.image.png;
12public import decoders.image.bmp;
13public import decoders.image.gif;
14public import decoders.image.jpeg;
15// TIFF
16// TGA
17// JPEG 2000
18// MNG
19// PCX
20// RAW
21
22StreamData runAllDecoders(ref ImageDecoder imageCodec, Stream stream, ref Bitmap view) {
23	StreamData ret;
24
25	ulong pos = stream.position;
26
27	imageCodec = new PNGDecoder();
28	if ((ret = imageCodec.decode(stream, view)) != StreamData.Invalid) {
29		return ret;
30	}
31
32	stream.position = pos;
33
34	imageCodec = new BMPDecoder();
35	if ((ret = imageCodec.decode(stream, view)) != StreamData.Invalid) {
36		return ret;
37	}
38
39	stream.position = pos;
40
41	imageCodec = new GIFDecoder();
42	if ((ret = imageCodec.decode(stream, view)) != StreamData.Invalid) {
43		return ret;
44	}
45
46	stream.position = pos;
47
48	imageCodec = new JPEGDecoder();
49	if ((ret = imageCodec.decode(stream, view)) != StreamData.Invalid) {
50		return ret;
51	}
52
53	imageCodec = null;
54	return StreamData.Invalid;
55}
56
57// Codecs:
58//mixin(CreateCodecArray!());
59//