Граф коммитов

298 Коммитов

Автор SHA1 Сообщение Дата
Nigel Tao 6ea1694466 ccitt: factor out a highBits function
Change-Id: I27775c06a0bb95617e0a809e5902461aea0cafde
Reviewed-on: https://go-review.googlesource.com/c/image/+/191939
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-29 09:36:49 +00:00
Horst Rutter 23ea20f87c ccitt: fix byte align and invert flag
Change-Id: I49955017deb8243b19dc1bb222ff8622ac3ff6af
Reviewed-on: https://go-review.googlesource.com/c/image/+/190677
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-08-28 09:01:00 +00:00
Nigel Tao 3a9bac650e tiff/lzw: don't follow code == hi if last is invalid
This does for x/image what
https://go-review.googlesource.com/c/go/+/45111/ did for the standard
library's compress/lzw.

The x variant is a fork of the stdlib, with an extra, explicit tweak
because the TIFF format is "off by one" - a mistake (not Go specific)
somebody introduced decades ago and that we can never fix, given all the
existing TIFF files out there in the wild.

When previously patching the stdlib variant, I was supposed to also
patch the x variant, but forgot.

Updates golang/go#11386

Change-Id: Ic74f9014d2d048ee12cdd151332db62b76f1cde2
Reviewed-on: https://go-review.googlesource.com/c/image/+/191221
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-08-23 06:40:33 +00:00
Nigel Tao cff245a650 image/vector: simplify haveAccumulateSIMD fields
Change-Id: I66c1adbee1728ef69ae94eac62285a76deaa8f04
Reviewed-on: https://go-review.googlesource.com/c/image/+/184899
Reviewed-by: David Symonds <dsymonds@golang.org>
2019-08-02 00:28:40 +00:00
Horst Rutter 1bd0cf5764 ccitt: implement bitWriter
Change-Id: I4002e054ef8a167d5b254bd02bdbeb7932d47efc
Reviewed-on: https://go-review.googlesource.com/c/image/+/184958
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-07-29 22:57:35 +00:00
Nigel Tao d6a02ce849 image/vector: add runtime check for SSE4.1
The PSHUFB instruction is also used by the floating-point
implementation, not just the fixed-point one.

Fixes golang/go#32835

Change-Id: I21f204319b28b664c862a7e3d938ba9366c74116
Reviewed-on: https://go-review.googlesource.com/c/image/+/184898
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-03 14:17:33 +00:00
Horst Rutter 7e034cad64 tiff: Add support for CCITT group 3/4 compression
The algorithm is described at https://www.itu.int/rec/T-REC-T.6/en

Fixes golang/go#19443

Change-Id: Ib8a078ab43c78d1f58d2ac849ed455b05dc209e9
Reviewed-on: https://go-review.googlesource.com/c/image/+/174139
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-22 00:34:08 +00:00
Nigel Tao 92942e4437 ccitt: implement NewReader and DecodeIntoGray
The testdata/bw-gopher.png image was derived from
testdata/bw-uncompressed.tiff

