Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package tiff | 5 package tiff |
6 | 6 |
7 // A tiff image file contains one or more images. The metadata | 7 // A tiff image file contains one or more images. The metadata |
8 // of each image is contained in an Image File Directory (IFD), | 8 // of each image is contained in an Image File Directory (IFD), |
9 // which contains entries of 12 bytes each and is described | 9 // which contains entries of 12 bytes each and is described |
10 // on page 14-16 of the specification. An IFD entry consists of | 10 // on page 14-16 of the specification. An IFD entry consists of |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 const ( | 102 const ( |
103 mBilevel imageMode = iota | 103 mBilevel imageMode = iota |
104 mPaletted | 104 mPaletted |
105 mGray | 105 mGray |
106 mGrayInvert | 106 mGrayInvert |
107 mRGB | 107 mRGB |
108 mRGBA | 108 mRGBA |
109 mNRGBA | 109 mNRGBA |
110 ) | 110 ) |
111 | 111 |
112 // Compression describes the type of compression used in Options. | 112 // CompressionType describes the type of compression used in Options. |
113 type CompressionType int | 113 type CompressionType int |
114 | 114 |
115 const ( | 115 const ( |
116 Uncompressed CompressionType = iota | 116 Uncompressed CompressionType = iota |
117 Deflate | |
117 ) | 118 ) |
119 | |
120 // compressionEq holds the equivalence table between CompressionType and | |
121 // the values of the TIFF spec. | |
122 var compressionEq = []struct { | |
123 a CompressionType | |
124 b uint32 | |
125 }{ | |
126 {Uncompressed, cNone}, | |
127 {Deflate, cDeflate}, | |
128 } | |
129 | |
130 // specValue returns the compression type constant from the TIFF spec that | |
131 // is equivalent to c. | |
132 func (c CompressionType) specValue() uint32 { | |
133 for _, v := range compressionEq { | |
nigeltao
2012/12/05 03:34:38
I'd just hard-code it:
func (c CompressionType) s
bsiegert
2012/12/10 15:44:04
Done.
| |
134 if v.a == c { | |
135 return v.b | |
136 } | |
137 } | |
138 return cNone | |
139 } | |
OLD | NEW |