-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathimage_png.htm
61 lines (60 loc) · 4.89 KB
/
image_png.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../assets/site.css" rel="stylesheet">
<title>image/png</title>
</head>
<body>
<div class="container">
<h2 id="pkg-overview">package png</h2>
<p><code>import "image/png"</code>
<p>png包实现了PNG图像的编解码。PNG格式参见:<a href="http://www.w3.org/TR/PNG/">http://www.w3.org/TR/PNG/</a></p>
<h3 id="pkg-index" class="section-header">Index <a class="permalink" href="#pkg-index">¶</a></h3>
<a href="../main.html"><h3>返回首页</h3></a>
</br>
<li><a href="#FormatError">type FormatError</a></li>
<ul>
<li><a href="#FormatError.Error">func (e FormatError) Error() string</a></li>
</ul>
<li><a href="#UnsupportedError">type UnsupportedError</a></li>
<ul>
<li><a href="#UnsupportedError.Error">func (e UnsupportedError) Error() string</a></li>
</ul>
<li><a href="#Decode">func Decode(r io.Reader) (image.Image, error)</a></li>
<li><a href="#DecodeConfig">func DecodeConfig(r io.Reader) (image.Config, error)</a></li>
<li><a href="#Encode">func Encode(w io.Writer, m image.Image) error</a></li>
</ul>
<h3 id="FormatError">type <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#90">FormatError</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre>type FormatError <a href="builtin.htm#string">string</a></pre>
<p>当输入流不是合法的png格式图像时,就会返回FormatError类型的错误。</p>
<h4 id="FormatError.Error">func (FormatError) <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#92">Error</a> <a class="permalink" href="#pkg-index">¶</a></h4>
<pre class="funcdecl">func (e <a href="#FormatError">FormatError</a>) Error() <a href="builtin.htm#string">string</a></pre>
<h3 id="UnsupportedError">type <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#97">UnsupportedError</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre>type UnsupportedError <a href="builtin.htm#string">string</a></pre>
<p>当输入流使用了合法但尚不支持的png特性的时候,就会返回UnsupportedError类型的错误。</p>
<h4 id="UnsupportedError.Error">func (UnsupportedError) <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#99">Error</a> <a class="permalink" href="#pkg-index">¶</a></h4>
<pre class="funcdecl">func (e <a href="#UnsupportedError">UnsupportedError</a>) Error() <a href="builtin.htm#string">string</a></pre>
<h3 id="Decode">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#619">Decode</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func Decode(r <a href="io.htm">io</a>.<a href="io.htm#Reader">Reader</a>) (<a href="image.htm">image</a>.<a href="image.htm#Image">Image</a>, <a href="builtin.htm#error">error</a>)</pre>
<p>从r读取一幅png格式的图像并解码返回该图像。图像的具体类型要看png文件的内容而定。</p>
<h3 id="DecodeConfig">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#643">DecodeConfig</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func DecodeConfig(r <a href="io.htm">io</a>.<a href="io.htm#Reader">Reader</a>) (<a href="image.htm">image</a>.<a href="image.htm#Config">Config</a>, <a href="builtin.htm#error">error</a>)</pre>
<p>返回PNG图像的色彩模型和尺寸;函数不会解码整个图像。</p>
<h3 id="Encode">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/writer.go?name=release#433">Encode</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func Encode(w <a href="io.htm">io</a>.<a href="io.htm#Writer">Writer</a>, m <a href="image.htm">image</a>.<a href="image.htm#Image">Image</a>) <a href="builtin.htm#error">error</a></pre>
<p>将图像m以PNG格式写入w。任意图像类型都可以被编码,但image.NRGBA以外格式的图像可能会在编码时丢失一些图像信息。</p>
</div>
<div id="x-footer" class="clearfix">
<div class="container">
<a href="http://studygolang.com/" target="_blank">Go语言中文网</a>
<span class="text-muted">|</span> <a href="http://golang.org/" target="_blank">Go Language</a>
<span class="pull-right"><a href="#">Back to top</a></span>
</div>
</div>
<script src="../assets/jquery-2.0.3.min.js"></script>
<script src="../assets/bootstrap.min.js"></script>
<script src="../assets/site.js"></script>
</body>
</html>