The testdata/*ccitt* data was generated from a custom CCITT encoder:
https://go-review.googlesource.com/c/image/+/174139/10/ccitt/writer.go

Updates golang/go#19443

Change-Id: I53b7acd807aa9a627517ede5bc3316d6f1fe4724
Reviewed-on: https://go-review.googlesource.com/c/image/+/182219
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-06-18 12:48:11 +00:00
Nigel Tao 33659d3de4 go.mod: add go language version
The go tool kept inserting "go 1.13" so I'm adding an explicit line so
it stops modifying my local files when I'm working on other changes.

Change-Id: Ib430e058d2551d8e3746f32bf8ffbdb2fb74c330
Reviewed-on: https://go-review.googlesource.com/c/image/+/182220
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-06-16 09:40:56 +00:00
Nigel Tao f03afa92d3 ccitt: rename fooTable vars to fooDecodeTable
Upcoming commits will also implement an encoder, not just a decoder, and
they might want to generate fooEncodeTable vars.

Change-Id: Ib02548a912a7354f00dace580151fbcfc405be8f
Reviewed-on: https://go-review.googlesource.com/c/image/+/178417
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-23 03:58:34 +00:00
Nigel Tao 61b8692d9a ccitt: don't advance bitReader after invalid code
Change-Id: I721f86aba22a6506b5b7ac162977cd31dc371b0a
Reviewed-on: https://go-review.googlesource.com/c/image/+/177297
Reviewed-by: Horst Rutter <hhrutter@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-05-16 05:27:01 +00:00
Nigel Tao e4e5bf290f ccitt: new package for CCITT images
This initial commit only provides a decoder that generates modes and run
lengths from a bit stream. Future commits will add more features.

Updates golang/go#19443

Change-Id: I7bba1226a69a83e636e407e4d72ffd5630562e6b
Reviewed-on: https://go-review.googlesource.com/c/image/+/174979
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-07 09:27:27 +00:00
Benny Siegert 6d32002ffd tiff: mark test and benchmark helpers
Mark helper functions for tiff tests with t.Helper and b.Helper
respectively.

Change-Id: I3242d5a9b319bcf8de17e34c731bcd1910acfb2b
Reviewed-on: https://go-review.googlesource.com/c/image/+/174140
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-05-01 04:58:29 +00:00
Nigel Tao 59b11bec70 vector: clarify GOARCH=wasm test code
Change-Id: If190b889e4a6db44416615bbda487a677e8e9044
Reviewed-on: https://go-review.googlesource.com/c/image/+/172517
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-24 15:59:47 +00:00
Richard Musiol 4e30a6eb7d vector: fix tests on wasm
On wasm, calculations on float32 values are done with 64 bit precision.
This is allowed by the Go specification, only explicit conversions to
float32 have to round to 32 bit precision. The difference caused by the
additional precision accumulates over several calculations and causes
the test results to not fully match the expectations. Account for this
by giving a 0.1% tolerance.

Fixes golang/go#31281.

Change-Id: I843788f912015600a18ff3d5cf5520c60403b534
Reviewed-on: https://go-review.googlesource.com/c/image/+/171257
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-04-17 02:09:41 +00:00
Andrei Tudor Călin 3fc05d484e tiff: add Fuzz function
This change adds a sample Fuzz test function to package tiff, under
the gofuzz build tag. The function is based on the tiff/tiff.go code,
from github.com/dvyukov/go-fuzz-corpus.

Fixes golang/go#30719
Updates golang/go#19109

Change-Id: I78771e9a1bd01651ba6ca421ba41f0c0e95d0c53
Reviewed-on: https://go-review.googlesource.com/c/image/+/167097
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: thepudds <thepudds1460@gmail.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2019-03-21 06:31:52 +00:00
Oliver Tonnhofer 0694c2d4d0 font/sfnt: support for large kern tables
The subtable length from the kern table is only uint16. Fonts like
Cambria, Calibri or Corbel have more then 10k kerning pairs and the
encoded length is truncated to uint16. Validate length with truncated
values as well.

Change-Id: I788b709e913790b936d928e7b1e92f628b9c0adf
Reviewed-on: https://go-review.googlesource.com/c/159637
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-02-27 22:21:17 +00:00
Michael Matloob 31aff87c08 all: add a go.mod file
This change adds a go.mod and go.sum file to this repo, following the
requirements stated in bcmills's comment here:
https://golang.org/issue/28136#issuecomment-462971974. It's
important to note that we will not be
adding versions to the repo for now.

The change was generated by running "go mod init" and "go mod tidy" using Go
1.11.5 in the top-level directory of the repository.

Updates golang/go#28136

Change-Id: I837a30c514e23ddab0404a2d8ab66eaa6ad82961
Reviewed-on: https://go-review.googlesource.com/c/162912
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-02-20 21:41:46 +00:00
Oliver Tonnhofer ef4a1470e0 font/sfnt: support for kerning from GPOS tables
This CL adds support for reading kerning information from GPOS tables.

Most modern fonts like Noto or Roboto do not provide a kern table.
Instead they use the GPOS table for kerning.

This CL is limited to horizontal kerning and latin scripts.

The proprietary_test was extended to check all supported variations.
gpos.go has full test coverage (excluding error conditions).
Additionally, the new TestBulkKern (opt-in) can be used to check parsing
of large font collection.

Fixes: golang/go#29528

Change-Id: I9f1ae142c9e26170dd836ccaca1526bbefe9698a
Reviewed-on: https://go-review.googlesource.com/c/159638
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-02-09 06:06:08 +00:00
Denys Smirnov 183bebdce1 font/sfnt: support cmap format 6
The library provides support for CMap formats 2, 4 and 12, but
does not support CMap format 6.

CL adds support for CMap format 6 (trimmed table mapping).

Change-Id: I40657c4805c14017367af17596023da96b2c7483
Reviewed-on: https://go-review.googlesource.com/c/146079
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-18 04:33:09 +00:00
Nigel Tao cd38e8056d font/sfnt: make PostTable.ItalicAngle a float64
Previously, it was a float32, which obviously has 32 bits of state. Not
all of that 32 bit state space is meaningful, since NaN has multiple bit
representations. The underlying file format field (of type "Fixed" or
16.16 fixed point) is also 32 bits of state
(https://docs.microsoft.com/en-us/typography/opentype/spec/post).
Therefore, converting from 32 bit fixed point to 32 bit floating point
can be lossy. Instead, use 64 bit floating point. 53 significand bits
can losslessly represent all possible 16.16 fixed point values.

Using float64 is also arguably more Go-like, as the default type for the
ideal constant 0.5 is float64, not float32.

Change-Id: I5abe7979a020af2ac4784d6c2723ab8e39e38e34
Reviewed-on: https://go-review.googlesource.com/c/149837
Reviewed-by: Denys Smirnov <denis.smirnov.91@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-16 02:48:01 +00:00
Denys Smirnov dd492a22e4 font/sfnt: support fonts with "true" apple version tag
OpenType specification mentions that fonts might contain Apple
version tag that is equal to "true" (see note in [1]). Currently,
the library returns a parsing error for those fonts.

CL adds Apple this version tag to the validation code and allows
fonts to omit OS/2 table, as mentioned in the TrueType spec [2].

[1] https://docs.microsoft.com/en-us/typography/opentype/spec/otff#organization-of-an-opentype-font

[2] https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html

Change-Id: I13406fe97b091f24aaabf9b477df9c8fc8df883c
Reviewed-on: https://go-review.googlesource.com/c/146078
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-16 02:46:09 +00:00
Denys Smirnov d9c2484c48 font/sfnt: parse and expose PostScript information
Currently the library only parses the version in PostScript table.
However use cases such as PDF document processing requires this
information to be exposed.

CL parses a minimal set of the fields from the PostScript table
and exposes it via new PostTable method.

Change-Id: Ia86eecea9f5aaf557c7e4737f2474966aa30cff2
Reviewed-on: https://go-review.googlesource.com/c/145797
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-15 06:11:51 +00:00
Nigel Tao 46e4eb730a vector: use asm opcode mnemonics
There's no change in the binary output, just less mystery in the asm.

These mnemonics were introduced in Go 1.10:
https://golang.org/doc/go1.10#asm and https://golang.org/cl/75490

Current stable release (as of 2018-11-10) is Go 1.11, and
https://golang.org/doc/devel/release.html#policy says that Go 1.9 and
below are therefore no longer supported.

Change-Id: I1f9a63521bc8d5e8f8d395605f62bf7fb6a63bc5
Reviewed-on: https://go-review.googlesource.com/c/148997
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-15 02:24:11 +00:00
Dmitri Shuralyov 249dc8530c draw: re-enable the image.Rectangle DstMask fast path
This change reverts the remaining part of CL 9463,
the image.Rectangle DstMask fast path, since Go 1.5
has been released.

	$ go test -bench=. -count=5 -timeout=1h > before.txt
	$ # apply change
	$ go test -bench=. -count=5 -timeout=1h > after.txt
	$ benchstat before.txt after.txt
	name                    old time/op    new time/op    delta
	SimpleScaleCopy-8         23.4µs ± 3%    21.8µs ± 4%   -7.14%  (p=0.016 n=5+5)
	SimpleTransformCopy-8     22.6µs ± 6%    21.4µs ± 1%   -5.07%  (p=0.008 n=5+5)
	SimpleTransformScale-8     904µs ± 0%     900µs ± 0%     ~     (p=0.056 n=5+5)
	ScaleNNLargeDown-8         641µs ± 1%     643µs ± 1%     ~     (p=0.548 n=5+5)
	ScaleABLargeDown-8        1.50ms ± 1%    1.50ms ± 1%     ~     (p=0.413 n=5+4)
	ScaleBLLargeDown-8         192ms ± 5%     196ms ± 4%     ~     (p=0.095 n=5+5)
	ScaleCRLargeDown-8         355ms ± 4%     350ms ± 2%     ~     (p=0.690 n=5+5)
	ScaleNNDown-8              134µs ± 2%     126µs ± 1%   -5.68%  (p=0.008 n=5+5)
	ScaleABDown-8              261µs ± 3%     256µs ± 1%   -1.92%  (p=0.016 n=5+5)
	ScaleBLDown-8             2.42ms ± 3%    2.44ms ± 8%     ~     (p=0.841 n=5+5)
	ScaleCRDown-8             4.36ms ± 1%    4.85ms ± 4%  +11.22%  (p=0.008 n=5+5)
	ScaleNNUp-8               6.27ms ± 2%    6.72ms ± 3%   +7.20%  (p=0.008 n=5+5)
	ScaleABUp-8               12.8ms ± 1%    13.8ms ± 2%   +7.26%  (p=0.008 n=5+5)
	ScaleBLUp-8               17.5ms ± 7%    17.4ms ± 2%     ~     (p=1.000 n=5+5)
	ScaleCRUp-8               23.2ms ± 2%    23.1ms ± 4%     ~     (p=0.690 n=5+5)
	ScaleNNSrcRGBA-8           419µs ± 1%     421µs ± 3%     ~     (p=0.690 n=5+5)
	ScaleNNSrcUnif-8          3.35µs ± 3%    3.35µs ± 2%     ~     (p=1.000 n=5+5)
	ScaleNNOverRGBA-8          470µs ± 1%     479µs ± 5%     ~     (p=0.548 n=5+5)
	ScaleNNOverUnif-8          102µs ± 2%     102µs ± 1%     ~     (p=0.222 n=5+5)
	TformNNSrcRGBA-8           215µs ± 1%     213µs ± 1%     ~     (p=0.222 n=5+5)
	TformNNSrcUnif-8          84.2µs ± 1%    86.6µs ± 2%   +2.82%  (p=0.016 n=5+5)
	TformNNOverRGBA-8          351µs ± 5%     359µs ± 0%     ~     (p=0.151 n=5+5)
	TformNNOverUnif-8          101µs ± 1%     104µs ± 1%   +3.47%  (p=0.008 n=5+5)
	ScaleABSrcGray-8           399µs ± 2%     400µs ± 2%     ~     (p=0.690 n=5+5)
	ScaleABSrcNRGBA-8          795µs ± 1%     809µs ± 4%     ~     (p=0.095 n=5+5)
	ScaleABSrcRGBA-8           807µs ± 1%     807µs ± 2%     ~     (p=1.000 n=5+5)
	ScaleABSrcYCbCr-8         1.50ms ± 1%    1.48ms ± 0%   -0.76%  (p=0.032 n=5+5)
	ScaleABOverGray-8          396µs ± 0%     395µs ± 1%     ~     (p=0.421 n=5+5)
	ScaleABOverNRGBA-8         886µs ± 1%     885µs ± 1%     ~     (p=0.556 n=4+5)
	ScaleABOverRGBA-8          893µs ± 1%     895µs ± 1%     ~     (p=0.310 n=5+5)
	ScaleABOverYCbCr-8        1.49ms ± 1%    1.49ms ± 1%     ~     (p=0.548 n=5+5)
	TformABSrcGray-8           359µs ± 1%     364µs ± 3%     ~     (p=0.421 n=5+5)
	TformABSrcNRGBA-8          618µs ± 1%     660µs ± 3%   +6.81%  (p=0.008 n=5+5)
	TformABSrcRGBA-8           614µs ± 1%     638µs ± 5%   +3.94%  (p=0.008 n=5+5)
	TformABSrcYCbCr-8          903µs ± 1%     913µs ± 2%     ~     (p=0.056 n=5+5)
	TformABOverGray-8          362µs ± 3%     358µs ± 1%     ~     (p=0.421 n=5+5)
	TformABOverNRGBA-8         691µs ± 1%     690µs ± 1%     ~     (p=0.841 n=5+5)
	TformABOverRGBA-8          671µs ± 1%     673µs ± 1%     ~     (p=0.690 n=5+5)
	TformABOverYCbCr-8         904µs ± 1%     906µs ± 0%     ~     (p=0.190 n=5+4)
	ScaleCRSrcGray-8          9.24ms ± 1%    9.16ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCRSrcNRGBA-8         21.9ms ± 2%    21.7ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCRSrcRGBA-8          22.5ms ± 8%    21.8ms ± 1%     ~     (p=1.000 n=5+5)
	ScaleCRSrcYCbCr-8         43.6ms ± 1%    43.9ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCROverGray-8         9.24ms ± 0%    9.35ms ± 6%     ~     (p=0.690 n=5+5)
	ScaleCROverNRGBA-8        21.9ms ± 1%    21.8ms ± 1%     ~     (p=0.548 n=5+5)
	ScaleCROverRGBA-8         21.8ms ± 0%    22.0ms ± 1%   +0.94%  (p=0.008 n=5+5)
	ScaleCROverYCbCr-8        43.5ms ± 1%    44.1ms ± 1%   +1.53%  (p=0.008 n=5+5)
	TformCRSrcGray-8          3.16ms ± 4%    3.06ms ± 1%     ~     (p=0.056 n=5+5)
	TformCRSrcNRGBA-8         4.21ms ± 1%    4.20ms ± 1%     ~     (p=0.841 n=5+5)
	TformCRSrcRGBA-8          4.29ms ± 1%    4.29ms ± 1%     ~     (p=0.841 n=5+5)
	TformCRSrcYCbCr-8         5.55ms ± 1%    5.58ms ± 0%   +0.67%  (p=0.032 n=5+4)
	TformCROverGray-8         3.08ms ± 1%    3.07ms ± 2%     ~     (p=0.421 n=5+5)
	TformCROverNRGBA-8        4.40ms ± 1%    4.39ms ± 0%     ~     (p=0.841 n=5+5)
	TformCROverRGBA-8         4.50ms ± 5%    4.44ms ± 0%     ~     (p=0.730 n=5+4)
	TformCROverYCbCr-8        5.57ms ± 0%    5.61ms ± 1%     ~     (p=0.095 n=5+5)

Change-Id: I981861c28e103b68275a82e051d2999a8e714502
Reviewed-on: https://go-review.googlesource.com/c/148575
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-09 23:22:46 +00:00
Dmitri Shuralyov aa35264064 font/sfnt: rename ExampleRasterizeGlyph to Example_rasterizeGlyph
This change renames the example to follow correct naming convention,
as documented at https://godoc.org/testing#hdr-Examples. As a result,
it shows up in godoc.

This issue was caught and reported by vet:

	$ go vet golang.org/x/image/font/sfnt
	# golang.org/x/image/font/sfnt_test
	font/sfnt/example_test.go:19: ExampleRasterizeGlyph refers to unknown identifier: RasterizeGlyph

Fixes golang/go#28684

Change-Id: I2749c638c5f3ed15e4db0448bc7a5e2c12c056e5
Reviewed-on: https://go-review.googlesource.com/c/148576
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-09 00:22:02 +00:00
Dmitri Shuralyov 22fd5b5408 draw: fix Transformer documentation formatting
Each span of unindented non-blank lines is converted into a
single paragraph. This isn't desired here. Indent the matrix,
so that it's converted into a <pre> block. That also prevents
the previous line from being interpreted as a heading.

Reference: https://godoc.org/go/doc#ToHTML

Fixes golang/go#28683

Change-Id: Ibc5488d5cc66fe3a5f2bbe2fe23628dd08276037
Reviewed-on: https://go-review.googlesource.com/c/148573
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 22:41:23 +00:00
Dmitri Shuralyov a3f9a0009f draw: remove Go 1.8 support
This change removes support for Go 1.8 and older, as they're no longer
supported per release policy¹.

This brings back a simpler file layout that was here prior to CL 36730,
but keeps using type aliases for the exported names from the standard
library's image/draw package.

Don't keep the comment motivating type alias use, since that feature is
no longer new, and commonly understood by now.

¹ https://tip.golang.org/doc/devel/release.html#policy

Change-Id: I5fab71162cf6daa5985a048ed06011efacddf886
Reviewed-on: https://go-review.googlesource.com/c/148567
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 21:44:26 +00:00
Dmitri Shuralyov 36ab2409c1 webp: remove Go 1.8 support
This is a revert of CL 24945 and CL 24954, since we no longer need to
support Go 1.5.

No need to explicitly specify which Go version is required. Instead,
rely on the implicit requirement based on the release support policy¹.
This is simpler and consistent with how it was before CL 24954.

¹ https://tip.golang.org/doc/devel/release.html#policy

Change-Id: I3cfef1bef120f702d5859dad10a76803544cc869
Reviewed-on: https://go-review.googlesource.com/c/148569
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 21:37:21 +00:00
Dmitri Shuralyov 4b0b9b997d vector: remove Go 1.8 support
This change reverts CL 32132. We no longer have to worry about
Go 1.5 support. This results in slightly simpler build constraints.

Change-Id: I021936646a6e9a82462a885b256894027fb58aeb
Reviewed-on: https://go-review.googlesource.com/c/148568
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-08 20:57:45 +00:00
Dmitri Shuralyov 6f5d68baf1 webp/nycbcra: delete deprecated package
This package has been deprecated since Go 1.6, which is long ago.
There's a warning printed whenever this package is imported, which
helped people migrate away from it by now. Delete it since it's
unused and unsupported.

Change-Id: If84b631ebff6530cdb955af34fa7b84d50130166
Reviewed-on: https://go-review.googlesource.com/c/148570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 20:55:02 +00:00
Dmitri Shuralyov 55919307b5 colornames: update SVG 1.1 spec URL
The Scalable Vector Graphics (SVG) 1.1 specification URL has changed.
The old URL, https://www.w3.org/TR/SVG/, now hosts the SVG 2 spec.
SVG 1.1 spec has moved to https://www.w3.org/TR/SVG11/.

This change makes this package go generate successfully with no diff.

Change-Id: Ifa788b1bb47748610b3adc0ac96692c00bcb3158
Reviewed-on: https://go-review.googlesource.com/c/148566
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 20:49:13 +00:00
Denys Smirnov fe2fa19765 font/sfnt: support post table version 1.0
Currently, the library produces a parsing error when the font
contains a PostScript table of version 1.0.

CL adds this version to the validation code and implements a glyph
name lookup for it.

Change-Id: Id4999d8b252e5c2d8e897f637ba31270336cfe9a
Reviewed-on: https://go-review.googlesource.com/c/146080
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-07 04:00:41 +00:00
Denys Smirnov 63626fb251 font/sfnt: fix hmtx table size validation
The library assumes the hmtx size to be equal to 2*nGlyph + 2*nHm,
which is a simplification of 4*nHm + 2*(nGlyph-nHm) as described
in the spec. However, fonts seen in the wild sometimes omit the
second term (left side bearings), making validation to fail.

CL fixes the validation code by allowing to omit the second term.

Fixes golang/go#28379

Change-Id: I2293e498e72f95e5fe08c2b375ea7b020d06cde3
Reviewed-on: https://go-review.googlesource.com/c/144080
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-02 02:16:09 +00:00
Igor Zhilianin 69cc3646b9 all: fix typos
Change-Id: I2140a1a74d1319d9b8746efad539bfaae6038a2d
GitHub-Last-Rev: b00b49e87e
GitHub-Pull-Request: golang/image#1
Reviewed-on: https://go-review.googlesource.com/c/145740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30 00:21:51 +00:00
Denys Smirnov 2a2258ff36 font/sfnt: support parsing legacy fonts with OS2 table version <= 1
Library assumes that OS/2 header size is at least 96 bytes,
which is not the case for fonts with OS/2 table version <= 1.

This CL adds a version test and handles the legacy header.

Fixes golang/go#28339

Change-Id: I79bd8f8bbf262c1caaf4e66888446159b5e4fb43
Reviewed-on: https://go-review.googlesource.com/c/144079
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-10-25 23:34:08 +00:00
Nigel Tao 9b1e201e7c bmp: update comment about decoding 32 bpp images
Change-Id: I90f6d36d5257c31dc2e41943e5a1eaa7755da6d2
Reviewed-on: https://go-review.googlesource.com/c/144317
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-23 23:21:08 +00:00
David Heuschmann a9455cf03d image/bmp: support v4 and v5 info header versions
Decode BITMAPV4INFOHEADER and BITMAPV5INFOHEADER in addition to
BITMAPINFOHEADER and check if any of their features are used. If this is
not the case, the bmp can be decoded as if it had the BITMAPINFOHEADER.
Otherwise an ErrUnsupported is returned.

The colormap.bmp and yellow_rose-small-v5.bmp files were generated using
imagemagick using the following conversions:

convert video-001.bmp -depth 8 -palette colormap.bmp
convert yellow_rose-small.bmp -format BMP5 yellow_rose-small-v5.bmp

The corresponding png files were created using imagemagick convert
without any arguments.

Fixes golang/go#27767

Change-Id: I5c0138b231c68132d39a29c71b61faa546921511
Reviewed-on: https://go-review.googlesource.com/c/141799
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-23 22:58:01 +00:00
Elias Naur 991ec62608 image/font: expose caret slope
Change-Id: I775224dd3fc7e5b6c2fc5c4a7d3db83bb36d047d
Reviewed-on: https://go-review.googlesource.com/136255
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-09-26 01:56:37 +00:00
Elias Naur e1a1ede689 font,font/sfnt: expose font x-Height and capHeight
Change-Id: I6e3e6e51c7e270e16413c23990f6df5e22cbfeb6
Reviewed-on: https://go-review.googlesource.com/135555
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-09-20 23:51:50 +00:00
Nigel Tao c73c2afc3b bmp: remove unused testing.T arg
Change-Id: I53954db3e83d3a5bb155fec24c7da0dc31b8ea2d
Reviewed-on: https://go-review.googlesource.com/122418
Reviewed-by: David Symonds <dsymonds@golang.org>
2018-07-08 00:43:52 +00:00
Derek Buitenhuis e7c2a4f042 bmp: Add support for writing bitmaps with alpha channels
This also fixes the writer test to actually compare the decoded images,
so as to make sure it is decoded properly.

Implements golang/go#25945.

Change-Id: I606887baa11b7664018313cf7d5800b2dc7622cf
Reviewed-on: https://go-review.googlesource.com/120095
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-06 05:04:57 +00:00
Elias Naur cc896f830c font/sfnt,font/opentype: correct font height computation
According to https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
the line spacing of a font is computed as

line space = ascent - descent + linegap

Use that formula to compute the Height field of a Font's Metrics.

Change-Id: I1c44eca9f662e0aae68716cd8859670fe0b394d7
Reviewed-on: https://go-review.googlesource.com/120815
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-06-28 06:20:38 +00:00
Paul Jolly af66defab9 README: fix go get instructions
Currently the instructions tell the user to:

go get -u golang.org/x/image

However, this is not valid because golang.org/x/image contains no Go
files.

Instead it should read:

go get -u golang.org/x/image/...

Fixes golang/go#25618.

Change-Id: I465fac26afdca52878518e4c01d46cf9d12930b9
Reviewed-on: https://go-review.googlesource.com/115675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-01 11:54:56 +00:00
monkeybutter f315e44030 tiff: fixes problem with decoding tiled uint16 tiff files.
The proposed fix updates the x axis offset variable in case the tile
surpasses the limits of the destination image.

Fixes golang/go#24657

Change-Id: I6bc52274a05dc41b058f6a6f1d0a304f1b20152d
Reviewed-on: https://go-review.googlesource.com/104295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-03 16:11:27 +00:00
Andrew Bonventre f3a9b89b59 CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I9a3a920ec803ee612775aebfeaedb162d2266aa8
Reviewed-on: https://go-review.googlesource.com/100683
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:48 +00:00
Jiulong Wang 12117c17ca draw: fix crash caused by Scale by Copy shortcut
When DstMask is not nil, this shortcut causes stack overflow because
Copy function in turn will call Scale with same dr and sr.

Fixes golang/go#23107

Change-Id: I8ccadbd9b7f16363ac17b6114308527d6fa9456e
Reviewed-on: https://go-review.googlesource.com/83537
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-14 22:51:56 +00:00
Sebastien Binet e5db4c4663 font/opentype: implement font.Face interface
This CL adds the type Face that implements the font.Face interface.
This CL also adds tests using gofont/goregular as an input font, using
github.com/golang/freetype/truetype as reference values.

Updates golang/go#22451.

Change-Id: I2a6945309331b251ec2ddec95b6e809ad10aa116
Reviewed-on: https://go-review.googlesource.com/73870
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-12-08 23:31:33 +00:00
Elias Naur f7e31b4ea2 font/sfnt: add Metrics to Font
Change-Id: I4bfcf264e5ee7e4f3ddf89e289d730f230095401
Reviewed-on: https://go-review.googlesource.com/67330
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-10-13 01:36:00 +00:00
Kevin Burke 334384d9e1 README: add more description
Move the README to README.md so Gerrit can render it; currently
Gerrit only renders files named exactly "README.md" (for example at
https://go.googlesource.com/go).

Add more links to the README explaining how to file issues,
how to submit code changes, where to download the code to and
how to get it. Hopefully this should help people who go to
https://go.googlesource.com/image or https://github.com/golang/image
figure out how to get started with development.

Change-Id: I390d4bd84c9fd7d0bd3f3f56f63ea8482d03a725
Reviewed-on: https://go-review.googlesource.com/49830
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-27 05:35:55 +00:00