LEFT | RIGHT |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 mRGB | 107 mRGB |
108 mRGBA | 108 mRGBA |
109 mNRGBA | 109 mNRGBA |
110 ) | 110 ) |
111 | 111 |
112 // CompressionType 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 PackBits | |
118 Deflate | 117 Deflate |
119 ) | 118 ) |
120 | |
121 // compressionEq holds the equivalence table between CompressionType and | |
122 // the values of the TIFF spec. | |
123 var compressionEq = []struct { | |
124 a CompressionType | |
125 b uint32 | |
126 }{ | |
127 {Uncompressed, cNone}, | |
128 {PackBits, cPackBits}, | |
129 {Deflate, cDeflate}, | |
130 } | |
131 | 119 |
132 // specValue returns the compression type constant from the TIFF spec that | 120 // specValue returns the compression type constant from the TIFF spec that |
133 // is equivalent to c. | 121 // is equivalent to c. |
134 func (c CompressionType) specValue() uint32 { | 122 func (c CompressionType) specValue() uint32 { |
135 » for _, v := range compressionEq { | 123 » switch c { |
136 » » if v.a == c { | 124 » case Deflate: |
137 » » » return v.b | 125 » » return cDeflate |
138 » » } | |
139 } | 126 } |
140 return cNone | 127 return cNone |
141 } | 128 } |
LEFT | RIGHT |