File size: 10,697 Bytes
9375c9a |
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - png_loader_abstract.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2008 Davis E. King ([email protected]), Nils Labugt
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license.
</font><font color='#0000FF'>#undef</font> DLIB_PNG_IMPORT_ABSTRACT
<font color='#0000FF'>#ifdef</font> DLIB_PNG_IMPORT_ABSTRACT
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='image_loader_abstract.h.html'>image_loader_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../pixel.h.html'>../pixel.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../dir_nav.h.html'>../dir_nav.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../image_processing/generic_image.h.html'>../image_processing/generic_image.h</a>"
<font color='#0000FF'>namespace</font> dlib
<b>{</b>
<font color='#0000FF'>class</font> <b><a name='png_loader'></a>png_loader</b> : noncopyable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
Defined by the constructors
WHAT THIS OBJECT REPRESENTS
This object represents a class capable of loading PNG image files.
Once an instance of it is created to contain a PNG file from
disk you can obtain the image stored in it via get_image().
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='png_loader'></a>png_loader</b><font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> filename
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- loads the PNG file with the given file name into this object
throws
- std::bad_alloc
- image_load_error
This exception is thrown if there is some error that prevents
us from loading the given PNG file.
!*/</font>
<b><a name='png_loader'></a>png_loader</b><font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> filename
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- loads the PNG file with the given file name into this object
throws
- std::bad_alloc
- image_load_error
This exception is thrown if there is some error that prevents
us from loading the given PNG file.
!*/</font>
<b><a name='png_loader'></a>png_loader</b><font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> dlib::file<font color='#5555FF'>&</font> f
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- loads the PNG file with the given file name into this object
throws
- std::bad_alloc
- image_load_error
This exception is thrown if there is some error that prevents
us from loading the given PNG file.
!*/</font>
<b><a name='png_loader'></a>png_loader</b><font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> image_buffer,
<font color='#0000FF'><u>size_t</u></font> buffer_size
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- loads the PNG from memory image_buffer of size buffer_size into this object
throws
- image_load_error
This exception is thrown if there is some error that prevents
us from loading the given PNG buffer.
!*/</font>
~<b><a name='png_loader'></a>png_loader</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- all resources associated with *this has been released
!*/</font>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_gray'></a>is_gray</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- if (this object contains a grayscale image without an alpha channel) then
- returns true
- else
- returns false
!*/</font>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_graya'></a>is_graya</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- if (this object contains a grayscale image with an alpha channel) then
- returns true
- else
- returns false
!*/</font>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_rgb'></a>is_rgb</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- if (this object contains a 3 channel RGB image) then
- returns true
- else
- returns false
!*/</font>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_rgba'></a>is_rgba</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- if (this object contains a 4 channel RGB alpha image) then
- returns true
- else
- returns false
!*/</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font> <b><a name='bit_depth'></a>bit_depth</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- returns the number of bits per channel in the image contained by this
object. The possible values are 8 or 16.
!*/</font>
<font color='#0000FF'>template</font><font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> image_type
<font color='#5555FF'>></font>
<font color='#0000FF'><u>void</u></font> <b><a name='get_image'></a>get_image</b><font face='Lucida Console'>(</font>
image_type<font color='#5555FF'>&</font> img
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- loads the PNG image stored in this object into img
!*/</font>
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> image_type
<font color='#5555FF'>></font>
<font color='#0000FF'><u>void</u></font> <b><a name='load_png'></a>load_png</b> <font face='Lucida Console'>(</font>
image_type<font color='#5555FF'>&</font> image,
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> file_name
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- performs: png_loader(file_name).get_image(image);
!*/</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> image_type
<font color='#5555FF'>></font>
<font color='#0000FF'><u>void</u></font> <b><a name='load_png'></a>load_png</b> <font face='Lucida Console'>(</font>
image_type<font color='#5555FF'>&</font> image,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> image_buffer,
<font color='#0000FF'><u>size_t</u></font> buffer_size
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- performs: png_loader(image_buffer, buffer_size).get_image(image);
!*/</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> image_type
<font color='#5555FF'>></font>
<font color='#0000FF'><u>void</u></font> <b><a name='load_png'></a>load_png</b> <font face='Lucida Console'>(</font>
image_type<font color='#5555FF'>&</font> image,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> image_buffer,
<font color='#0000FF'><u>size_t</u></font> buffer_size
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- performs: png_loader((unsigned char*)image_buffer, buffer_size).get_image(image);
!*/</font>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_PNG_IMPORT_ABSTRACT
</font>
</pre></body></html> |