From 84d2482ddbff9564c9ad75b2d30af66e3ddfd44d Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 12 May 2016 15:08:58 -0400 Subject: Updating go depencancies. Switching to go1.6 vendoring (#2949) --- Godeps/_workspace/src/golang.org/x/crypto/LICENSE | 27 - Godeps/_workspace/src/golang.org/x/crypto/PATENTS | 22 - .../src/golang.org/x/crypto/bcrypt/base64.go | 35 - .../src/golang.org/x/crypto/bcrypt/bcrypt.go | 294 ---- .../src/golang.org/x/crypto/blowfish/block.go | 159 --- .../src/golang.org/x/crypto/blowfish/cipher.go | 91 -- .../src/golang.org/x/crypto/blowfish/const.go | 199 --- Godeps/_workspace/src/golang.org/x/image/LICENSE | 27 - Godeps/_workspace/src/golang.org/x/image/PATENTS | 22 - .../src/golang.org/x/image/bmp/reader.go | 199 --- .../src/golang.org/x/image/bmp/writer.go | 166 --- .../golang.org/x/image/font/basicfont/basicfont.go | 113 -- .../src/golang.org/x/image/font/basicfont/data.go | 1456 -------------------- .../src/golang.org/x/image/font/basicfont/gen.go | 115 -- .../_workspace/src/golang.org/x/image/font/font.go | 202 --- .../golang.org/x/image/font/plan9font/plan9font.go | 556 -------- .../src/golang.org/x/image/math/fixed/fixed.go | 172 --- .../src/golang.org/x/image/tiff/buffer.go | 69 - .../src/golang.org/x/image/tiff/compress.go | 58 - .../src/golang.org/x/image/tiff/consts.go | 133 -- .../src/golang.org/x/image/tiff/lzw/reader.go | 277 ---- .../src/golang.org/x/image/tiff/reader.go | 681 --------- .../src/golang.org/x/image/tiff/writer.go | 438 ------ 23 files changed, 5511 deletions(-) delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/LICENSE delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/PATENTS delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/blowfish/block.go delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/blowfish/cipher.go delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/blowfish/const.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/LICENSE delete mode 100644 Godeps/_workspace/src/golang.org/x/image/PATENTS delete mode 100644 Godeps/_workspace/src/golang.org/x/image/bmp/reader.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/bmp/writer.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/basicfont/basicfont.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/basicfont/data.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/basicfont/gen.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/font.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/plan9font/plan9font.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/buffer.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/compress.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/consts.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/lzw/reader.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/reader.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/writer.go (limited to 'Godeps/_workspace/src/golang.org/x') diff --git a/Godeps/_workspace/src/golang.org/x/crypto/LICENSE b/Godeps/_workspace/src/golang.org/x/crypto/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/crypto/PATENTS b/Godeps/_workspace/src/golang.org/x/crypto/PATENTS deleted file mode 100644 index 733099041..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go b/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go deleted file mode 100644 index fc3116090..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bcrypt - -import "encoding/base64" - -const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" - -var bcEncoding = base64.NewEncoding(alphabet) - -func base64Encode(src []byte) []byte { - n := bcEncoding.EncodedLen(len(src)) - dst := make([]byte, n) - bcEncoding.Encode(dst, src) - for dst[n-1] == '=' { - n-- - } - return dst[:n] -} - -func base64Decode(src []byte) ([]byte, error) { - numOfEquals := 4 - (len(src) % 4) - for i := 0; i < numOfEquals; i++ { - src = append(src, '=') - } - - dst := make([]byte, bcEncoding.DecodedLen(len(src))) - n, err := bcEncoding.Decode(dst, src) - if err != nil { - return nil, err - } - return dst[:n], nil -} diff --git a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go b/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go deleted file mode 100644 index b8e18d744..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing -// algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf -package bcrypt - -// The code is a port of Provos and Mazières's C implementation. -import ( - "crypto/rand" - "crypto/subtle" - "errors" - "fmt" - "golang.org/x/crypto/blowfish" - "io" - "strconv" -) - -const ( - MinCost int = 4 // the minimum allowable cost as passed in to GenerateFromPassword - MaxCost int = 31 // the maximum allowable cost as passed in to GenerateFromPassword - DefaultCost int = 10 // the cost that will actually be set if a cost below MinCost is passed into GenerateFromPassword -) - -// The error returned from CompareHashAndPassword when a password and hash do -// not match. -var ErrMismatchedHashAndPassword = errors.New("crypto/bcrypt: hashedPassword is not the hash of the given password") - -// The error returned from CompareHashAndPassword when a hash is too short to -// be a bcrypt hash. -var ErrHashTooShort = errors.New("crypto/bcrypt: hashedSecret too short to be a bcrypted password") - -// The error returned from CompareHashAndPassword when a hash was created with -// a bcrypt algorithm newer than this implementation. -type HashVersionTooNewError byte - -func (hv HashVersionTooNewError) Error() string { - return fmt.Sprintf("crypto/bcrypt: bcrypt algorithm version '%c' requested is newer than current version '%c'", byte(hv), majorVersion) -} - -// The error returned from CompareHashAndPassword when a hash starts with something other than '$' -type InvalidHashPrefixError byte - -func (ih InvalidHashPrefixError) Error() string { - return fmt.Sprintf("crypto/bcrypt: bcrypt hashes must start with '$', but hashedSecret started with '%c'", byte(ih)) -} - -type InvalidCostError int - -func (ic InvalidCostError) Error() string { - return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range (%d,%d)", int(ic), int(MinCost), int(MaxCost)) -} - -const ( - majorVersion = '2' - minorVersion = 'a' - maxSaltSize = 16 - maxCryptedHashSize = 23 - encodedSaltSize = 22 - encodedHashSize = 31 - minHashSize = 59 -) - -// magicCipherData is an IV for the 64 Blowfish encryption calls in -// bcrypt(). It's the string "OrpheanBeholderScryDoubt" in big-endian bytes. -var magicCipherData = []byte{ - 0x4f, 0x72, 0x70, 0x68, - 0x65, 0x61, 0x6e, 0x42, - 0x65, 0x68, 0x6f, 0x6c, - 0x64, 0x65, 0x72, 0x53, - 0x63, 0x72, 0x79, 0x44, - 0x6f, 0x75, 0x62, 0x74, -} - -type hashed struct { - hash []byte - salt []byte - cost int // allowed range is MinCost to MaxCost - major byte - minor byte -} - -// GenerateFromPassword returns the bcrypt hash of the password at the given -// cost. If the cost given is less than MinCost, the cost will be set to -// DefaultCost, instead. Use CompareHashAndPassword, as defined in this package, -// to compare the returned hashed password with its cleartext version. -func GenerateFromPassword(password []byte, cost int) ([]byte, error) { - p, err := newFromPassword(password, cost) - if err != nil { - return nil, err - } - return p.Hash(), nil -} - -// CompareHashAndPassword compares a bcrypt hashed password with its possible -// plaintext equivalent. Returns nil on success, or an error on failure. -func CompareHashAndPassword(hashedPassword, password []byte) error { - p, err := newFromHash(hashedPassword) - if err != nil { - return err - } - - otherHash, err := bcrypt(password, p.cost, p.salt) - if err != nil { - return err - } - - otherP := &hashed{otherHash, p.salt, p.cost, p.major, p.minor} - if subtle.ConstantTimeCompare(p.Hash(), otherP.Hash()) == 1 { - return nil - } - - return ErrMismatchedHashAndPassword -} - -// Cost returns the hashing cost used to create the given hashed -// password. When, in the future, the hashing cost of a password system needs -// to be increased in order to adjust for greater computational power, this -// function allows one to establish which passwords need to be updated. -func Cost(hashedPassword []byte) (int, error) { - p, err := newFromHash(hashedPassword) - if err != nil { - return 0, err - } - return p.cost, nil -} - -func newFromPassword(password []byte, cost int) (*hashed, error) { - if cost < MinCost { - cost = DefaultCost - } - p := new(hashed) - p.major = majorVersion - p.minor = minorVersion - - err := checkCost(cost) - if err != nil { - return nil, err - } - p.cost = cost - - unencodedSalt := make([]byte, maxSaltSize) - _, err = io.ReadFull(rand.Reader, unencodedSalt) - if err != nil { - return nil, err - } - - p.salt = base64Encode(unencodedSalt) - hash, err := bcrypt(password, p.cost, p.salt) - if err != nil { - return nil, err - } - p.hash = hash - return p, err -} - -func newFromHash(hashedSecret []byte) (*hashed, error) { - if len(hashedSecret) < minHashSize { - return nil, ErrHashTooShort - } - p := new(hashed) - n, err := p.decodeVersion(hashedSecret) - if err != nil { - return nil, err - } - hashedSecret = hashedSecret[n:] - n, err = p.decodeCost(hashedSecret) - if err != nil { - return nil, err - } - hashedSecret = hashedSecret[n:] - - // The "+2" is here because we'll have to append at most 2 '=' to the salt - // when base64 decoding it in expensiveBlowfishSetup(). - p.salt = make([]byte, encodedSaltSize, encodedSaltSize+2) - copy(p.salt, hashedSecret[:encodedSaltSize]) - - hashedSecret = hashedSecret[encodedSaltSize:] - p.hash = make([]byte, len(hashedSecret)) - copy(p.hash, hashedSecret) - - return p, nil -} - -func bcrypt(password []byte, cost int, salt []byte) ([]byte, error) { - cipherData := make([]byte, len(magicCipherData)) - copy(cipherData, magicCipherData) - - c, err := expensiveBlowfishSetup(password, uint32(cost), salt) - if err != nil { - return nil, err - } - - for i := 0; i < 24; i += 8 { - for j := 0; j < 64; j++ { - c.Encrypt(cipherData[i:i+8], cipherData[i:i+8]) - } - } - - // Bug compatibility with C bcrypt implementations. We only encode 23 of - // the 24 bytes encrypted. - hsh := base64Encode(cipherData[:maxCryptedHashSize]) - return hsh, nil -} - -func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cipher, error) { - - csalt, err := base64Decode(salt) - if err != nil { - return nil, err - } - - // Bug compatibility with C bcrypt implementations. They use the trailing - // NULL in the key string during expansion. - ckey := append(key, 0) - - c, err := blowfish.NewSaltedCipher(ckey, csalt) - if err != nil { - return nil, err - } - - var i, rounds uint64 - rounds = 1 << cost - for i = 0; i < rounds; i++ { - blowfish.ExpandKey(ckey, c) - blowfish.ExpandKey(csalt, c) - } - - return c, nil -} - -func (p *hashed) Hash() []byte { - arr := make([]byte, 60) - arr[0] = '$' - arr[1] = p.major - n := 2 - if p.minor != 0 { - arr[2] = p.minor - n = 3 - } - arr[n] = '$' - n += 1 - copy(arr[n:], []byte(fmt.Sprintf("%02d", p.cost))) - n += 2 - arr[n] = '$' - n += 1 - copy(arr[n:], p.salt) - n += encodedSaltSize - copy(arr[n:], p.hash) - n += encodedHashSize - return arr[:n] -} - -func (p *hashed) decodeVersion(sbytes []byte) (int, error) { - if sbytes[0] != '$' { - return -1, InvalidHashPrefixError(sbytes[0]) - } - if sbytes[1] > majorVersion { - return -1, HashVersionTooNewError(sbytes[1]) - } - p.major = sbytes[1] - n := 3 - if sbytes[2] != '$' { - p.minor = sbytes[2] - n++ - } - return n, nil -} - -// sbytes should begin where decodeVersion left off. -func (p *hashed) decodeCost(sbytes []byte) (int, error) { - cost, err := strconv.Atoi(string(sbytes[0:2])) - if err != nil { - return -1, err - } - err = checkCost(cost) - if err != nil { - return -1, err - } - p.cost = cost - return 3, nil -} - -func (p *hashed) String() string { - return fmt.Sprintf("&{hash: %#v, salt: %#v, cost: %d, major: %c, minor: %c}", string(p.hash), p.salt, p.cost, p.major, p.minor) -} - -func checkCost(cost int) error { - if cost < MinCost || cost > MaxCost { - return InvalidCostError(cost) - } - return nil -} diff --git a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/block.go b/Godeps/_workspace/src/golang.org/x/crypto/blowfish/block.go deleted file mode 100644 index 9d80f1952..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/block.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package blowfish - -// getNextWord returns the next big-endian uint32 value from the byte slice -// at the given position in a circular manner, updating the position. -func getNextWord(b []byte, pos *int) uint32 { - var w uint32 - j := *pos - for i := 0; i < 4; i++ { - w = w<<8 | uint32(b[j]) - j++ - if j >= len(b) { - j = 0 - } - } - *pos = j - return w -} - -// ExpandKey performs a key expansion on the given *Cipher. Specifically, it -// performs the Blowfish algorithm's key schedule which sets up the *Cipher's -// pi and substitution tables for calls to Encrypt. This is used, primarily, -// by the bcrypt package to reuse the Blowfish key schedule during its -// set up. It's unlikely that you need to use this directly. -func ExpandKey(key []byte, c *Cipher) { - j := 0 - for i := 0; i < 18; i++ { - // Using inlined getNextWord for performance. - var d uint32 - for k := 0; k < 4; k++ { - d = d<<8 | uint32(key[j]) - j++ - if j >= len(key) { - j = 0 - } - } - c.p[i] ^= d - } - - var l, r uint32 - for i := 0; i < 18; i += 2 { - l, r = encryptBlock(l, r, c) - c.p[i], c.p[i+1] = l, r - } - - for i := 0; i < 256; i += 2 { - l, r = encryptBlock(l, r, c) - c.s0[i], c.s0[i+1] = l, r - } - for i := 0; i < 256; i += 2 { - l, r = encryptBlock(l, r, c) - c.s1[i], c.s1[i+1] = l, r - } - for i := 0; i < 256; i += 2 { - l, r = encryptBlock(l, r, c) - c.s2[i], c.s2[i+1] = l, r - } - for i := 0; i < 256; i += 2 { - l, r = encryptBlock(l, r, c) - c.s3[i], c.s3[i+1] = l, r - } -} - -// This is similar to ExpandKey, but folds the salt during the key -// schedule. While ExpandKey is essentially expandKeyWithSalt with an all-zero -// salt passed in, reusing ExpandKey turns out to be a place of inefficiency -// and specializing it here is useful. -func expandKeyWithSalt(key []byte, salt []byte, c *Cipher) { - j := 0 - for i := 0; i < 18; i++ { - c.p[i] ^= getNextWord(key, &j) - } - - j = 0 - var l, r uint32 - for i := 0; i < 18; i += 2 { - l ^= getNextWord(salt, &j) - r ^= getNextWord(salt, &j) - l, r = encryptBlock(l, r, c) - c.p[i], c.p[i+1] = l, r - } - - for i := 0; i < 256; i += 2 { - l ^= getNextWord(salt, &j) - r ^= getNextWord(salt, &j) - l, r = encryptBlock(l, r, c) - c.s0[i], c.s0[i+1] = l, r - } - - for i := 0; i < 256; i += 2 { - l ^= getNextWord(salt, &j) - r ^= getNextWord(salt, &j) - l, r = encryptBlock(l, r, c) - c.s1[i], c.s1[i+1] = l, r - } - - for i := 0; i < 256; i += 2 { - l ^= getNextWord(salt, &j) - r ^= getNextWord(salt, &j) - l, r = encryptBlock(l, r, c) - c.s2[i], c.s2[i+1] = l, r - } - - for i := 0; i < 256; i += 2 { - l ^= getNextWord(salt, &j) - r ^= getNextWord(salt, &j) - l, r = encryptBlock(l, r, c) - c.s3[i], c.s3[i+1] = l, r - } -} - -func encryptBlock(l, r uint32, c *Cipher) (uint32, uint32) { - xl, xr := l, r - xl ^= c.p[0] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[1] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[2] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[3] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[4] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[5] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[6] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[7] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[8] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[9] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[10] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[11] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[12] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[13] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[14] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[15] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[16] - xr ^= c.p[17] - return xr, xl -} - -func decryptBlock(l, r uint32, c *Cipher) (uint32, uint32) { - xl, xr := l, r - xl ^= c.p[17] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[16] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[15] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[14] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[13] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[12] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[11] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[10] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[9] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[8] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[7] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[6] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[5] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[4] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[3] - xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[2] - xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[1] - xr ^= c.p[0] - return xr, xl -} diff --git a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/cipher.go b/Godeps/_workspace/src/golang.org/x/crypto/blowfish/cipher.go deleted file mode 100644 index 5019658a4..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/cipher.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package blowfish implements Bruce Schneier's Blowfish encryption algorithm. -package blowfish - -// The code is a port of Bruce Schneier's C implementation. -// See http://www.schneier.com/blowfish.html. - -import "strconv" - -// The Blowfish block size in bytes. -const BlockSize = 8 - -// A Cipher is an instance of Blowfish encryption using a particular key. -type Cipher struct { - p [18]uint32 - s0, s1, s2, s3 [256]uint32 -} - -type KeySizeError int - -func (k KeySizeError) Error() string { - return "crypto/blowfish: invalid key size " + strconv.Itoa(int(k)) -} - -// NewCipher creates and returns a Cipher. -// The key argument should be the Blowfish key, from 1 to 56 bytes. -func NewCipher(key []byte) (*Cipher, error) { - var result Cipher - if k := len(key); k < 1 || k > 56 { - return nil, KeySizeError(k) - } - initCipher(&result) - ExpandKey(key, &result) - return &result, nil -} - -// NewSaltedCipher creates a returns a Cipher that folds a salt into its key -// schedule. For most purposes, NewCipher, instead of NewSaltedCipher, is -// sufficient and desirable. For bcrypt compatiblity, the key can be over 56 -// bytes. -func NewSaltedCipher(key, salt []byte) (*Cipher, error) { - if len(salt) == 0 { - return NewCipher(key) - } - var result Cipher - if k := len(key); k < 1 { - return nil, KeySizeError(k) - } - initCipher(&result) - expandKeyWithSalt(key, salt, &result) - return &result, nil -} - -// BlockSize returns the Blowfish block size, 8 bytes. -// It is necessary to satisfy the Block interface in the -// package "crypto/cipher". -func (c *Cipher) BlockSize() int { return BlockSize } - -// Encrypt encrypts the 8-byte buffer src using the key k -// and stores the result in dst. -// Note that for amounts of data larger than a block, -// it is not safe to just call Encrypt on successive blocks; -// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go). -func (c *Cipher) Encrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - l, r = encryptBlock(l, r, c) - dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) - dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) -} - -// Decrypt decrypts the 8-byte buffer src using the key k -// and stores the result in dst. -func (c *Cipher) Decrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - l, r = decryptBlock(l, r, c) - dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) - dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) -} - -func initCipher(c *Cipher) { - copy(c.p[0:], p[0:]) - copy(c.s0[0:], s0[0:]) - copy(c.s1[0:], s1[0:]) - copy(c.s2[0:], s2[0:]) - copy(c.s3[0:], s3[0:]) -} diff --git a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/const.go b/Godeps/_workspace/src/golang.org/x/crypto/blowfish/const.go deleted file mode 100644 index 8c5ee4cb0..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/const.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// The startup permutation array and substitution boxes. -// They are the hexadecimal digits of PI; see: -// http://www.schneier.com/code/constants.txt. - -package blowfish - -var s0 = [256]uint32{ - 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, - 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, - 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, - 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, - 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, - 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, - 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, - 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, - 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, - 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, - 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, - 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, - 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, - 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, - 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, - 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, - 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, - 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, - 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, - 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, - 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, - 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, - 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, - 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, - 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, - 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, - 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, - 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, - 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, - 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, - 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, - 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, - 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, - 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, - 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, - 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, - 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, - 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, - 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, - 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, - 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, - 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, - 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, -} - -var s1 = [256]uint32{ - 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, - 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, - 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, - 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, - 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, - 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, - 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, - 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, - 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, - 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, - 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, - 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, - 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, - 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, - 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, - 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, - 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, - 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, - 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, - 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, - 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, - 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, - 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, - 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, - 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, - 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, - 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, - 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, - 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, - 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, - 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, - 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, - 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, - 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, - 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, - 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, - 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, - 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, - 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, - 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, - 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, - 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, - 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, -} - -var s2 = [256]uint32{ - 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, - 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, - 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, - 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, - 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, - 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, - 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, - 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, - 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, - 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, - 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, - 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, - 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, - 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, - 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, - 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, - 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, - 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, - 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, - 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, - 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, - 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, - 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, - 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, - 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, - 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, - 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, - 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, - 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, - 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, - 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, - 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, - 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, - 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, - 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, - 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, - 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, - 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, - 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, - 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, - 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, - 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, - 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, -} - -var s3 = [256]uint32{ - 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, - 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, - 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, - 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, - 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, - 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, - 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, - 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, - 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, - 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, - 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, - 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, - 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, - 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, - 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, - 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, - 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, - 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, - 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, - 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, - 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, - 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, - 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, - 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, - 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, - 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, - 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, - 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, - 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, - 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, - 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, - 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, - 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, - 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, - 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, - 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, - 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, - 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, - 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, - 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, - 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, - 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, - 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6, -} - -var p = [18]uint32{ - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, - 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, - 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, -} diff --git a/Godeps/_workspace/src/golang.org/x/image/LICENSE b/Godeps/_workspace/src/golang.org/x/image/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/image/PATENTS b/Godeps/_workspace/src/golang.org/x/image/PATENTS deleted file mode 100644 index 733099041..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/image/bmp/reader.go b/Godeps/_workspace/src/golang.org/x/image/bmp/reader.go deleted file mode 100644 index a48cba84d..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/bmp/reader.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package bmp implements a BMP image decoder and encoder. -// -// The BMP specification is at http://www.digicamsoft.com/bmp/bmp.html. -package bmp - -import ( - "errors" - "image" - "image/color" - "io" -) - -// ErrUnsupported means that the input BMP image uses a valid but unsupported -// feature. -var ErrUnsupported = errors.New("bmp: unsupported BMP image") - -func readUint16(b []byte) uint16 { - return uint16(b[0]) | uint16(b[1])<<8 -} - -func readUint32(b []byte) uint32 { - return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 -} - -// decodePaletted reads an 8 bit-per-pixel BMP image from r. -// If topDown is false, the image rows will be read bottom-up. -func decodePaletted(r io.Reader, c image.Config, topDown bool) (image.Image, error) { - paletted := image.NewPaletted(image.Rect(0, 0, c.Width, c.Height), c.ColorModel.(color.Palette)) - if c.Width == 0 || c.Height == 0 { - return paletted, nil - } - var tmp [4]byte - y0, y1, yDelta := c.Height-1, -1, -1 - if topDown { - y0, y1, yDelta = 0, c.Height, +1 - } - for y := y0; y != y1; y += yDelta { - p := paletted.Pix[y*paletted.Stride : y*paletted.Stride+c.Width] - if _, err := io.ReadFull(r, p); err != nil { - return nil, err - } - // Each row is 4-byte aligned. - if c.Width%4 != 0 { - _, err := io.ReadFull(r, tmp[:4-c.Width%4]) - if err != nil { - return nil, err - } - } - } - return paletted, nil -} - -// decodeRGB reads a 24 bit-per-pixel BMP image from r. -// If topDown is false, the image rows will be read bottom-up. -func decodeRGB(r io.Reader, c image.Config, topDown bool) (image.Image, error) { - rgba := image.NewRGBA(image.Rect(0, 0, c.Width, c.Height)) - if c.Width == 0 || c.Height == 0 { - return rgba, nil - } - // There are 3 bytes per pixel, and each row is 4-byte aligned. - b := make([]byte, (3*c.Width+3)&^3) - y0, y1, yDelta := c.Height-1, -1, -1 - if topDown { - y0, y1, yDelta = 0, c.Height, +1 - } - for y := y0; y != y1; y += yDelta { - if _, err := io.ReadFull(r, b); err != nil { - return nil, err - } - p := rgba.Pix[y*rgba.Stride : y*rgba.Stride+c.Width*4] - for i, j := 0, 0; i < len(p); i, j = i+4, j+3 { - // BMP images are stored in BGR order rather than RGB order. - p[i+0] = b[j+2] - p[i+1] = b[j+1] - p[i+2] = b[j+0] - p[i+3] = 0xFF - } - } - return rgba, nil -} - -// decodeNRGBA reads a 32 bit-per-pixel BMP image from r. -// If topDown is false, the image rows will be read bottom-up. -func decodeNRGBA(r io.Reader, c image.Config, topDown bool) (image.Image, error) { - rgba := image.NewNRGBA(image.Rect(0, 0, c.Width, c.Height)) - if c.Width == 0 || c.Height == 0 { - return rgba, nil - } - y0, y1, yDelta := c.Height-1, -1, -1 - if topDown { - y0, y1, yDelta = 0, c.Height, +1 - } - for y := y0; y != y1; y += yDelta { - p := rgba.Pix[y*rgba.Stride : y*rgba.Stride+c.Width*4] - if _, err := io.ReadFull(r, p); err != nil { - return nil, err - } - for i := 0; i < len(p); i += 4 { - // BMP images are stored in BGRA order rather than RGBA order. - p[i+0], p[i+2] = p[i+2], p[i+0] - } - } - return rgba, nil -} - -// Decode reads a BMP image from r and returns it as an image.Image. -// Limitation: The file must be 8, 24 or 32 bits per pixel. -func Decode(r io.Reader) (image.Image, error) { - c, bpp, topDown, err := decodeConfig(r) - if err != nil { - return nil, err - } - switch bpp { - case 8: - return decodePaletted(r, c, topDown) - case 24: - return decodeRGB(r, c, topDown) - case 32: - return decodeNRGBA(r, c, topDown) - } - panic("unreachable") -} - -// DecodeConfig returns the color model and dimensions of a BMP image without -// decoding the entire image. -// Limitation: The file must be 8, 24 or 32 bits per pixel. -func DecodeConfig(r io.Reader) (image.Config, error) { - config, _, _, err := decodeConfig(r) - return config, err -} - -func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown bool, err error) { - // We only support those BMP images that are a BITMAPFILEHEADER - // immediately followed by a BITMAPINFOHEADER. - const ( - fileHeaderLen = 14 - infoHeaderLen = 40 - ) - var b [1024]byte - if _, err := io.ReadFull(r, b[:fileHeaderLen+infoHeaderLen]); err != nil { - return image.Config{}, 0, false, err - } - if string(b[:2]) != "BM" { - return image.Config{}, 0, false, errors.New("bmp: invalid format") - } - offset := readUint32(b[10:14]) - if readUint32(b[14:18]) != infoHeaderLen { - return image.Config{}, 0, false, ErrUnsupported - } - width := int(int32(readUint32(b[18:22]))) - height := int(int32(readUint32(b[22:26]))) - if height < 0 { - height, topDown = -height, true - } - if width < 0 || height < 0 { - return image.Config{}, 0, false, ErrUnsupported - } - // We only support 1 plane, 8 or 24 bits per pixel and no compression. - planes, bpp, compression := readUint16(b[26:28]), readUint16(b[28:30]), readUint32(b[30:34]) - if planes != 1 || compression != 0 { - return image.Config{}, 0, false, ErrUnsupported - } - switch bpp { - case 8: - if offset != fileHeaderLen+infoHeaderLen+256*4 { - return image.Config{}, 0, false, ErrUnsupported - } - _, err = io.ReadFull(r, b[:256*4]) - if err != nil { - return image.Config{}, 0, false, err - } - pcm := make(color.Palette, 256) - for i := range pcm { - // BMP images are stored in BGR order rather than RGB order. - // Every 4th byte is padding. - pcm[i] = color.RGBA{b[4*i+2], b[4*i+1], b[4*i+0], 0xFF} - } - return image.Config{ColorModel: pcm, Width: width, Height: height}, 8, topDown, nil - case 24: - if offset != fileHeaderLen+infoHeaderLen { - return image.Config{}, 0, false, ErrUnsupported - } - return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 24, topDown, nil - case 32: - if offset != fileHeaderLen+infoHeaderLen { - return image.Config{}, 0, false, ErrUnsupported - } - return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 32, topDown, nil - } - return image.Config{}, 0, false, ErrUnsupported -} - -func init() { - image.RegisterFormat("bmp", "BM????\x00\x00\x00\x00", Decode, DecodeConfig) -} diff --git a/Godeps/_workspace/src/golang.org/x/image/bmp/writer.go b/Godeps/_workspace/src/golang.org/x/image/bmp/writer.go deleted file mode 100644 index 6947968a4..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/bmp/writer.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bmp - -import ( - "encoding/binary" - "errors" - "image" - "io" -) - -type header struct { - sigBM [2]byte - fileSize uint32 - resverved [2]uint16 - pixOffset uint32 - dibHeaderSize uint32 - width uint32 - height uint32 - colorPlane uint16 - bpp uint16 - compression uint32 - imageSize uint32 - xPixelsPerMeter uint32 - yPixelsPerMeter uint32 - colorUse uint32 - colorImportant uint32 -} - -func encodePaletted(w io.Writer, pix []uint8, dx, dy, stride, step int) error { - var padding []byte - if dx < step { - padding = make([]byte, step-dx) - } - for y := dy - 1; y >= 0; y-- { - min := y*stride + 0 - max := y*stride + dx - if _, err := w.Write(pix[min:max]); err != nil { - return err - } - if padding != nil { - if _, err := w.Write(padding); err != nil { - return err - } - } - } - return nil -} - -func encodeRGBA(w io.Writer, pix []uint8, dx, dy, stride, step int) error { - buf := make([]byte, step) - for y := dy - 1; y >= 0; y-- { - min := y*stride + 0 - max := y*stride + dx*4 - off := 0 - for i := min; i < max; i += 4 { - buf[off+2] = pix[i+0] - buf[off+1] = pix[i+1] - buf[off+0] = pix[i+2] - off += 3 - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -func encode(w io.Writer, m image.Image, step int) error { - b := m.Bounds() - buf := make([]byte, step) - for y := b.Max.Y - 1; y >= b.Min.Y; y-- { - off := 0 - for x := b.Min.X; x < b.Max.X; x++ { - r, g, b, _ := m.At(x, y).RGBA() - buf[off+2] = byte(r >> 8) - buf[off+1] = byte(g >> 8) - buf[off+0] = byte(b >> 8) - off += 3 - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -// Encode writes the image m to w in BMP format. -func Encode(w io.Writer, m image.Image) error { - d := m.Bounds().Size() - if d.X < 0 || d.Y < 0 { - return errors.New("bmp: negative bounds") - } - h := &header{ - sigBM: [2]byte{'B', 'M'}, - fileSize: 14 + 40, - pixOffset: 14 + 40, - dibHeaderSize: 40, - width: uint32(d.X), - height: uint32(d.Y), - colorPlane: 1, - } - - var step int - var palette []byte - switch m := m.(type) { - case *image.Gray: - step = (d.X + 3) &^ 3 - palette = make([]byte, 1024) - for i := 0; i < 256; i++ { - palette[i*4+0] = uint8(i) - palette[i*4+1] = uint8(i) - palette[i*4+2] = uint8(i) - palette[i*4+3] = 0xFF - } - h.imageSize = uint32(d.Y * step) - h.fileSize += uint32(len(palette)) + h.imageSize - h.pixOffset += uint32(len(palette)) - h.bpp = 8 - - case *image.Paletted: - step = (d.X + 3) &^ 3 - palette = make([]byte, 1024) - for i := 0; i < len(m.Palette) && i < 256; i++ { - r, g, b, _ := m.Palette[i].RGBA() - palette[i*4+0] = uint8(b >> 8) - palette[i*4+1] = uint8(g >> 8) - palette[i*4+2] = uint8(r >> 8) - palette[i*4+3] = 0xFF - } - h.imageSize = uint32(d.Y * step) - h.fileSize += uint32(len(palette)) + h.imageSize - h.pixOffset += uint32(len(palette)) - h.bpp = 8 - default: - step = (3*d.X + 3) &^ 3 - h.imageSize = uint32(d.Y * step) - h.fileSize += h.imageSize - h.bpp = 24 - } - - if err := binary.Write(w, binary.LittleEndian, h); err != nil { - return err - } - if palette != nil { - if err := binary.Write(w, binary.LittleEndian, palette); err != nil { - return err - } - } - - if d.X == 0 || d.Y == 0 { - return nil - } - - switch m := m.(type) { - case *image.Gray: - return encodePaletted(w, m.Pix, d.X, d.Y, m.Stride, step) - case *image.Paletted: - return encodePaletted(w, m.Pix, d.X, d.Y, m.Stride, step) - case *image.RGBA: - return encodeRGBA(w, m.Pix, d.X, d.Y, m.Stride, step) - } - return encode(w, m, step) -} diff --git a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/basicfont.go b/Godeps/_workspace/src/golang.org/x/image/font/basicfont/basicfont.go deleted file mode 100644 index 7eae19c8b..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/basicfont.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go - -// Package basicfont provides fixed-size font faces. -package basicfont - -import ( - "image" - - "golang.org/x/image/math/fixed" -) - -// Range maps a contiguous range of runes to vertically adjacent sub-images of -// a Face's Mask image. The rune range is inclusive on the low end and -// exclusive on the high end. -// -// If Low <= r && r < High, then the rune r is mapped to the sub-image of -// Face.Mask whose bounds are image.Rect(0, y, Face.Width, y+Face.Height), -// where y equals (int(r-Low) + Offset) * Face.Height. -type Range struct { - Low, High rune - Offset int -} - -// Face7x13 is a Face derived from the public domain X11 misc-fixed font files. -// -// At the moment, it holds the printable characters in ASCII starting with -// space, and the Unicode replacement character U+FFFD. -// -// Its data is entirely self-contained and does not require loading from -// separate files. -var Face7x13 = &Face{ - Advance: 7, - Width: 6, - Height: 13, - Ascent: 11, - Mask: mask7x13, - Ranges: []Range{ - {'\u0020', '\u007f', 0}, - {'\ufffd', '\ufffe', 95}, - }, -} - -// Face is a basic font face whose glyphs all have the same metrics. -// -// It is safe to use concurrently. -type Face struct { - // Advance is the glyph advance, in pixels. - Advance int - // Width is the glyph width, in pixels. - Width int - // Height is the glyph height, in pixels. - Height int - // Ascent is the glyph ascent, in pixels. - Ascent int - - // TODO: do we also need Top and Left fields? - - // Mask contains all of the glyph masks. Its width is typically the Face's - // Width, and its height a multiple of the Face's Height. - Mask image.Image - // Ranges map runes to sub-images of Mask. The rune ranges must not - // overlap, and must be in increasing rune order. - Ranges []Range -} - -func (f *Face) Close() error { return nil } -func (f *Face) Kern(r0, r1 rune) fixed.Int26_6 { return 0 } - -func (f *Face) Glyph(dot fixed.Point26_6, r rune) ( - dr image.Rectangle, mask image.Image, maskp image.Point, advance fixed.Int26_6, ok bool) { - -loop: - for _, rr := range [2]rune{r, '\ufffd'} { - for _, rng := range f.Ranges { - if rr < rng.Low || rng.High <= rr { - continue - } - maskp.Y = (int(rr-rng.Low) + rng.Offset) * f.Height - ok = true - break loop - } - } - if !ok { - return image.Rectangle{}, nil, image.Point{}, 0, false - } - - minX := int(dot.X+32) >> 6 - minY := int(dot.Y+32)>>6 - f.Ascent - dr = image.Rectangle{ - Min: image.Point{ - X: minX, - Y: minY, - }, - Max: image.Point{ - X: minX + f.Width, - Y: minY + f.Height, - }, - } - - return dr, f.Mask, maskp, fixed.I(f.Advance), true -} - -func (f *Face) GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool) { - return fixed.R(0, -f.Ascent, f.Width, -f.Ascent+f.Height), fixed.I(f.Advance), true -} - -func (f *Face) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) { - return fixed.I(f.Advance), true -} diff --git a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/data.go b/Godeps/_workspace/src/golang.org/x/image/font/basicfont/data.go deleted file mode 100644 index 883532117..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/data.go +++ /dev/null @@ -1,1456 +0,0 @@ -// generated by go generate; DO NOT EDIT. - -package basicfont - -// This data is derived from files in the font/fixed directory of the Plan 9 -// Port source code (https://github.com/9fans/plan9port) which were originally -// based on the public domain X11 misc-fixed font files. - -import "image" - -// mask7x13 contains 96 6×13 glyphs in 7488 Pix bytes. -var mask7x13 = &image.Alpha{ - Stride: 6, - Rect: image.Rectangle{Max: image.Point{6, 96 * 13}}, - Pix: []byte{ - // 0x20 ' ' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x21 '!' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x22 '"' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x23 '#' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x24 '$' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x25 '%' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x26 '&' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x27 '\'' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x28 '(' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x29 ')' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2a '*' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2b '+' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2c ',' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2d '-' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2e '.' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x2f '/' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x30 '0' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x31 '1' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x32 '2' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x33 '3' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x34 '4' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x35 '5' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x36 '6' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x37 '7' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x38 '8' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x39 '9' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3a ':' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3b ';' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3c '<' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3d '=' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3e '>' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x3f '?' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x40 '@' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x41 'A' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x42 'B' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x43 'C' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x44 'D' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x45 'E' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x46 'F' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x47 'G' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x48 'H' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x49 'I' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4a 'J' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4b 'K' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4c 'L' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4d 'M' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4e 'N' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x4f 'O' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x50 'P' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x51 'Q' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x52 'R' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x53 'S' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x54 'T' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x55 'U' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x56 'V' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x57 'W' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x58 'X' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x59 'Y' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5a 'Z' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5b '[' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5c '\\' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5d ']' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5e '^' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x5f '_' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x60 '`' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x61 'a' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x62 'b' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x63 'c' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x64 'd' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x65 'e' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x66 'f' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x67 'g' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - - // 0x68 'h' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x69 'i' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x6a 'j' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - - // 0x6b 'k' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x6c 'l' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x6d 'm' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x6e 'n' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x6f 'o' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x70 'p' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x71 'q' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - - // 0x72 'r' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x73 's' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x74 't' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x75 'u' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x76 'v' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x77 'w' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x78 'x' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x79 'y' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, - - // 0x7a 'z' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x7b '{' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x7c '|' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x7d '}' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // 0x7e '~' - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - // U+FFFD REPLACEMENT CHARACTER - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, - 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, -} diff --git a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/gen.go b/Godeps/_workspace/src/golang.org/x/image/font/basicfont/gen.go deleted file mode 100644 index 67a21a74a..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/basicfont/gen.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// This program generates data.go. -package main - -import ( - "bytes" - "fmt" - "go/format" - "image" - "image/draw" - "io/ioutil" - "log" - "path" - "path/filepath" - - "golang.org/x/image/font" - "golang.org/x/image/font/plan9font" - "golang.org/x/image/math/fixed" -) - -func main() { - // nGlyphs is the number of glyphs to generate: 95 characters in the range - // [0x20, 0x7e], plus the replacement character. - const nGlyphs = 95 + 1 - // The particular font (unicode.7x13.font) leaves the right-most column - // empty in its ASCII glyphs. We don't have to include that column in the - // generated glyphs, so we subtract one off the effective width. - const width, height, ascent = 7 - 1, 13, 11 - - readFile := func(name string) ([]byte, error) { - return ioutil.ReadFile(filepath.FromSlash(path.Join("../testdata/fixed", name))) - } - fontData, err := readFile("unicode.7x13.font") - if err != nil { - log.Fatalf("readFile: %v", err) - } - face, err := plan9font.ParseFont(fontData, readFile) - if err != nil { - log.Fatalf("plan9font.ParseFont: %v", err) - } - - dst := image.NewRGBA(image.Rect(0, 0, width, nGlyphs*height)) - draw.Draw(dst, dst.Bounds(), image.Black, image.Point{}, draw.Src) - d := &font.Drawer{ - Dst: dst, - Src: image.White, - Face: face, - } - for i := 0; i < nGlyphs; i++ { - r := '\ufffd' - if i < nGlyphs-1 { - r = 0x20 + rune(i) - } - d.Dot = fixed.P(0, height*i+ascent) - d.DrawString(string(r)) - } - - w := bytes.NewBuffer(nil) - w.WriteString(preamble) - fmt.Fprintf(w, "// mask7x13 contains %d %d×%d glyphs in %d Pix bytes.\n", nGlyphs, width, height, nGlyphs*width*height) - fmt.Fprintf(w, "var mask7x13 = &image.Alpha{\n") - fmt.Fprintf(w, " Stride: %d,\n", width) - fmt.Fprintf(w, " Rect: image.Rectangle{Max: image.Point{%d, %d*%d}},\n", width, nGlyphs, height) - fmt.Fprintf(w, " Pix: []byte{\n") - b := dst.Bounds() - for y := b.Min.Y; y < b.Max.Y; y++ { - if y%height == 0 { - if y != 0 { - w.WriteByte('\n') - } - i := y / height - if i < nGlyphs-1 { - i += 0x20 - fmt.Fprintf(w, "// %#2x %q\n", i, rune(i)) - } else { - fmt.Fprintf(w, "// U+FFFD REPLACEMENT CHARACTER\n") - } - } - - for x := b.Min.X; x < b.Max.X; x++ { - if dst.RGBAAt(x, y).R > 0 { - w.WriteString("0xff,") - } else { - w.WriteString("0x00,") - } - } - w.WriteByte('\n') - } - w.WriteString("},\n}\n") - - fmted, err := format.Source(w.Bytes()) - if err != nil { - log.Fatalf("format.Source: %v", err) - } - if err := ioutil.WriteFile("data.go", fmted, 0644); err != nil { - log.Fatalf("ioutil.WriteFile: %v", err) - } -} - -const preamble = `// generated by go generate; DO NOT EDIT. - -package basicfont - -// This data is derived from files in the font/fixed directory of the Plan 9 -// Port source code (https://github.com/9fans/plan9port) which were originally -// based on the public domain X11 misc-fixed font files. - -import "image" - -` diff --git a/Godeps/_workspace/src/golang.org/x/image/font/font.go b/Godeps/_workspace/src/golang.org/x/image/font/font.go deleted file mode 100644 index de8802fcc..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/font.go +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package font defines an interface for font faces, for drawing text on an -// image. -// -// Other packages provide font face implementations. For example, a truetype -// package would provide one based on .ttf font files. -package font - -import ( - "image" - "image/draw" - "io" - - "golang.org/x/image/math/fixed" -) - -// TODO: who is responsible for caches (glyph images, glyph indices, kerns)? -// The Drawer or the Face? - -// Face is a font face. Its glyphs are often derived from a font file, such as -// "Comic_Sans_MS.ttf", but a face has a specific size, style, weight and -// hinting. For example, the 12pt and 18pt versions of Comic Sans are two -// different faces, even if derived from the same font file. -// -// A Face is not safe for concurrent use by multiple goroutines, as its methods -// may re-use implementation-specific caches and mask image buffers. -// -// To create a Face, look to other packages that implement specific font file -// formats. -type Face interface { - io.Closer - - // Glyph returns the draw.DrawMask parameters (dr, mask, maskp) to draw r's - // glyph at the sub-pixel destination location dot, and that glyph's - // advance width. - // - // It returns !ok if the face does not contain a glyph for r. - // - // The contents of the mask image returned by one Glyph call may change - // after the next Glyph call. Callers that want to cache the mask must make - // a copy. - Glyph(dot fixed.Point26_6, r rune) ( - dr image.Rectangle, mask image.Image, maskp image.Point, advance fixed.Int26_6, ok bool) - - // GlyphBounds returns the bounding box of r's glyph, drawn at a dot equal - // to the origin, and that glyph's advance width. - // - // It returns !ok if the face does not contain a glyph for r. - // - // The glyph's ascent and descent equal -bounds.Min.Y and +bounds.Max.Y. A - // visual depiction of what these metrics are is at - // https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_metrics_2x.png - GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool) - - // GlyphAdvance returns the advance width of r's glyph. - // - // It returns !ok if the face does not contain a glyph for r. - GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) - - // Kern returns the horizontal adjustment for the kerning pair (r0, r1). A - // positive kern means to move the glyphs further apart. - Kern(r0, r1 rune) fixed.Int26_6 - - // TODO: per-font Metrics. - // TODO: ColoredGlyph for various emoji? - // TODO: Ligatures? Shaping? -} - -// TODO: Drawer.Layout or Drawer.Measure methods to measure text without -// drawing? - -// Drawer draws text on a destination image. -// -// A Drawer is not safe for concurrent use by multiple goroutines, since its -// Face is not. -type Drawer struct { - // Dst is the destination image. - Dst draw.Image - // Src is the source image. - Src image.Image - // Face provides the glyph mask images. - Face Face - // Dot is the baseline location to draw the next glyph. The majority of the - // affected pixels will be above and to the right of the dot, but some may - // be below or to the left. For example, drawing a 'j' in an italic face - // may affect pixels below and to the left of the dot. - Dot fixed.Point26_6 - - // TODO: Clip image.Image? - // TODO: SrcP image.Point for Src images other than *image.Uniform? How - // does it get updated during DrawString? -} - -// TODO: should DrawString return the last rune drawn, so the next DrawString -// call can kern beforehand? Or should that be the responsibility of the caller -// if they really want to do that, since they have to explicitly shift d.Dot -// anyway? -// -// In general, we'd have a DrawBytes([]byte) and DrawRuneReader(io.RuneReader) -// and the last case can't assume that you can rewind the stream. -// -// TODO: how does this work with line breaking: drawing text up until a -// vertical line? Should DrawString return the number of runes drawn? - -// DrawString draws s at the dot and advances the dot's location. -func (d *Drawer) DrawString(s string) { - var prevC rune - for i, c := range s { - if i != 0 { - d.Dot.X += d.Face.Kern(prevC, c) - } - dr, mask, maskp, advance, ok := d.Face.Glyph(d.Dot, c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue - } - draw.DrawMask(d.Dst, dr, d.Src, image.Point{}, mask, maskp, draw.Over) - d.Dot.X += advance - prevC = c - } -} - -// MeasureString returns how far dot would advance by drawing s. -func (d *Drawer) MeasureString(s string) (advance fixed.Int26_6) { - var prevC rune - for i, c := range s { - if i != 0 { - advance += d.Face.Kern(prevC, c) - } - a, ok := d.Face.GlyphAdvance(c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue - } - advance += a - prevC = c - } - return advance -} - -// Hinting selects how to quantize a vector font's glyph nodes. -// -// Not all fonts support hinting. -type Hinting int - -const ( - HintingNone Hinting = iota - HintingVertical - HintingFull -) - -// Stretch selects a normal, condensed, or expanded face. -// -// Not all fonts support stretches. -type Stretch int - -const ( - StretchUltraCondensed Stretch = -4 - StretchExtraCondensed Stretch = -3 - StretchCondensed Stretch = -2 - StretchSemiCondensed Stretch = -1 - StretchNormal Stretch = +0 - StretchSemiExpanded Stretch = +1 - StretchExpanded Stretch = +2 - StretchExtraExpanded Stretch = +3 - StretchUltraExpanded Stretch = +4 -) - -// Style selects a normal, italic, or oblique face. -// -// Not all fonts support styles. -type Style int - -const ( - StyleNormal Style = iota - StyleItalic - StyleOblique -) - -// Weight selects a normal, light or bold face. -// -// Not all fonts support weights. -type Weight int - -const ( - WeightThin Weight = 100 - WeightExtraLight Weight = 200 - WeightLight Weight = 300 - WeightNormal Weight = 400 - WeightMedium Weight = 500 - WeightSemiBold Weight = 600 - WeightBold Weight = 700 - WeightExtraBold Weight = 800 - WeightBlack Weight = 900 -) diff --git a/Godeps/_workspace/src/golang.org/x/image/font/plan9font/plan9font.go b/Godeps/_workspace/src/golang.org/x/image/font/plan9font/plan9font.go deleted file mode 100644 index 9c686b776..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/plan9font/plan9font.go +++ /dev/null @@ -1,556 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package plan9font implements font faces for the Plan 9 font and subfont file -// formats. These formats are described at -// http://plan9.bell-labs.com/magic/man2html/6/font -package plan9font - -// TODO: have a subface use an *image.Alpha instead of plan9Image implementing -// the image.Image interface? The image/draw code has a fast path for -// *image.Alpha masks. - -import ( - "bytes" - "errors" - "fmt" - "image" - "image/color" - "log" - "strconv" - "strings" - - "golang.org/x/image/font" - "golang.org/x/image/math/fixed" -) - -// fontchar describes one character glyph in a subfont. -// -// For more detail, look for "struct Fontchar" in -// http://plan9.bell-labs.com/magic/man2html/2/cachechars -type fontchar struct { - x uint32 // X position in the image holding the glyphs. - top uint8 // First non-zero scan line. - bottom uint8 // Last non-zero scan line. - left int8 // Offset of baseline. - width uint8 // Width of baseline. -} - -func parseFontchars(p []byte) []fontchar { - fc := make([]fontchar, len(p)/6) - for i := range fc { - fc[i] = fontchar{ - x: uint32(p[0]) | uint32(p[1])<<8, - top: uint8(p[2]), - bottom: uint8(p[3]), - left: int8(p[4]), - width: uint8(p[5]), - } - p = p[6:] - } - return fc -} - -// subface implements font.Face for a Plan 9 subfont. -type subface struct { - firstRune rune // First rune in the subfont. - n int // Number of characters in the subfont. - height int // Inter-line spacing. - ascent int // Height above the baseline. - fontchars []fontchar // Character descriptions. - img *plan9Image // Image holding the glyphs. -} - -func (f *subface) Close() error { return nil } -func (f *subface) Kern(r0, r1 rune) fixed.Int26_6 { return 0 } - -func (f *subface) Glyph(dot fixed.Point26_6, r rune) ( - dr image.Rectangle, mask image.Image, maskp image.Point, advance fixed.Int26_6, ok bool) { - - r -= f.firstRune - if r < 0 || f.n <= int(r) { - return image.Rectangle{}, nil, image.Point{}, 0, false - } - i := &f.fontchars[r+0] - j := &f.fontchars[r+1] - - minX := int(dot.X+32)>>6 + int(i.left) - minY := int(dot.Y+32)>>6 + int(i.top) - f.ascent - dr = image.Rectangle{ - Min: image.Point{ - X: minX, - Y: minY, - }, - Max: image.Point{ - X: minX + int(j.x-i.x), - Y: minY + int(i.bottom) - int(i.top), - }, - } - return dr, f.img, image.Point{int(i.x), int(i.top)}, fixed.Int26_6(i.width) << 6, true -} - -func (f *subface) GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool) { - r -= f.firstRune - if r < 0 || f.n <= int(r) { - return fixed.Rectangle26_6{}, 0, false - } - i := &f.fontchars[r+0] - j := &f.fontchars[r+1] - - bounds = fixed.R( - int(i.left), - int(i.top)-f.ascent, - int(i.left)+int(j.x-i.x), - int(i.bottom)-f.ascent, - ) - return bounds, fixed.Int26_6(i.width) << 6, true -} - -func (f *subface) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) { - r -= f.firstRune - if r < 0 || f.n <= int(r) { - return 0, false - } - return fixed.Int26_6(f.fontchars[r].width) << 6, true -} - -// runeRange maps a single rune range [lo, hi] to a lazily loaded subface. Both -// ends of the range are inclusive. -type runeRange struct { - lo, hi rune - offset rune // subfont index that the lo rune maps to. - relFilename string - subface *subface - bad bool -} - -// face implements font.Face for a Plan 9 font. -// -// It maps multiple rune ranges to *subface values. Rune ranges may overlap; -// the first match wins. -type face struct { - height int - ascent int - readFile func(relFilename string) ([]byte, error) - runeRanges []runeRange -} - -func (f *face) Close() error { return nil } -func (f *face) Kern(r0, r1 rune) fixed.Int26_6 { return 0 } - -func (f *face) Glyph(dot fixed.Point26_6, r rune) ( - dr image.Rectangle, mask image.Image, maskp image.Point, advance fixed.Int26_6, ok bool) { - - if s, rr := f.subface(r); s != nil { - return s.Glyph(dot, rr) - } - return image.Rectangle{}, nil, image.Point{}, 0, false -} - -func (f *face) GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool) { - if s, rr := f.subface(r); s != nil { - return s.GlyphBounds(rr) - } - return fixed.Rectangle26_6{}, 0, false -} - -func (f *face) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) { - if s, rr := f.subface(r); s != nil { - return s.GlyphAdvance(rr) - } - return 0, false -} - -func (f *face) subface(r rune) (*subface, rune) { - // Fall back on U+FFFD if we can't find r. - for _, rr := range [2]rune{r, '\ufffd'} { - // We have to do linear, not binary search. plan9port's - // lucsans/unicode.8.font says: - // 0x2591 0x2593 ../luc/Altshades.7.0 - // 0x2500 0x25ee ../luc/FormBlock.7.0 - // and the rune ranges overlap. - for i := range f.runeRanges { - x := &f.runeRanges[i] - if rr < x.lo || x.hi < rr || x.bad { - continue - } - if x.subface == nil { - data, err := f.readFile(x.relFilename) - if err != nil { - log.Printf("plan9font: couldn't read subfont %q: %v", x.relFilename, err) - x.bad = true - continue - } - sub, err := ParseSubfont(data, x.lo-x.offset) - if err != nil { - log.Printf("plan9font: couldn't parse subfont %q: %v", x.relFilename, err) - x.bad = true - continue - } - x.subface = sub.(*subface) - } - return x.subface, rr - } - } - return nil, 0 -} - -// ParseFont parses a Plan 9 font file. data is the contents of that font file, -// which gives relative filenames for subfont files. readFile returns the -// contents of those subfont files. It is similar to io/ioutil's ReadFile -// function, except that it takes a relative filename instead of an absolute -// one. -func ParseFont(data []byte, readFile func(relFilename string) ([]byte, error)) (font.Face, error) { - f := &face{ - readFile: readFile, - } - // TODO: don't use strconv, to avoid the conversions from []byte to string? - for first := true; len(data) > 0; first = false { - i := bytes.IndexByte(data, '\n') - if i < 0 { - return nil, errors.New("plan9font: invalid font: no final newline") - } - row := string(data[:i]) - data = data[i+1:] - if first { - height, s, ok := nextInt32(row) - if !ok { - return nil, fmt.Errorf("plan9font: invalid font: invalid header %q", row) - } - ascent, s, ok := nextInt32(s) - if !ok { - return nil, fmt.Errorf("plan9font: invalid font: invalid header %q", row) - } - if height < 0 || 0xffff < height || ascent < 0 || 0xffff < ascent { - return nil, fmt.Errorf("plan9font: invalid font: invalid header %q", row) - } - f.height, f.ascent = int(height), int(ascent) - continue - } - lo, s, ok := nextInt32(row) - if !ok { - return nil, fmt.Errorf("plan9font: invalid font: invalid row %q", row) - } - hi, s, ok := nextInt32(s) - if !ok { - return nil, fmt.Errorf("plan9font: invalid font: invalid row %q", row) - } - offset, s, _ := nextInt32(s) - - f.runeRanges = append(f.runeRanges, runeRange{ - lo: lo, - hi: hi, - offset: offset, - relFilename: s, - }) - } - return f, nil -} - -func nextInt32(s string) (ret int32, remaining string, ok bool) { - i := 0 - for ; i < len(s) && s[i] <= ' '; i++ { - } - j := i - for ; j < len(s) && s[j] > ' '; j++ { - } - n, err := strconv.ParseInt(s[i:j], 0, 32) - if err != nil { - return 0, s, false - } - for ; j < len(s) && s[j] <= ' '; j++ { - } - return int32(n), s[j:], true -} - -// ParseSubfont parses a Plan 9 subfont file. -// -// firstRune is the first rune in the subfont file. For example, the -// Phonetic.6.0 subfont, containing glyphs in the range U+0250 to U+02E9, would -// set firstRune to '\u0250'. -func ParseSubfont(data []byte, firstRune rune) (font.Face, error) { - data, m, err := parseImage(data) - if err != nil { - return nil, err - } - if len(data) < 3*12 { - return nil, errors.New("plan9font: invalid subfont: header too short") - } - n := atoi(data[0*12:]) - height := atoi(data[1*12:]) - ascent := atoi(data[2*12:]) - data = data[3*12:] - if len(data) != 6*(n+1) { - return nil, errors.New("plan9font: invalid subfont: data length mismatch") - } - return &subface{ - firstRune: firstRune, - n: n, - height: height, - ascent: ascent, - fontchars: parseFontchars(data), - img: m, - }, nil -} - -// plan9Image implements that subset of the Plan 9 image feature set that is -// used by this font file format. -// -// Some features, such as the repl bit and a clip rectangle, are omitted for -// simplicity. -type plan9Image struct { - depth int // Depth of the pixels in bits. - width int // Width in bytes of a single scan line. - rect image.Rectangle // Extent of the image. - pix []byte // Pixel bits. -} - -func (m *plan9Image) byteoffset(x, y int) int { - a := y * m.width - if m.depth < 8 { - // We need to always round down, but Go rounds toward zero. - np := 8 / m.depth - if x < 0 { - return a + (x-np+1)/np - } - return a + x/np - } - return a + x*(m.depth/8) -} - -func (m *plan9Image) Bounds() image.Rectangle { return m.rect } -func (m *plan9Image) ColorModel() color.Model { return color.AlphaModel } - -func (m *plan9Image) At(x, y int) color.Color { - if (image.Point{x, y}).In(m.rect) { - b := m.pix[m.byteoffset(x, y)] - switch m.depth { - case 1: - // CGrey, 1. - mask := uint8(1 << uint8(7-x&7)) - if (b & mask) != 0 { - return color.Alpha{0xff} - } - return color.Alpha{0x00} - case 2: - // CGrey, 2. - shift := uint(x&3) << 1 - // Place pixel at top of word. - y := b << shift - y &= 0xc0 - // Replicate throughout. - y |= y >> 2 - y |= y >> 4 - return color.Alpha{y} - } - } - return color.Alpha{0x00} -} - -var compressed = []byte("compressed\n") - -func parseImage(data []byte) (remainingData []byte, m *plan9Image, retErr error) { - if !bytes.HasPrefix(data, compressed) { - return nil, nil, errors.New("plan9font: unsupported uncompressed format") - } - data = data[len(compressed):] - - const hdrSize = 5 * 12 - if len(data) < hdrSize { - return nil, nil, errors.New("plan9font: invalid image: header too short") - } - hdr, data := data[:hdrSize], data[hdrSize:] - - // Distinguish new channel descriptor from old ldepth. Channel descriptors - // have letters as well as numbers, while ldepths are a single digit - // formatted as %-11d. - new := false - for m := 0; m < 10; m++ { - if hdr[m] != ' ' { - new = true - break - } - } - if hdr[11] != ' ' { - return nil, nil, errors.New("plan9font: invalid image: bad header") - } - if !new { - return nil, nil, errors.New("plan9font: unsupported ldepth format") - } - - depth := 0 - switch s := strings.TrimSpace(string(hdr[:1*12])); s { - default: - return nil, nil, fmt.Errorf("plan9font: unsupported pixel format %q", s) - case "k1": - depth = 1 - case "k2": - depth = 2 - } - r := ator(hdr[1*12:]) - if r.Min.X > r.Max.X || r.Min.Y > r.Max.Y { - return nil, nil, errors.New("plan9font: invalid image: bad rectangle") - } - - width := bytesPerLine(r, depth) - m = &plan9Image{ - depth: depth, - width: width, - rect: r, - pix: make([]byte, width*r.Dy()), - } - - miny := r.Min.Y - for miny != r.Max.Y { - if len(data) < 2*12 { - return nil, nil, errors.New("plan9font: invalid image: data band too short") - } - maxy := atoi(data[0*12:]) - nb := atoi(data[1*12:]) - data = data[2*12:] - - if len(data) < nb { - return nil, nil, errors.New("plan9font: invalid image: data band length mismatch") - } - buf := data[:nb] - data = data[nb:] - - if maxy <= miny || r.Max.Y < maxy { - return nil, nil, fmt.Errorf("plan9font: bad maxy %d", maxy) - } - // An old-format image would flip the bits here, but we don't support - // the old format. - rr := r - rr.Min.Y = miny - rr.Max.Y = maxy - if err := decompress(m, rr, buf); err != nil { - return nil, nil, err - } - miny = maxy - } - return data, m, nil -} - -// Compressed data are sequences of byte codes. If the first byte b has the -// 0x80 bit set, the next (b^0x80)+1 bytes are data. Otherwise, these two bytes -// specify a previous string to repeat. -const ( - compShortestMatch = 3 // shortest match possible. - compWindowSize = 1024 // window size. -) - -var ( - errDecompressBufferTooSmall = errors.New("plan9font: decompress: buffer too small") - errDecompressPhaseError = errors.New("plan9font: decompress: phase error") -) - -func decompress(m *plan9Image, r image.Rectangle, data []byte) error { - if !r.In(m.rect) { - return errors.New("plan9font: decompress: bad rectangle") - } - bpl := bytesPerLine(r, m.depth) - mem := make([]byte, compWindowSize) - memi := 0 - omemi := -1 - y := r.Min.Y - linei := m.byteoffset(r.Min.X, y) - eline := linei + bpl - datai := 0 - for { - if linei == eline { - y++ - if y == r.Max.Y { - break - } - linei = m.byteoffset(r.Min.X, y) - eline = linei + bpl - } - if datai == len(data) { - return errDecompressBufferTooSmall - } - c := data[datai] - datai++ - if c >= 128 { - for cnt := c - 128 + 1; cnt != 0; cnt-- { - if datai == len(data) { - return errDecompressBufferTooSmall - } - if linei == eline { - return errDecompressPhaseError - } - m.pix[linei] = data[datai] - linei++ - mem[memi] = data[datai] - memi++ - datai++ - if memi == len(mem) { - memi = 0 - } - } - } else { - if datai == len(data) { - return errDecompressBufferTooSmall - } - offs := int(data[datai]) + ((int(c) & 3) << 8) + 1 - datai++ - if memi < offs { - omemi = memi + (compWindowSize - offs) - } else { - omemi = memi - offs - } - for cnt := (c >> 2) + compShortestMatch; cnt != 0; cnt-- { - if linei == eline { - return errDecompressPhaseError - } - m.pix[linei] = mem[omemi] - linei++ - mem[memi] = mem[omemi] - memi++ - omemi++ - if omemi == len(mem) { - omemi = 0 - } - if memi == len(mem) { - memi = 0 - } - } - } - } - return nil -} - -func ator(b []byte) image.Rectangle { - return image.Rectangle{atop(b), atop(b[2*12:])} -} - -func atop(b []byte) image.Point { - return image.Pt(atoi(b), atoi(b[12:])) -} - -func atoi(b []byte) int { - i := 0 - for ; i < len(b) && b[i] == ' '; i++ { - } - n := 0 - for ; i < len(b) && '0' <= b[i] && b[i] <= '9'; i++ { - n = n*10 + int(b[i]) - '0' - } - return n -} - -func bytesPerLine(r image.Rectangle, depth int) int { - if depth <= 0 || 32 < depth { - panic("invalid depth") - } - var l int - if r.Min.X >= 0 { - l = (r.Max.X*depth + 7) / 8 - l -= (r.Min.X * depth) / 8 - } else { - // Make positive before divide. - t := (-r.Min.X*depth + 7) / 8 - l = t + (r.Max.X*depth+7)/8 - } - return l -} diff --git a/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed.go b/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed.go deleted file mode 100644 index 7af56d9ee..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fixed implements fixed-point integer types. -package fixed - -import ( - "fmt" -) - -// TODO: implement fmt.Formatter for %f and %g. - -// I returns the integer value i as an Int26_6. -// -// For example, passing the integer value 2 yields Int26_6(128). -func I(i int) Int26_6 { - return Int26_6(i << 6) -} - -// Int26_6 is a signed 26.6 fixed-point number. -// -// The integer part ranges from -33554432 to 33554431, inclusive. The -// fractional part has 6 bits of precision. -// -// For example, the number one-and-a-quarter is Int26_6(1<<6 + 1<<4). -type Int26_6 int32 - -// String returns a human-readable representation of a 26.6 fixed-point number. -// -// For example, the number one-and-a-quarter becomes "1:16". -func (x Int26_6) String() string { - const shift, mask = 6, 1<<6 - 1 - if x >= 0 { - return fmt.Sprintf("%d:%02d", int32(x>>shift), int32(x&mask)) - } - x = -x - if x >= 0 { - return fmt.Sprintf("-%d:%02d", int32(x>>shift), int32(x&mask)) - } - return "-33554432:00" // The minimum value is -(1<<25). -} - -// Int52_12 is a signed 52.12 fixed-point number. -// -// The integer part ranges from -2251799813685248 to 2251799813685247, -// inclusive. The fractional part has 12 bits of precision. -// -// For example, the number one-and-a-quarter is Int52_12(1<<12 + 1<<10). -type Int52_12 int64 - -// String returns a human-readable representation of a 52.12 fixed-point -// number. -// -// For example, the number one-and-a-quarter becomes "1:1024". -func (x Int52_12) String() string { - const shift, mask = 12, 1<<12 - 1 - if x >= 0 { - return fmt.Sprintf("%d:%04d", int64(x>>shift), int64(x&mask)) - } - x = -x - if x >= 0 { - return fmt.Sprintf("-%d:%04d", int64(x>>shift), int64(x&mask)) - } - return "-2251799813685248:0000" // The minimum value is -(1<<51). -} - -// P returns the integer values x and y as a Point26_6. -// -// For example, passing the integer values (2, -3) yields Point26_6{128, -192}. -func P(x, y int) Point26_6 { - return Point26_6{Int26_6(x << 6), Int26_6(y << 6)} -} - -// Point26_6 is a 26.6 fixed-point coordinate pair. -// -// It is analogous to the image.Point type in the standard library. -type Point26_6 struct { - X, Y Int26_6 -} - -// Add returns the vector p+q. -func (p Point26_6) Add(q Point26_6) Point26_6 { - return Point26_6{p.X + q.X, p.Y + q.Y} -} - -// Sub returns the vector p-q. -func (p Point26_6) Sub(q Point26_6) Point26_6 { - return Point26_6{p.X - q.X, p.Y - q.Y} -} - -// Mul returns the vector p*k. -func (p Point26_6) Mul(k Int26_6) Point26_6 { - return Point26_6{p.X * k / 64, p.Y * k / 64} -} - -// Div returns the vector p/k. -func (p Point26_6) Div(k Int26_6) Point26_6 { - return Point26_6{p.X * 64 / k, p.Y * 64 / k} -} - -// Point52_12 is a 52.12 fixed-point coordinate pair. -// -// It is analogous to the image.Point type in the standard library. -type Point52_12 struct { - X, Y Int52_12 -} - -// Add returns the vector p+q. -func (p Point52_12) Add(q Point52_12) Point52_12 { - return Point52_12{p.X + q.X, p.Y + q.Y} -} - -// Sub returns the vector p-q. -func (p Point52_12) Sub(q Point52_12) Point52_12 { - return Point52_12{p.X - q.X, p.Y - q.Y} -} - -// Mul returns the vector p*k. -func (p Point52_12) Mul(k Int52_12) Point52_12 { - return Point52_12{p.X * k / 4096, p.Y * k / 4096} -} - -// Div returns the vector p/k. -func (p Point52_12) Div(k Int52_12) Point52_12 { - return Point52_12{p.X * 4096 / k, p.Y * 4096 / k} -} - -// R returns the integer values minX, minY, maxX, maxY as a Rectangle26_6. -// -// For example, passing the integer values (0, 1, 2, 3) yields -// Rectangle26_6{Point26_6{0, 64}, Point26_6{128, 192}}. -// -// Like the image.Rect function in the standard library, the returned rectangle -// has minimum and maximum coordinates swapped if necessary so that it is -// well-formed. -func R(minX, minY, maxX, maxY int) Rectangle26_6 { - if minX > maxX { - minX, maxX = maxX, minX - } - if minY > maxY { - minY, maxY = maxY, minY - } - return Rectangle26_6{ - Point26_6{ - Int26_6(minX << 6), - Int26_6(minY << 6), - }, - Point26_6{ - Int26_6(maxX << 6), - Int26_6(maxY << 6), - }, - } -} - -// Rectangle26_6 is a 26.6 fixed-point coordinate rectangle. The Min bound is -// inclusive and the Max bound is exclusive. It is well-formed if Min.X <= -// Max.X and likewise for Y. -// -// It is analogous to the image.Rectangle type in the standard library. -type Rectangle26_6 struct { - Min, Max Point26_6 -} - -// Rectangle52_12 is a 52.12 fixed-point coordinate rectangle. The Min bound is -// inclusive and the Max bound is exclusive. It is well-formed if Min.X <= -// Max.X and likewise for Y. -// -// It is analogous to the image.Rectangle type in the standard library. -type Rectangle52_12 struct { - Min, Max Point52_12 -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/buffer.go b/Godeps/_workspace/src/golang.org/x/image/tiff/buffer.go deleted file mode 100644 index d1801be48..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/buffer.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import "io" - -// buffer buffers an io.Reader to satisfy io.ReaderAt. -type buffer struct { - r io.Reader - buf []byte -} - -// fill reads data from b.r until the buffer contains at least end bytes. -func (b *buffer) fill(end int) error { - m := len(b.buf) - if end > m { - if end > cap(b.buf) { - newcap := 1024 - for newcap < end { - newcap *= 2 - } - newbuf := make([]byte, end, newcap) - copy(newbuf, b.buf) - b.buf = newbuf - } else { - b.buf = b.buf[:end] - } - if n, err := io.ReadFull(b.r, b.buf[m:end]); err != nil { - end = m + n - b.buf = b.buf[:end] - return err - } - } - return nil -} - -func (b *buffer) ReadAt(p []byte, off int64) (int, error) { - o := int(off) - end := o + len(p) - if int64(end) != off+int64(len(p)) { - return 0, io.ErrUnexpectedEOF - } - - err := b.fill(end) - return copy(p, b.buf[o:end]), err -} - -// Slice returns a slice of the underlying buffer. The slice contains -// n bytes starting at offset off. -func (b *buffer) Slice(off, n int) ([]byte, error) { - end := off + n - if err := b.fill(end); err != nil { - return nil, err - } - return b.buf[off:end], nil -} - -// newReaderAt converts an io.Reader into an io.ReaderAt. -func newReaderAt(r io.Reader) io.ReaderAt { - if ra, ok := r.(io.ReaderAt); ok { - return ra - } - return &buffer{ - r: r, - buf: make([]byte, 0, 1024), - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/compress.go b/Godeps/_workspace/src/golang.org/x/image/tiff/compress.go deleted file mode 100644 index 3f176f00a..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/compress.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import ( - "bufio" - "io" -) - -type byteReader interface { - io.Reader - io.ByteReader -} - -// unpackBits decodes the PackBits-compressed data in src and returns the -// uncompressed data. -// -// The PackBits compression format is described in section 9 (p. 42) -// of the TIFF spec. -func unpackBits(r io.Reader) ([]byte, error) { - buf := make([]byte, 128) - dst := make([]byte, 0, 1024) - br, ok := r.(byteReader) - if !ok { - br = bufio.NewReader(r) - } - - for { - b, err := br.ReadByte() - if err != nil { - if err == io.EOF { - return dst, nil - } - return nil, err - } - code := int(int8(b)) - switch { - case code >= 0: - n, err := io.ReadFull(br, buf[:code+1]) - if err != nil { - return nil, err - } - dst = append(dst, buf[:n]...) - case code == -128: - // No-op. - default: - if b, err = br.ReadByte(); err != nil { - return nil, err - } - for j := 0; j < 1-code; j++ { - buf[j] = b - } - dst = append(dst, buf[:1-code]...) - } - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/consts.go b/Godeps/_workspace/src/golang.org/x/image/tiff/consts.go deleted file mode 100644 index 3c51a70be..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/consts.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -// A tiff image file contains one or more images. The metadata -// of each image is contained in an Image File Directory (IFD), -// which contains entries of 12 bytes each and is described -// on page 14-16 of the specification. An IFD entry consists of -// -// - a tag, which describes the signification of the entry, -// - the data type and length of the entry, -// - the data itself or a pointer to it if it is more than 4 bytes. -// -// The presence of a length means that each IFD is effectively an array. - -const ( - leHeader = "II\x2A\x00" // Header for little-endian files. - beHeader = "MM\x00\x2A" // Header for big-endian files. - - ifdLen = 12 // Length of an IFD entry in bytes. -) - -// Data types (p. 14-16 of the spec). -const ( - dtByte = 1 - dtASCII = 2 - dtShort = 3 - dtLong = 4 - dtRational = 5 -) - -// The length of one instance of each data type in bytes. -var lengths = [...]uint32{0, 1, 1, 2, 4, 8} - -// Tags (see p. 28-41 of the spec). -const ( - tImageWidth = 256 - tImageLength = 257 - tBitsPerSample = 258 - tCompression = 259 - tPhotometricInterpretation = 262 - - tStripOffsets = 273 - tSamplesPerPixel = 277 - tRowsPerStrip = 278 - tStripByteCounts = 279 - - tTileWidth = 322 - tTileLength = 323 - tTileOffsets = 324 - tTileByteCounts = 325 - - tXResolution = 282 - tYResolution = 283 - tResolutionUnit = 296 - - tPredictor = 317 - tColorMap = 320 - tExtraSamples = 338 - tSampleFormat = 339 -) - -// Compression types (defined in various places in the spec and supplements). -const ( - cNone = 1 - cCCITT = 2 - cG3 = 3 // Group 3 Fax. - cG4 = 4 // Group 4 Fax. - cLZW = 5 - cJPEGOld = 6 // Superseded by cJPEG. - cJPEG = 7 - cDeflate = 8 // zlib compression. - cPackBits = 32773 - cDeflateOld = 32946 // Superseded by cDeflate. -) - -// Photometric interpretation values (see p. 37 of the spec). -const ( - pWhiteIsZero = 0 - pBlackIsZero = 1 - pRGB = 2 - pPaletted = 3 - pTransMask = 4 // transparency mask - pCMYK = 5 - pYCbCr = 6 - pCIELab = 8 -) - -// Values for the tPredictor tag (page 64-65 of the spec). -const ( - prNone = 1 - prHorizontal = 2 -) - -// Values for the tResolutionUnit tag (page 18). -const ( - resNone = 1 - resPerInch = 2 // Dots per inch. - resPerCM = 3 // Dots per centimeter. -) - -// imageMode represents the mode of the image. -type imageMode int - -const ( - mBilevel imageMode = iota - mPaletted - mGray - mGrayInvert - mRGB - mRGBA - mNRGBA -) - -// CompressionType describes the type of compression used in Options. -type CompressionType int - -const ( - Uncompressed CompressionType = iota - Deflate -) - -// specValue returns the compression type constant from the TIFF spec that -// is equivalent to c. -func (c CompressionType) specValue() uint32 { - switch c { - case Deflate: - return cDeflate - } - return cNone -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/lzw/reader.go b/Godeps/_workspace/src/golang.org/x/image/tiff/lzw/reader.go deleted file mode 100644 index dc9f7dd1d..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/lzw/reader.go +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package lzw implements the Lempel-Ziv-Welch compressed data format, -// described in T. A. Welch, ``A Technique for High-Performance Data -// Compression'', Computer, 17(6) (June 1984), pp 8-19. -// -// In particular, it implements LZW as used by the TIFF file format, including -// an "off by one" algorithmic difference when compared to standard LZW. -package lzw - -/* -This file was branched from src/pkg/compress/lzw/reader.go in the -standard library. Differences from the original are marked with "NOTE". - -The tif_lzw.c file in the libtiff C library has this comment: - ----- -The 5.0 spec describes a different algorithm than Aldus -implements. Specifically, Aldus does code length transitions -one code earlier than should be done (for real LZW). -Earlier versions of this library implemented the correct -LZW algorithm, but emitted codes in a bit order opposite -to the TIFF spec. Thus, to maintain compatibility w/ Aldus -we interpret MSB-LSB ordered codes to be images written w/ -old versions of this library, but otherwise adhere to the -Aldus "off by one" algorithm. ----- - -The Go code doesn't read (invalid) TIFF files written by old versions of -libtiff, but the LZW algorithm in this package still differs from the one in -Go's standard package library to accomodate this "off by one" in valid TIFFs. -*/ - -import ( - "bufio" - "errors" - "fmt" - "io" -) - -// Order specifies the bit ordering in an LZW data stream. -type Order int - -const ( - // LSB means Least Significant Bits first, as used in the GIF file format. - LSB Order = iota - // MSB means Most Significant Bits first, as used in the TIFF and PDF - // file formats. - MSB -) - -const ( - maxWidth = 12 - decoderInvalidCode = 0xffff - flushBuffer = 1 << maxWidth -) - -// decoder is the state from which the readXxx method converts a byte -// stream into a code stream. -type decoder struct { - r io.ByteReader - bits uint32 - nBits uint - width uint - read func(*decoder) (uint16, error) // readLSB or readMSB - litWidth int // width in bits of literal codes - err error - - // The first 1<= 1<>= d.width - d.nBits -= d.width - return code, nil -} - -// readMSB returns the next code for "Most Significant Bits first" data. -func (d *decoder) readMSB() (uint16, error) { - for d.nBits < d.width { - x, err := d.r.ReadByte() - if err != nil { - return 0, err - } - d.bits |= uint32(x) << (24 - d.nBits) - d.nBits += 8 - } - code := uint16(d.bits >> (32 - d.width)) - d.bits <<= d.width - d.nBits -= d.width - return code, nil -} - -func (d *decoder) Read(b []byte) (int, error) { - for { - if len(d.toRead) > 0 { - n := copy(b, d.toRead) - d.toRead = d.toRead[n:] - return n, nil - } - if d.err != nil { - return 0, d.err - } - d.decode() - } -} - -// decode decompresses bytes from r and leaves them in d.toRead. -// read specifies how to decode bytes into codes. -// litWidth is the width in bits of literal codes. -func (d *decoder) decode() { - // Loop over the code stream, converting codes into decompressed bytes. - for { - code, err := d.read(d) - if err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - d.err = err - d.flush() - return - } - switch { - case code < d.clear: - // We have a literal code. - d.output[d.o] = uint8(code) - d.o++ - if d.last != decoderInvalidCode { - // Save what the hi code expands to. - d.suffix[d.hi] = uint8(code) - d.prefix[d.hi] = d.last - } - case code == d.clear: - d.width = 1 + uint(d.litWidth) - d.hi = d.eof - d.overflow = 1 << d.width - d.last = decoderInvalidCode - continue - case code == d.eof: - d.flush() - d.err = io.EOF - return - case code <= d.hi: - c, i := code, len(d.output)-1 - if code == d.hi { - // code == hi is a special case which expands to the last expansion - // followed by the head of the last expansion. To find the head, we walk - // the prefix chain until we find a literal code. - c = d.last - for c >= d.clear { - c = d.prefix[c] - } - d.output[i] = uint8(c) - i-- - c = d.last - } - // Copy the suffix chain into output and then write that to w. - for c >= d.clear { - d.output[i] = d.suffix[c] - i-- - c = d.prefix[c] - } - d.output[i] = uint8(c) - d.o += copy(d.output[d.o:], d.output[i:]) - if d.last != decoderInvalidCode { - // Save what the hi code expands to. - d.suffix[d.hi] = uint8(c) - d.prefix[d.hi] = d.last - } - default: - d.err = errors.New("lzw: invalid code") - d.flush() - return - } - d.last, d.hi = code, d.hi+1 - if d.hi+1 >= d.overflow { // NOTE: the "+1" is where TIFF's LZW differs from the standard algorithm. - if d.width == maxWidth { - d.last = decoderInvalidCode - } else { - d.width++ - d.overflow <<= 1 - } - } - if d.o >= flushBuffer { - d.flush() - return - } - } -} - -func (d *decoder) flush() { - d.toRead = d.output[:d.o] - d.o = 0 -} - -var errClosed = errors.New("lzw: reader/writer is closed") - -func (d *decoder) Close() error { - d.err = errClosed // in case any Reads come along - return nil -} - -// NewReader creates a new io.ReadCloser. -// Reads from the returned io.ReadCloser read and decompress data from r. -// If r does not also implement io.ByteReader, -// the decompressor may read more data than necessary from r. -// It is the caller's responsibility to call Close on the ReadCloser when -// finished reading. -// The number of bits to use for literal codes, litWidth, must be in the -// range [2,8] and is typically 8. It must equal the litWidth -// used during compression. -func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser { - d := new(decoder) - switch order { - case LSB: - d.read = (*decoder).readLSB - case MSB: - d.read = (*decoder).readMSB - default: - d.err = errors.New("lzw: unknown order") - return d - } - if litWidth < 2 || 8 < litWidth { - d.err = fmt.Errorf("lzw: litWidth %d out of range", litWidth) - return d - } - if br, ok := r.(io.ByteReader); ok { - d.r = br - } else { - d.r = bufio.NewReader(r) - } - d.litWidth = litWidth - d.width = 1 + uint(litWidth) - d.clear = uint16(1) << uint(litWidth) - d.eof, d.hi = d.clear+1, d.clear+1 - d.overflow = uint16(1) << d.width - d.last = decoderInvalidCode - - return d -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/reader.go b/Godeps/_workspace/src/golang.org/x/image/tiff/reader.go deleted file mode 100644 index 714e3dda7..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/reader.go +++ /dev/null @@ -1,681 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package tiff implements a TIFF image decoder and encoder. -// -// The TIFF specification is at http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf -package tiff - -import ( - "compress/zlib" - "encoding/binary" - "fmt" - "image" - "image/color" - "io" - "io/ioutil" - "math" - - "golang.org/x/image/tiff/lzw" -) - -// A FormatError reports that the input is not a valid TIFF image. -type FormatError string - -func (e FormatError) Error() string { - return "tiff: invalid format: " + string(e) -} - -// An UnsupportedError reports that the input uses a valid but -// unimplemented feature. -type UnsupportedError string - -func (e UnsupportedError) Error() string { - return "tiff: unsupported feature: " + string(e) -} - -// An InternalError reports that an internal error was encountered. -type InternalError string - -func (e InternalError) Error() string { - return "tiff: internal error: " + string(e) -} - -var errNoPixels = FormatError("not enough pixel data") - -type decoder struct { - r io.ReaderAt - byteOrder binary.ByteOrder - config image.Config - mode imageMode - bpp uint - features map[int][]uint - palette []color.Color - - buf []byte - off int // Current offset in buf. - v uint32 // Buffer value for reading with arbitrary bit depths. - nbits uint // Remaining number of bits in v. -} - -// firstVal returns the first uint of the features entry with the given tag, -// or 0 if the tag does not exist. -func (d *decoder) firstVal(tag int) uint { - f := d.features[tag] - if len(f) == 0 { - return 0 - } - return f[0] -} - -// ifdUint decodes the IFD entry in p, which must be of the Byte, Short -// or Long type, and returns the decoded uint values. -func (d *decoder) ifdUint(p []byte) (u []uint, err error) { - var raw []byte - if len(p) < ifdLen { - return nil, FormatError("bad IFD entry") - } - - datatype := d.byteOrder.Uint16(p[2:4]) - if dt := int(datatype); dt <= 0 || dt >= len(lengths) { - return nil, UnsupportedError("IFD entry datatype") - } - - count := d.byteOrder.Uint32(p[4:8]) - if count > math.MaxInt32/lengths[datatype] { - return nil, FormatError("IFD data too large") - } - if datalen := lengths[datatype] * count; datalen > 4 { - // The IFD contains a pointer to the real value. - raw = make([]byte, datalen) - _, err = d.r.ReadAt(raw, int64(d.byteOrder.Uint32(p[8:12]))) - } else { - raw = p[8 : 8+datalen] - } - if err != nil { - return nil, err - } - - u = make([]uint, count) - switch datatype { - case dtByte: - for i := uint32(0); i < count; i++ { - u[i] = uint(raw[i]) - } - case dtShort: - for i := uint32(0); i < count; i++ { - u[i] = uint(d.byteOrder.Uint16(raw[2*i : 2*(i+1)])) - } - case dtLong: - for i := uint32(0); i < count; i++ { - u[i] = uint(d.byteOrder.Uint32(raw[4*i : 4*(i+1)])) - } - default: - return nil, UnsupportedError("data type") - } - return u, nil -} - -// parseIFD decides whether the the IFD entry in p is "interesting" and -// stows away the data in the decoder. -func (d *decoder) parseIFD(p []byte) error { - tag := d.byteOrder.Uint16(p[0:2]) - switch tag { - case tBitsPerSample, - tExtraSamples, - tPhotometricInterpretation, - tCompression, - tPredictor, - tStripOffsets, - tStripByteCounts, - tRowsPerStrip, - tTileWidth, - tTileLength, - tTileOffsets, - tTileByteCounts, - tImageLength, - tImageWidth: - val, err := d.ifdUint(p) - if err != nil { - return err - } - d.features[int(tag)] = val - case tColorMap: - val, err := d.ifdUint(p) - if err != nil { - return err - } - numcolors := len(val) / 3 - if len(val)%3 != 0 || numcolors <= 0 || numcolors > 256 { - return FormatError("bad ColorMap length") - } - d.palette = make([]color.Color, numcolors) - for i := 0; i < numcolors; i++ { - d.palette[i] = color.RGBA64{ - uint16(val[i]), - uint16(val[i+numcolors]), - uint16(val[i+2*numcolors]), - 0xffff, - } - } - case tSampleFormat: - // Page 27 of the spec: If the SampleFormat is present and - // the value is not 1 [= unsigned integer data], a Baseline - // TIFF reader that cannot handle the SampleFormat value - // must terminate the import process gracefully. - val, err := d.ifdUint(p) - if err != nil { - return err - } - for _, v := range val { - if v != 1 { - return UnsupportedError("sample format") - } - } - } - return nil -} - -// readBits reads n bits from the internal buffer starting at the current offset. -func (d *decoder) readBits(n uint) (v uint32, ok bool) { - for d.nbits < n { - d.v <<= 8 - if d.off >= len(d.buf) { - return 0, false - } - d.v |= uint32(d.buf[d.off]) - d.off++ - d.nbits += 8 - } - d.nbits -= n - rv := d.v >> d.nbits - d.v &^= rv << d.nbits - return rv, true -} - -// flushBits discards the unread bits in the buffer used by readBits. -// It is used at the end of a line. -func (d *decoder) flushBits() { - d.v = 0 - d.nbits = 0 -} - -// minInt returns the smaller of x or y. -func minInt(a, b int) int { - if a <= b { - return a - } - return b -} - -// decode decodes the raw data of an image. -// It reads from d.buf and writes the strip or tile into dst. -func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error { - d.off = 0 - - // Apply horizontal predictor if necessary. - // In this case, p contains the color difference to the preceding pixel. - // See page 64-65 of the spec. - if d.firstVal(tPredictor) == prHorizontal { - switch d.bpp { - case 16: - var off int - n := 2 * len(d.features[tBitsPerSample]) // bytes per sample times samples per pixel - for y := ymin; y < ymax; y++ { - off += n - for x := 0; x < (xmax-xmin-1)*n; x += 2 { - if off+2 > len(d.buf) { - return errNoPixels - } - v0 := d.byteOrder.Uint16(d.buf[off-n : off-n+2]) - v1 := d.byteOrder.Uint16(d.buf[off : off+2]) - d.byteOrder.PutUint16(d.buf[off:off+2], v1+v0) - off += 2 - } - } - case 8: - var off int - n := 1 * len(d.features[tBitsPerSample]) // bytes per sample times samples per pixel - for y := ymin; y < ymax; y++ { - off += n - for x := 0; x < (xmax-xmin-1)*n; x++ { - if off >= len(d.buf) { - return errNoPixels - } - d.buf[off] += d.buf[off-n] - off++ - } - } - case 1: - return UnsupportedError("horizontal predictor with 1 BitsPerSample") - } - } - - rMaxX := minInt(xmax, dst.Bounds().Max.X) - rMaxY := minInt(ymax, dst.Bounds().Max.Y) - switch d.mode { - case mGray, mGrayInvert: - if d.bpp == 16 { - img := dst.(*image.Gray16) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - if d.off+2 > len(d.buf) { - return errNoPixels - } - v := d.byteOrder.Uint16(d.buf[d.off : d.off+2]) - d.off += 2 - if d.mode == mGrayInvert { - v = 0xffff - v - } - img.SetGray16(x, y, color.Gray16{v}) - } - } - } else { - img := dst.(*image.Gray) - max := uint32((1 << d.bpp) - 1) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - v, ok := d.readBits(d.bpp) - if !ok { - return errNoPixels - } - v = v * 0xff / max - if d.mode == mGrayInvert { - v = 0xff - v - } - img.SetGray(x, y, color.Gray{uint8(v)}) - } - d.flushBits() - } - } - case mPaletted: - img := dst.(*image.Paletted) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - v, ok := d.readBits(d.bpp) - if !ok { - return errNoPixels - } - img.SetColorIndex(x, y, uint8(v)) - } - d.flushBits() - } - case mRGB: - if d.bpp == 16 { - img := dst.(*image.RGBA64) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - if d.off+6 > len(d.buf) { - return errNoPixels - } - r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) - g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) - b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) - d.off += 6 - img.SetRGBA64(x, y, color.RGBA64{r, g, b, 0xffff}) - } - } - } else { - img := dst.(*image.RGBA) - for y := ymin; y < rMaxY; y++ { - min := img.PixOffset(xmin, y) - max := img.PixOffset(rMaxX, y) - off := (y - ymin) * (xmax - xmin) * 3 - for i := min; i < max; i += 4 { - if off+3 > len(d.buf) { - return errNoPixels - } - img.Pix[i+0] = d.buf[off+0] - img.Pix[i+1] = d.buf[off+1] - img.Pix[i+2] = d.buf[off+2] - img.Pix[i+3] = 0xff - off += 3 - } - } - } - case mNRGBA: - if d.bpp == 16 { - img := dst.(*image.NRGBA64) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - if d.off+8 > len(d.buf) { - return errNoPixels - } - r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) - g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) - b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) - a := d.byteOrder.Uint16(d.buf[d.off+6 : d.off+8]) - d.off += 8 - img.SetNRGBA64(x, y, color.NRGBA64{r, g, b, a}) - } - } - } else { - img := dst.(*image.NRGBA) - for y := ymin; y < rMaxY; y++ { - min := img.PixOffset(xmin, y) - max := img.PixOffset(rMaxX, y) - i0, i1 := (y-ymin)*(xmax-xmin)*4, (y-ymin+1)*(xmax-xmin)*4 - if i1 > len(d.buf) { - return errNoPixels - } - copy(img.Pix[min:max], d.buf[i0:i1]) - } - } - case mRGBA: - if d.bpp == 16 { - img := dst.(*image.RGBA64) - for y := ymin; y < rMaxY; y++ { - for x := xmin; x < rMaxX; x++ { - if d.off+8 > len(d.buf) { - return errNoPixels - } - r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) - g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) - b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) - a := d.byteOrder.Uint16(d.buf[d.off+6 : d.off+8]) - d.off += 8 - img.SetRGBA64(x, y, color.RGBA64{r, g, b, a}) - } - } - } else { - img := dst.(*image.RGBA) - for y := ymin; y < rMaxY; y++ { - min := img.PixOffset(xmin, y) - max := img.PixOffset(rMaxX, y) - i0, i1 := (y-ymin)*(xmax-xmin)*4, (y-ymin+1)*(xmax-xmin)*4 - if i1 > len(d.buf) { - return errNoPixels - } - copy(img.Pix[min:max], d.buf[i0:i1]) - } - } - } - - return nil -} - -func newDecoder(r io.Reader) (*decoder, error) { - d := &decoder{ - r: newReaderAt(r), - features: make(map[int][]uint), - } - - p := make([]byte, 8) - if _, err := d.r.ReadAt(p, 0); err != nil { - return nil, err - } - switch string(p[0:4]) { - case leHeader: - d.byteOrder = binary.LittleEndian - case beHeader: - d.byteOrder = binary.BigEndian - default: - return nil, FormatError("malformed header") - } - - ifdOffset := int64(d.byteOrder.Uint32(p[4:8])) - - // The first two bytes contain the number of entries (12 bytes each). - if _, err := d.r.ReadAt(p[0:2], ifdOffset); err != nil { - return nil, err - } - numItems := int(d.byteOrder.Uint16(p[0:2])) - - // All IFD entries are read in one chunk. - p = make([]byte, ifdLen*numItems) - if _, err := d.r.ReadAt(p, ifdOffset+2); err != nil { - return nil, err - } - - for i := 0; i < len(p); i += ifdLen { - if err := d.parseIFD(p[i : i+ifdLen]); err != nil { - return nil, err - } - } - - d.config.Width = int(d.firstVal(tImageWidth)) - d.config.Height = int(d.firstVal(tImageLength)) - - if _, ok := d.features[tBitsPerSample]; !ok { - return nil, FormatError("BitsPerSample tag missing") - } - d.bpp = d.firstVal(tBitsPerSample) - switch d.bpp { - case 0: - return nil, FormatError("BitsPerSample must not be 0") - case 1, 8, 16: - // Nothing to do, these are accepted by this implementation. - default: - return nil, UnsupportedError(fmt.Sprintf("BitsPerSample of %v", d.bpp)) - } - - // Determine the image mode. - switch d.firstVal(tPhotometricInterpretation) { - case pRGB: - if d.bpp == 16 { - for _, b := range d.features[tBitsPerSample] { - if b != 16 { - return nil, FormatError("wrong number of samples for 16bit RGB") - } - } - } else { - for _, b := range d.features[tBitsPerSample] { - if b != 8 { - return nil, FormatError("wrong number of samples for 8bit RGB") - } - } - } - // RGB images normally have 3 samples per pixel. - // If there are more, ExtraSamples (p. 31-32 of the spec) - // gives their meaning (usually an alpha channel). - // - // This implementation does not support extra samples - // of an unspecified type. - switch len(d.features[tBitsPerSample]) { - case 3: - d.mode = mRGB - if d.bpp == 16 { - d.config.ColorModel = color.RGBA64Model - } else { - d.config.ColorModel = color.RGBAModel - } - case 4: - switch d.firstVal(tExtraSamples) { - case 1: - d.mode = mRGBA - if d.bpp == 16 { - d.config.ColorModel = color.RGBA64Model - } else { - d.config.ColorModel = color.RGBAModel - } - case 2: - d.mode = mNRGBA - if d.bpp == 16 { - d.config.ColorModel = color.NRGBA64Model - } else { - d.config.ColorModel = color.NRGBAModel - } - default: - return nil, FormatError("wrong number of samples for RGB") - } - default: - return nil, FormatError("wrong number of samples for RGB") - } - case pPaletted: - d.mode = mPaletted - d.config.ColorModel = color.Palette(d.palette) - case pWhiteIsZero: - d.mode = mGrayInvert - if d.bpp == 16 { - d.config.ColorModel = color.Gray16Model - } else { - d.config.ColorModel = color.GrayModel - } - case pBlackIsZero: - d.mode = mGray - if d.bpp == 16 { - d.config.ColorModel = color.Gray16Model - } else { - d.config.ColorModel = color.GrayModel - } - default: - return nil, UnsupportedError("color model") - } - - return d, nil -} - -// DecodeConfig returns the color model and dimensions of a TIFF image without -// decoding the entire image. -func DecodeConfig(r io.Reader) (image.Config, error) { - d, err := newDecoder(r) - if err != nil { - return image.Config{}, err - } - return d.config, nil -} - -// Decode reads a TIFF image from r and returns it as an image.Image. -// The type of Image returned depends on the contents of the TIFF. -func Decode(r io.Reader) (img image.Image, err error) { - d, err := newDecoder(r) - if err != nil { - return - } - - blockPadding := false - blockWidth := d.config.Width - blockHeight := d.config.Height - blocksAcross := 1 - blocksDown := 1 - - if d.config.Width == 0 { - blocksAcross = 0 - } - if d.config.Height == 0 { - blocksDown = 0 - } - - var blockOffsets, blockCounts []uint - - if int(d.firstVal(tTileWidth)) != 0 { - blockPadding = true - - blockWidth = int(d.firstVal(tTileWidth)) - blockHeight = int(d.firstVal(tTileLength)) - - if blockWidth != 0 { - blocksAcross = (d.config.Width + blockWidth - 1) / blockWidth - } - if blockHeight != 0 { - blocksDown = (d.config.Height + blockHeight - 1) / blockHeight - } - - blockCounts = d.features[tTileByteCounts] - blockOffsets = d.features[tTileOffsets] - - } else { - if int(d.firstVal(tRowsPerStrip)) != 0 { - blockHeight = int(d.firstVal(tRowsPerStrip)) - } - - if blockHeight != 0 { - blocksDown = (d.config.Height + blockHeight - 1) / blockHeight - } - - blockOffsets = d.features[tStripOffsets] - blockCounts = d.features[tStripByteCounts] - } - - // Check if we have the right number of strips/tiles, offsets and counts. - if n := blocksAcross * blocksDown; len(blockOffsets) < n || len(blockCounts) < n { - return nil, FormatError("inconsistent header") - } - - imgRect := image.Rect(0, 0, d.config.Width, d.config.Height) - switch d.mode { - case mGray, mGrayInvert: - if d.bpp == 16 { - img = image.NewGray16(imgRect) - } else { - img = image.NewGray(imgRect) - } - case mPaletted: - img = image.NewPaletted(imgRect, d.palette) - case mNRGBA: - if d.bpp == 16 { - img = image.NewNRGBA64(imgRect) - } else { - img = image.NewNRGBA(imgRect) - } - case mRGB, mRGBA: - if d.bpp == 16 { - img = image.NewRGBA64(imgRect) - } else { - img = image.NewRGBA(imgRect) - } - } - - for i := 0; i < blocksAcross; i++ { - blkW := blockWidth - if !blockPadding && i == blocksAcross-1 && d.config.Width%blockWidth != 0 { - blkW = d.config.Width % blockWidth - } - for j := 0; j < blocksDown; j++ { - blkH := blockHeight - if !blockPadding && j == blocksDown-1 && d.config.Height%blockHeight != 0 { - blkH = d.config.Height % blockHeight - } - offset := int64(blockOffsets[j*blocksAcross+i]) - n := int64(blockCounts[j*blocksAcross+i]) - switch d.firstVal(tCompression) { - - // According to the spec, Compression does not have a default value, - // but some tools interpret a missing Compression value as none so we do - // the same. - case cNone, 0: - if b, ok := d.r.(*buffer); ok { - d.buf, err = b.Slice(int(offset), int(n)) - } else { - d.buf = make([]byte, n) - _, err = d.r.ReadAt(d.buf, offset) - } - case cLZW: - r := lzw.NewReader(io.NewSectionReader(d.r, offset, n), lzw.MSB, 8) - d.buf, err = ioutil.ReadAll(r) - r.Close() - case cDeflate, cDeflateOld: - var r io.ReadCloser - r, err = zlib.NewReader(io.NewSectionReader(d.r, offset, n)) - if err != nil { - return nil, err - } - d.buf, err = ioutil.ReadAll(r) - r.Close() - case cPackBits: - d.buf, err = unpackBits(io.NewSectionReader(d.r, offset, n)) - default: - err = UnsupportedError(fmt.Sprintf("compression value %d", d.firstVal(tCompression))) - } - if err != nil { - return nil, err - } - - xmin := i * blockWidth - ymin := j * blockHeight - xmax := xmin + blkW - ymax := ymin + blkH - err = d.decode(img, xmin, ymin, xmax, ymax) - if err != nil { - return nil, err - } - } - } - return -} - -func init() { - image.RegisterFormat("tiff", leHeader, Decode, DecodeConfig) - image.RegisterFormat("tiff", beHeader, Decode, DecodeConfig) -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/writer.go b/Godeps/_workspace/src/golang.org/x/image/tiff/writer.go deleted file mode 100644 index c8a01cea7..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/writer.go +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import ( - "bytes" - "compress/zlib" - "encoding/binary" - "image" - "io" - "sort" -) - -// The TIFF format allows to choose the order of the different elements freely. -// The basic structure of a TIFF file written by this package is: -// -// 1. Header (8 bytes). -// 2. Image data. -// 3. Image File Directory (IFD). -// 4. "Pointer area" for larger entries in the IFD. - -// We only write little-endian TIFF files. -var enc = binary.LittleEndian - -// An ifdEntry is a single entry in an Image File Directory. -// A value of type dtRational is composed of two 32-bit values, -// thus data contains two uints (numerator and denominator) for a single number. -type ifdEntry struct { - tag int - datatype int - data []uint32 -} - -func (e ifdEntry) putData(p []byte) { - for _, d := range e.data { - switch e.datatype { - case dtByte, dtASCII: - p[0] = byte(d) - p = p[1:] - case dtShort: - enc.PutUint16(p, uint16(d)) - p = p[2:] - case dtLong, dtRational: - enc.PutUint32(p, uint32(d)) - p = p[4:] - } - } -} - -type byTag []ifdEntry - -func (d byTag) Len() int { return len(d) } -func (d byTag) Less(i, j int) bool { return d[i].tag < d[j].tag } -func (d byTag) Swap(i, j int) { d[i], d[j] = d[j], d[i] } - -func encodeGray(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { - if !predictor { - return writePix(w, pix, dy, dx, stride) - } - buf := make([]byte, dx) - for y := 0; y < dy; y++ { - min := y*stride + 0 - max := y*stride + dx - off := 0 - var v0 uint8 - for i := min; i < max; i++ { - v1 := pix[i] - buf[off] = v1 - v0 - v0 = v1 - off++ - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -func encodeGray16(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { - buf := make([]byte, dx*2) - for y := 0; y < dy; y++ { - min := y*stride + 0 - max := y*stride + dx*2 - off := 0 - var v0 uint16 - for i := min; i < max; i += 2 { - // An image.Gray16's Pix is in big-endian order. - v1 := uint16(pix[i])<<8 | uint16(pix[i+1]) - if predictor { - v0, v1 = v1, v1-v0 - } - // We only write little-endian TIFF files. - buf[off+0] = byte(v1) - buf[off+1] = byte(v1 >> 8) - off += 2 - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -func encodeRGBA(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { - if !predictor { - return writePix(w, pix, dy, dx*4, stride) - } - buf := make([]byte, dx*4) - for y := 0; y < dy; y++ { - min := y*stride + 0 - max := y*stride + dx*4 - off := 0 - var r0, g0, b0, a0 uint8 - for i := min; i < max; i += 4 { - r1, g1, b1, a1 := pix[i+0], pix[i+1], pix[i+2], pix[i+3] - buf[off+0] = r1 - r0 - buf[off+1] = g1 - g0 - buf[off+2] = b1 - b0 - buf[off+3] = a1 - a0 - off += 4 - r0, g0, b0, a0 = r1, g1, b1, a1 - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -func encodeRGBA64(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { - buf := make([]byte, dx*8) - for y := 0; y < dy; y++ { - min := y*stride + 0 - max := y*stride + dx*8 - off := 0 - var r0, g0, b0, a0 uint16 - for i := min; i < max; i += 8 { - // An image.RGBA64's Pix is in big-endian order. - r1 := uint16(pix[i+0])<<8 | uint16(pix[i+1]) - g1 := uint16(pix[i+2])<<8 | uint16(pix[i+3]) - b1 := uint16(pix[i+4])<<8 | uint16(pix[i+5]) - a1 := uint16(pix[i+6])<<8 | uint16(pix[i+7]) - if predictor { - r0, r1 = r1, r1-r0 - g0, g1 = g1, g1-g0 - b0, b1 = b1, b1-b0 - a0, a1 = a1, a1-a0 - } - // We only write little-endian TIFF files. - buf[off+0] = byte(r1) - buf[off+1] = byte(r1 >> 8) - buf[off+2] = byte(g1) - buf[off+3] = byte(g1 >> 8) - buf[off+4] = byte(b1) - buf[off+5] = byte(b1 >> 8) - buf[off+6] = byte(a1) - buf[off+7] = byte(a1 >> 8) - off += 8 - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -func encode(w io.Writer, m image.Image, predictor bool) error { - bounds := m.Bounds() - buf := make([]byte, 4*bounds.Dx()) - for y := bounds.Min.Y; y < bounds.Max.Y; y++ { - off := 0 - if predictor { - var r0, g0, b0, a0 uint8 - for x := bounds.Min.X; x < bounds.Max.X; x++ { - r, g, b, a := m.At(x, y).RGBA() - r1 := uint8(r >> 8) - g1 := uint8(g >> 8) - b1 := uint8(b >> 8) - a1 := uint8(a >> 8) - buf[off+0] = r1 - r0 - buf[off+1] = g1 - g0 - buf[off+2] = b1 - b0 - buf[off+3] = a1 - a0 - off += 4 - r0, g0, b0, a0 = r1, g1, b1, a1 - } - } else { - for x := bounds.Min.X; x < bounds.Max.X; x++ { - r, g, b, a := m.At(x, y).RGBA() - buf[off+0] = uint8(r >> 8) - buf[off+1] = uint8(g >> 8) - buf[off+2] = uint8(b >> 8) - buf[off+3] = uint8(a >> 8) - off += 4 - } - } - if _, err := w.Write(buf); err != nil { - return err - } - } - return nil -} - -// writePix writes the internal byte array of an image to w. It is less general -// but much faster then encode. writePix is used when pix directly -// corresponds to one of the TIFF image types. -func writePix(w io.Writer, pix []byte, nrows, length, stride int) error { - if length == stride { - _, err := w.Write(pix[:nrows*length]) - return err - } - for ; nrows > 0; nrows-- { - if _, err := w.Write(pix[:length]); err != nil { - return err - } - pix = pix[stride:] - } - return nil -} - -func writeIFD(w io.Writer, ifdOffset int, d []ifdEntry) error { - var buf [ifdLen]byte - // Make space for "pointer area" containing IFD entry data - // longer than 4 bytes. - parea := make([]byte, 1024) - pstart := ifdOffset + ifdLen*len(d) + 6 - var o int // Current offset in parea. - - // The IFD has to be written with the tags in ascending order. - sort.Sort(byTag(d)) - - // Write the number of entries in this IFD. - if err := binary.Write(w, enc, uint16(len(d))); err != nil { - return err - } - for _, ent := range d { - enc.PutUint16(buf[0:2], uint16(ent.tag)) - enc.PutUint16(buf[2:4], uint16(ent.datatype)) - count := uint32(len(ent.data)) - if ent.datatype == dtRational { - count /= 2 - } - enc.PutUint32(buf[4:8], count) - datalen := int(count * lengths[ent.datatype]) - if datalen <= 4 { - ent.putData(buf[8:12]) - } else { - if (o + datalen) > len(parea) { - newlen := len(parea) + 1024 - for (o + datalen) > newlen { - newlen += 1024 - } - newarea := make([]byte, newlen) - copy(newarea, parea) - parea = newarea - } - ent.putData(parea[o : o+datalen]) - enc.PutUint32(buf[8:12], uint32(pstart+o)) - o += datalen - } - if _, err := w.Write(buf[:]); err != nil { - return err - } - } - // The IFD ends with the offset of the next IFD in the file, - // or zero if it is the last one (page 14). - if err := binary.Write(w, enc, uint32(0)); err != nil { - return err - } - _, err := w.Write(parea[:o]) - return err -} - -// Options are the encoding parameters. -type Options struct { - // Compression is the type of compression used. - Compression CompressionType - // Predictor determines whether a differencing predictor is used; - // if true, instead of each pixel's color, the color difference to the - // preceding one is saved. This improves the compression for certain - // types of images and compressors. For example, it works well for - // photos with Deflate compression. - Predictor bool -} - -// Encode writes the image m to w. opt determines the options used for -// encoding, such as the compression type. If opt is nil, an uncompressed -// image is written. -func Encode(w io.Writer, m image.Image, opt *Options) error { - d := m.Bounds().Size() - - compression := uint32(cNone) - predictor := false - if opt != nil { - compression = opt.Compression.specValue() - // The predictor field is only used with LZW. See page 64 of the spec. - predictor = opt.Predictor && compression == cLZW - } - - _, err := io.WriteString(w, leHeader) - if err != nil { - return err - } - - // Compressed data is written into a buffer first, so that we - // know the compressed size. - var buf bytes.Buffer - // dst holds the destination for the pixel data of the image -- - // either w or a writer to buf. - var dst io.Writer - // imageLen is the length of the pixel data in bytes. - // The offset of the IFD is imageLen + 8 header bytes. - var imageLen int - - switch compression { - case cNone: - dst = w - // Write IFD offset before outputting pixel data. - switch m.(type) { - case *image.Paletted: - imageLen = d.X * d.Y * 1 - case *image.Gray: - imageLen = d.X * d.Y * 1 - case *image.Gray16: - imageLen = d.X * d.Y * 2 - case *image.RGBA64: - imageLen = d.X * d.Y * 8 - case *image.NRGBA64: - imageLen = d.X * d.Y * 8 - default: - imageLen = d.X * d.Y * 4 - } - err = binary.Write(w, enc, uint32(imageLen+8)) - if err != nil { - return err - } - case cDeflate: - dst = zlib.NewWriter(&buf) - } - - pr := uint32(prNone) - photometricInterpretation := uint32(pRGB) - samplesPerPixel := uint32(4) - bitsPerSample := []uint32{8, 8, 8, 8} - extraSamples := uint32(0) - colorMap := []uint32{} - - if predictor { - pr = prHorizontal - } - switch m := m.(type) { - case *image.Paletted: - photometricInterpretation = pPaletted - samplesPerPixel = 1 - bitsPerSample = []uint32{8} - colorMap = make([]uint32, 256*3) - for i := 0; i < 256 && i < len(m.Palette); i++ { - r, g, b, _ := m.Palette[i].RGBA() - colorMap[i+0*256] = uint32(r) - colorMap[i+1*256] = uint32(g) - colorMap[i+2*256] = uint32(b) - } - err = encodeGray(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.Gray: - photometricInterpretation = pBlackIsZero - samplesPerPixel = 1 - bitsPerSample = []uint32{8} - err = encodeGray(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.Gray16: - photometricInterpretation = pBlackIsZero - samplesPerPixel = 1 - bitsPerSample = []uint32{16} - err = encodeGray16(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.NRGBA: - extraSamples = 2 // Unassociated alpha. - err = encodeRGBA(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.NRGBA64: - extraSamples = 2 // Unassociated alpha. - bitsPerSample = []uint32{16, 16, 16, 16} - err = encodeRGBA64(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.RGBA: - extraSamples = 1 // Associated alpha. - err = encodeRGBA(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - case *image.RGBA64: - extraSamples = 1 // Associated alpha. - bitsPerSample = []uint32{16, 16, 16, 16} - err = encodeRGBA64(dst, m.Pix, d.X, d.Y, m.Stride, predictor) - default: - extraSamples = 1 // Associated alpha. - err = encode(dst, m, predictor) - } - if err != nil { - return err - } - - if compression != cNone { - if err = dst.(io.Closer).Close(); err != nil { - return err - } - imageLen = buf.Len() - if err = binary.Write(w, enc, uint32(imageLen+8)); err != nil { - return err - } - if _, err = buf.WriteTo(w); err != nil { - return err - } - } - - ifd := []ifdEntry{ - {tImageWidth, dtShort, []uint32{uint32(d.X)}}, - {tImageLength, dtShort, []uint32{uint32(d.Y)}}, - {tBitsPerSample, dtShort, bitsPerSample}, - {tCompression, dtShort, []uint32{compression}}, - {tPhotometricInterpretation, dtShort, []uint32{photometricInterpretation}}, - {tStripOffsets, dtLong, []uint32{8}}, - {tSamplesPerPixel, dtShort, []uint32{samplesPerPixel}}, - {tRowsPerStrip, dtShort, []uint32{uint32(d.Y)}}, - {tStripByteCounts, dtLong, []uint32{uint32(imageLen)}}, - // There is currently no support for storing the image - // resolution, so give a bogus value of 72x72 dpi. - {tXResolution, dtRational, []uint32{72, 1}}, - {tYResolution, dtRational, []uint32{72, 1}}, - {tResolutionUnit, dtShort, []uint32{resPerInch}}, - } - if pr != prNone { - ifd = append(ifd, ifdEntry{tPredictor, dtShort, []uint32{pr}}) - } - if len(colorMap) != 0 { - ifd = append(ifd, ifdEntry{tColorMap, dtShort, colorMap}) - } - if extraSamples > 0 { - ifd = append(ifd, ifdEntry{tExtraSamples, dtShort, []uint32{extraSamples}}) - } - - return writeIFD(w, imageLen+8, ifd) -} -- cgit v1.2.3-1-g7c22