1 <!-- Copyright 2008 Lubomir Bourdev and Hailin Jin
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
9 Copyright 2005-2007 Adobe Systems Incorporated
10 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
11 or a copy at http://stlab.adobe.com/licenses.html)
13 Some files are held under additional license.
14 Please see "http://stlab.adobe.com/licenses.html" for more information.
17 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
18 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
19 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en" xml:
lang=
"en">
22 <TITLE>Generic Image Library: png_io.hpp Source File
</TITLE>
23 <META HTTP-EQUIV=
"content-type" CONTENT=
"text/html;charset=ISO-8859-1"/>
24 <LINK TYPE=
"text/css" REL=
"stylesheet" HREF=
"adobe_source.css"/>
27 <table border=
"0" cellspacing=
"0" cellpadding=
"0" style='width:
100%; margin:
0; padding:
0'
><tr>
28 <td width=
"100%" valign=
"top" style='padding-left:
10px; padding-right:
10px; padding-bottom:
10px'
>
29 <div class=
"qindex"><a class=
"qindex" href=
"index.html">Modules
</a>
30 |
<a class=
"qindex" href=
"classes.html">Alphabetical List
</a>
31 |
<a class=
"qindex" href=
"annotated.html">Class List
</a>
32 |
<a class=
"qindex" href=
"dirs.html">Directories
</a>
33 |
<a class=
"qindex" href=
"files.html">File List
</a>
34 |
<a class=
"qindex" href=
"../index.html">GIL Home Page
</a>
37 <!-- Generated by Doxygen 1.5.6 -->
38 <div class=
"navpath"><a class=
"el" href=
"g_i_l_0076.html">boost
</a> »
<a class=
"el" href=
"g_i_l_0079.html">gil
</a> »
<a class=
"el" href=
"g_i_l_0078.html">extension
</a> »
<a class=
"el" href=
"g_i_l_0077.html">io
</a>
40 <div class=
"contents">
41 <h1>png_io.hpp
</h1><a href=
"png__io_8hpp.html">Go to the documentation of this file.
</a><div class=
"fragment"><pre class=
"fragment"><a name=
"l00001"></a>00001 <span class=
"comment">/*
</span>
42 <a name=
"l00002"></a>00002 <span class=
"comment"> Copyright
2005-
2007 Adobe Systems Incorporated
</span>
43 <a name=
"l00003"></a>00003 <span class=
"comment"> </span>
44 <a name=
"l00004"></a>00004 <span class=
"comment"> Use, modification and distribution are subject to the Boost Software License,
</span>
45 <a name=
"l00005"></a>00005 <span class=
"comment"> Version
1.0. (See accompanying file LICENSE_1_0.txt or copy at
</span>
46 <a name=
"l00006"></a>00006 <span class=
"comment"> http://www.boost.org/LICENSE_1_0.txt).
</span>
47 <a name=
"l00007"></a>00007 <span class=
"comment"></span>
48 <a name=
"l00008"></a>00008 <span class=
"comment"> See http://opensource.adobe.com/gil for most recent version including documentation.
</span>
49 <a name=
"l00009"></a>00009 <span class=
"comment">*/
</span>
50 <a name=
"l00010"></a>00010
51 <a name=
"l00011"></a>00011 <span class=
"comment">/*************************************************************************************************/
</span>
52 <a name=
"l00012"></a>00012
53 <a name=
"l00013"></a>00013 <span class=
"preprocessor">#ifndef GIL_PNG_IO_H
</span>
54 <a name=
"l00014"></a>00014 <span class=
"preprocessor"></span><span class=
"preprocessor">#define GIL_PNG_IO_H
</span>
55 <a name=
"l00015"></a>00015 <span class=
"preprocessor"></span>
56 <a name=
"l00019"></a>00019 <span class=
"comment">//
</span>
57 <a name=
"l00020"></a>00020 <span class=
"comment">// We are currently providing the following functions:
</span>
58 <a name=
"l00021"></a>00021 <span class=
"comment">// point2
<std::ptrdiff_t
> png_read_dimensions(const char*)
</span>
59 <a name=
"l00022"></a>00022 <span class=
"comment">// template
<typename View
> void png_read_view(const char*,const View
&)
</span>
60 <a name=
"l00023"></a>00023 <span class=
"comment">// template
<typename View
> void png_read_image(const char*,image
<View
>&)
</span>
61 <a name=
"l00024"></a>00024 <span class=
"comment">// template
<typename View
> void png_write_view(const char*,const View
&)
</span>
62 <a name=
"l00025"></a>00025 <span class=
"comment">// template
<typename View
> struct png_read_support;
</span>
63 <a name=
"l00026"></a>00026 <span class=
"comment">// template
<typename View
> struct png_write_support;
</span>
64 <a name=
"l00027"></a>00027 <span class=
"comment">//
</span>
65 <a name=
"l00031"></a>00031 <span class=
"comment"></span>
66 <a name=
"l00032"></a>00032 <span class=
"preprocessor">#include
<stdio.h
></span>
67 <a name=
"l00033"></a>00033 <span class=
"preprocessor">#include
<string
></span>
68 <a name=
"l00034"></a>00034 <span class=
"keyword">extern
</span> <span class=
"stringliteral">"C"</span> {
69 <a name=
"l00035"></a>00035 <span class=
"preprocessor">#include
"png.h"</span>
70 <a name=
"l00036"></a>00036 }
71 <a name=
"l00037"></a>00037 <span class=
"preprocessor">#include
<boost/static_assert.hpp
></span>
72 <a name=
"l00038"></a>00038 <span class=
"preprocessor">#include
"../../gil_config.hpp"</span>
73 <a name=
"l00039"></a>00039 <span class=
"preprocessor">#include
"../../utilities.hpp"</span>
74 <a name=
"l00040"></a>00040 <span class=
"preprocessor">#include
"<a class="code
" href="io__error_8hpp.html
" title="Handle input-output errors.
">io_error.hpp</a>"</span>
75 <a name=
"l00041"></a>00041 <span class=
"preprocessor">#include
"<a class="code
" href="g_i_l_0254.html
" title="Internal support for reading and writing PNG files.
">png_io_private.hpp</a>"</span>
76 <a name=
"l00042"></a>00042
77 <a name=
"l00043"></a>00043 <span class=
"keyword">namespace
</span>boost {
<span class=
"keyword">namespace
</span>gil {
78 <a name=
"l00044"></a>00044
79 <a name=
"l00048"></a><a class=
"code" href=
"g_i_l_0174.html#g7a75144b324bb509ca6a5803b8669310">00048</a> <span class=
"keyword">inline
</span> <a class=
"code" href=
"g_i_l_0060.html" title=
"2D point both axes of which have the same dimension typeModels: Point2DConcept">point2
<std::ptrdiff_t
></a> <a class=
"code" href=
"g_i_l_0174.html#g5c20a2a469cdec4f530e02acab11e53e" title=
"Returns the width and height of the PNG file at the specified location. Throws std::ios_base::failur...">png_read_dimensions
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *filename) {
80 <a name=
"l00049"></a>00049 detail::png_reader m(filename);
81 <a name=
"l00050"></a>00050 <span class=
"keywordflow">return
</span> m.get_dimensions();
82 <a name=
"l00051"></a>00051 }
83 <a name=
"l00052"></a>00052
84 <a name=
"l00056"></a><a class=
"code" href=
"g_i_l_0174.html#g5c20a2a469cdec4f530e02acab11e53e">00056</a> <span class=
"keyword">inline
</span> <a class=
"code" href=
"g_i_l_0060.html" title=
"2D point both axes of which have the same dimension typeModels: Point2DConcept">point2
<std::ptrdiff_t
></a> <a class=
"code" href=
"g_i_l_0174.html#g5c20a2a469cdec4f530e02acab11e53e" title=
"Returns the width and height of the PNG file at the specified location. Throws std::ios_base::failur...">png_read_dimensions
</a>(
<span class=
"keyword">const
</span> std::string
& filename) {
85 <a name=
"l00057"></a>00057 <span class=
"keywordflow">return
</span> <a class=
"code" href=
"g_i_l_0174.html#g5c20a2a469cdec4f530e02acab11e53e" title=
"Returns the width and height of the PNG file at the specified location. Throws std::ios_base::failur...">png_read_dimensions
</a>(filename.c_str());
86 <a name=
"l00058"></a>00058 }
87 <a name=
"l00059"></a>00059
88 <a name=
"l00062"></a>00062 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
89 <a name=
"l00063"></a><a class=
"code" href=
"g_i_l_0613.html">00063</a> <span class=
"keyword">struct
</span><a class=
"code" href=
"g_i_l_0613.html" title=
"Determines whether the given view type is supported for reading.">png_read_support
</a> {
90 <a name=
"l00064"></a>00064 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">bool
</span>,is_supported=
91 <a name=
"l00065"></a>00065 (detail::png_read_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
92 <a name=
"l00066"></a>00066 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::is_supported));
93 <a name=
"l00067"></a>00067 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">int
</span>,bit_depth=
94 <a name=
"l00068"></a>00068 (detail::png_read_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
95 <a name=
"l00069"></a>00069 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::bit_depth));
96 <a name=
"l00070"></a>00070 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">int
</span>,color_type=
97 <a name=
"l00071"></a>00071 (detail::png_read_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
98 <a name=
"l00072"></a>00072 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::color_type));
99 <a name=
"l00073"></a>00073 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">bool
</span>, value=is_supported);
100 <a name=
"l00074"></a>00074 };
101 <a name=
"l00075"></a>00075
102 <a name=
"l00081"></a>00081 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
103 <a name=
"l00082"></a><a class=
"code" href=
"g_i_l_0174.html#gd38a3931f62a6341bd3d6f5a8a9575cc">00082</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g26a89c06bf3915307483129fb655a205" title=
"Loads the image specified by the given png image file name into the given view.">png_read_view
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
104 <a name=
"l00083"></a>00083 BOOST_STATIC_ASSERT(
<a class=
"code" href=
"g_i_l_0613.html" title=
"Determines whether the given view type is supported for reading.">png_read_support
<View
>::is_supported
</a>);
105 <a name=
"l00084"></a>00084 detail::png_reader m(filename);
106 <a name=
"l00085"></a>00085 m.apply(view);
107 <a name=
"l00086"></a>00086 }
108 <a name=
"l00087"></a>00087
109 <a name=
"l00090"></a>00090 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
110 <a name=
"l00091"></a><a class=
"code" href=
"g_i_l_0174.html#g26a89c06bf3915307483129fb655a205">00091</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g26a89c06bf3915307483129fb655a205" title=
"Loads the image specified by the given png image file name into the given view.">png_read_view
</a>(
<span class=
"keyword">const
</span> std::string
& filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
111 <a name=
"l00092"></a>00092 <a class=
"code" href=
"g_i_l_0174.html#g26a89c06bf3915307483129fb655a205" title=
"Loads the image specified by the given png image file name into the given view.">png_read_view
</a>(filename.c_str(),view);
112 <a name=
"l00093"></a>00093 }
113 <a name=
"l00094"></a>00094
114 <a name=
"l00100"></a>00100 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image
>
115 <a name=
"l00101"></a><a class=
"code" href=
"g_i_l_0174.html#gc295fb9e9c9cdaf7b570705a0e385ec6">00101</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#ge9a35f15e2544de801e23b3c481612a9" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_image
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,Image
& im) {
116 <a name=
"l00102"></a>00102 BOOST_STATIC_ASSERT(
<a class=
"code" href=
"g_i_l_0613.html" title=
"Determines whether the given view type is supported for reading.">png_read_support
<typename Image::view_t
>::is_supported
</a>);
117 <a name=
"l00103"></a>00103 detail::png_reader m(filename);
118 <a name=
"l00104"></a>00104 m.read_image(im);
119 <a name=
"l00105"></a>00105 }
120 <a name=
"l00106"></a>00106
121 <a name=
"l00109"></a>00109 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image
>
122 <a name=
"l00110"></a><a class=
"code" href=
"g_i_l_0174.html#ge9a35f15e2544de801e23b3c481612a9">00110</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#ge9a35f15e2544de801e23b3c481612a9" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_image
</a>(
<span class=
"keyword">const
</span> std::string
& filename,Image
& im) {
123 <a name=
"l00111"></a>00111 <a class=
"code" href=
"g_i_l_0174.html#ge9a35f15e2544de801e23b3c481612a9" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_image
</a>(filename.c_str(),im);
124 <a name=
"l00112"></a>00112 }
125 <a name=
"l00113"></a>00113
126 <a name=
"l00117"></a>00117 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View,
<span class=
"keyword">typename
</span> CC
>
127 <a name=
"l00118"></a><a class=
"code" href=
"g_i_l_0174.html#g98fb4592762b73fbf1f982159677d069">00118</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>,CC cc) {
128 <a name=
"l00119"></a>00119 detail::png_reader_color_convert
<CC
> m(filename,cc);
129 <a name=
"l00120"></a>00120 m.apply(view);
130 <a name=
"l00121"></a>00121 }
131 <a name=
"l00122"></a>00122
132 <a name=
"l00126"></a>00126 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
133 <a name=
"l00127"></a><a class=
"code" href=
"g_i_l_0174.html#gdde60e9455374235470eb50affd92f1c">00127</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
134 <a name=
"l00128"></a>00128 detail::png_reader_color_convert
<default_color_converter
> m(filename,
<a class=
"code" href=
"g_i_l_0452.html" title=
"class for color-converting one pixel to another">default_color_converter
</a>());
135 <a name=
"l00129"></a>00129 m.apply(view);
136 <a name=
"l00130"></a>00130 }
137 <a name=
"l00131"></a>00131
138 <a name=
"l00134"></a>00134 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View,
<span class=
"keyword">typename
</span> CC
>
139 <a name=
"l00135"></a><a class=
"code" href=
"g_i_l_0174.html#g14f5371946862331ccde3e67651df78a">00135</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(
<span class=
"keyword">const
</span> std::string
& filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>,CC cc) {
140 <a name=
"l00136"></a>00136 <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(filename.c_str(),view,cc);
141 <a name=
"l00137"></a>00137 }
142 <a name=
"l00138"></a>00138
143 <a name=
"l00141"></a>00141 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
144 <a name=
"l00142"></a><a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca">00142</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(
<span class=
"keyword">const
</span> std::string
& filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
145 <a name=
"l00143"></a>00143 <a class=
"code" href=
"g_i_l_0174.html#gf26951df731c0669918fed7f372b7aca" title=
"Loads the image specified by the given png image file name and color-converts it...">png_read_and_convert_view
</a>(filename.c_str(),view);
146 <a name=
"l00144"></a>00144 }
147 <a name=
"l00145"></a>00145
148 <a name=
"l00149"></a>00149 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image,
<span class=
"keyword">typename
</span> CC
>
149 <a name=
"l00150"></a><a class=
"code" href=
"g_i_l_0174.html#g7b9a2c89929e9400a85814548f1d3002">00150</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,Image
& im,CC cc) {
150 <a name=
"l00151"></a>00151 detail::png_reader_color_convert
<CC
> m(filename,cc);
151 <a name=
"l00152"></a>00152 m.read_image(im);
152 <a name=
"l00153"></a>00153 }
153 <a name=
"l00154"></a>00154
154 <a name=
"l00158"></a>00158 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image
>
155 <a name=
"l00159"></a><a class=
"code" href=
"g_i_l_0174.html#gc5c5c8b057f342c96c410e03cea63b62">00159</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,Image
& im) {
156 <a name=
"l00160"></a>00160 detail::png_reader_color_convert
<default_color_converter
> m(filename,
<a class=
"code" href=
"g_i_l_0452.html" title=
"class for color-converting one pixel to another">default_color_converter
</a>());
157 <a name=
"l00161"></a>00161 m.read_image(im);
158 <a name=
"l00162"></a>00162 }
159 <a name=
"l00163"></a>00163
160 <a name=
"l00166"></a>00166 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image,
<span class=
"keyword">typename
</span> CC
>
161 <a name=
"l00167"></a><a class=
"code" href=
"g_i_l_0174.html#g215e558f6c06c6e91a20367f07cbb208">00167</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(
<span class=
"keyword">const
</span> std::string
& filename,Image
& im,CC cc) {
162 <a name=
"l00168"></a>00168 <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(filename.c_str(),im,cc);
163 <a name=
"l00169"></a>00169 }
164 <a name=
"l00170"></a>00170
165 <a name=
"l00173"></a>00173 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> Image
>
166 <a name=
"l00174"></a><a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28">00174</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(
<span class=
"keyword">const
</span> std::string
& filename,Image
& im) {
167 <a name=
"l00175"></a>00175 <a class=
"code" href=
"g_i_l_0174.html#g086e5851f7d0e6067cdbe4037bd39b28" title=
"Allocates a new image whose dimensions are determined by the given png image file...">png_read_and_convert_image
</a>(filename.c_str(),im);
168 <a name=
"l00176"></a>00176 }
169 <a name=
"l00177"></a>00177
170 <a name=
"l00180"></a>00180 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
171 <a name=
"l00181"></a><a class=
"code" href=
"g_i_l_0615.html">00181</a> <span class=
"keyword">struct
</span><a class=
"code" href=
"g_i_l_0615.html" title=
"Determines whether the given view type is supported for writing.">png_write_support
</a> {
172 <a name=
"l00182"></a>00182 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">bool
</span>,is_supported=
173 <a name=
"l00183"></a>00183 (detail::png_write_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
174 <a name=
"l00184"></a>00184 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::is_supported));
175 <a name=
"l00185"></a>00185 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">int
</span>,bit_depth=
176 <a name=
"l00186"></a>00186 (detail::png_write_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
177 <a name=
"l00187"></a>00187 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::bit_depth));
178 <a name=
"l00188"></a>00188 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">int
</span>,color_type=
179 <a name=
"l00189"></a>00189 (detail::png_write_support_private
<<span class=
"keyword">typename
</span> channel_type
<View
>::type,
180 <a name=
"l00190"></a>00190 <span class=
"keyword">typename
</span> color_space_type
<View
>::type
>::color_type));
181 <a name=
"l00191"></a>00191 BOOST_STATIC_CONSTANT(
<span class=
"keywordtype">bool
</span>, value=is_supported);
182 <a name=
"l00192"></a>00192 };
183 <a name=
"l00193"></a>00193
184 <a name=
"l00198"></a>00198 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
185 <a name=
"l00199"></a><a class=
"code" href=
"g_i_l_0174.html#ga3fb5aa5c76f3cf2ecbb35e9cc82a83a">00199</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gb8c6c4c3b78627324ac5983e348008de" title=
"Saves the view to a png file specified by the given png image file name.">png_write_view
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span>* filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
186 <a name=
"l00200"></a>00200 BOOST_STATIC_ASSERT(
<a class=
"code" href=
"g_i_l_0615.html" title=
"Determines whether the given view type is supported for writing.">png_write_support
<View
>::is_supported
</a>);
187 <a name=
"l00201"></a>00201 detail::png_writer m(filename);
188 <a name=
"l00202"></a>00202 m.apply(view);
189 <a name=
"l00203"></a>00203 }
190 <a name=
"l00204"></a>00204
191 <a name=
"l00207"></a>00207 <span class=
"keyword">template
</span> <<span class=
"keyword">typename
</span> View
>
192 <a name=
"l00208"></a><a class=
"code" href=
"g_i_l_0174.html#gb8c6c4c3b78627324ac5983e348008de">00208</a> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"g_i_l_0174.html#gb8c6c4c3b78627324ac5983e348008de" title=
"Saves the view to a png file specified by the given png image file name.">png_write_view
</a>(
<span class=
"keyword">const
</span> std::string
& filename,
<span class=
"keyword">const
</span> View
& <a class=
"code" href=
"g_i_l_0135.html#g55e45a15dddfc0d870c2f7fb9739cb2e" title=
"Returns the non-constant-pixel view of any image. The returned view is any view.">view
</a>) {
193 <a name=
"l00209"></a>00209 <a class=
"code" href=
"g_i_l_0174.html#gb8c6c4c3b78627324ac5983e348008de" title=
"Saves the view to a png file specified by the given png image file name.">png_write_view
</a>(filename.c_str(),view);
194 <a name=
"l00210"></a>00210 }
195 <a name=
"l00211"></a>00211
196 <a name=
"l00212"></a>00212 } }
<span class=
"comment">// namespace boost::gil
</span>
197 <a name=
"l00213"></a>00213
198 <a name=
"l00214"></a>00214 <span class=
"preprocessor">#endif
</span>
200 <hr size=
"1"><address style=
"text-align: right;"><small>Generated on Sat May
2 13:
50:
15 2009 for Generic Image Library by
201 <a href=
"http://www.doxygen.org/index.html">
202 <img src=
"doxygen.png" alt=
"doxygen" align=
"middle" border=
"0"></a> 1.5.6 </small></address>