1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <title>TJDecompressor</title>
6 <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
9 <script type="text/javascript"><!--
11 if (location.href.indexOf('is-external=true') == -1) {
12 parent.document.title="TJDecompressor";
20 <div>JavaScript is disabled on your browser.</div>
22 <!-- ========= START OF TOP NAVBAR ======= -->
23 <div class="topNav"><a name="navbar_top">
25 </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
28 <ul class="navList" title="Navigation">
29 <li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li>
30 <li class="navBarCell1Rev">Class</li>
31 <li><a href="package-tree.html">Tree</a></li>
32 <li><a href="../../../deprecated-list.html">Deprecated</a></li>
33 <li><a href="../../../index-all.html">Index</a></li>
34 <li><a href="../../../help-doc.html">Help</a></li>
39 <li><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li>
40 <li><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Next Class</span></a></li>
43 <li><a href="../../../index.html?org/libjpegturbo/turbojpeg/TJDecompressor.html" target="_top">Frames</a></li>
44 <li><a href="TJDecompressor.html" target="_top">No Frames</a></li>
46 <ul class="navList" id="allclasses_navbar_top">
47 <li><a href="../../../allclasses-noframe.html">All Classes</a></li>
50 <script type="text/javascript"><!--
51 allClassesLink = document.getElementById("allclasses_navbar_top");
53 allClassesLink.style.display = "block";
56 allClassesLink.style.display = "none";
62 <ul class="subNavList">
63 <li>Summary: </li>
64 <li>Nested | </li>
65 <li><a href="#field_summary">Field</a> | </li>
66 <li><a href="#constructor_summary">Constr</a> | </li>
67 <li><a href="#method_summary">Method</a></li>
69 <ul class="subNavList">
70 <li>Detail: </li>
71 <li><a href="#field_detail">Field</a> | </li>
72 <li><a href="#constructor_detail">Constr</a> | </li>
73 <li><a href="#method_detail">Method</a></li>
76 <a name="skip-navbar_top">
79 <!-- ========= END OF TOP NAVBAR ========= -->
80 <!-- ======== START OF CLASS DATA ======== -->
82 <div class="subTitle">org.libjpegturbo.turbojpeg</div>
83 <h2 title="Class TJDecompressor" class="title">Class TJDecompressor</h2>
85 <div class="contentContainer">
86 <ul class="inheritance">
87 <li>java.lang.Object</li>
89 <ul class="inheritance">
90 <li>org.libjpegturbo.turbojpeg.TJDecompressor</li>
94 <div class="description">
95 <ul class="blockList">
96 <li class="blockList">
98 <dt>All Implemented Interfaces:</dt>
99 <dd>java.io.Closeable, java.lang.AutoCloseable</dd>
102 <dt>Direct Known Subclasses:</dt>
103 <dd><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dd>
107 <pre>public class <span class="strong">TJDecompressor</span>
108 extends java.lang.Object
109 implements java.io.Closeable</pre>
110 <div class="block">TurboJPEG decompressor</div>
114 <div class="summary">
115 <ul class="blockList">
116 <li class="blockList">
117 <!-- =========== FIELD SUMMARY =========== -->
118 <ul class="blockList">
119 <li class="blockList"><a name="field_summary">
122 <h3>Field Summary</h3>
123 <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
124 <caption><span>Fields</span><span class="tabEnd"> </span></caption>
126 <th class="colFirst" scope="col">Modifier and Type</th>
127 <th class="colLast" scope="col">Field and Description</th>
129 <tr class="altColor">
130 <td class="colFirst"><code>protected long</code></td>
131 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</a></strong></code> </td>
133 <tr class="rowColor">
134 <td class="colFirst"><code>protected byte[]</code></td>
135 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</a></strong></code> </td>
137 <tr class="altColor">
138 <td class="colFirst"><code>protected int</code></td>
139 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</a></strong></code> </td>
141 <tr class="rowColor">
142 <td class="colFirst"><code>protected int</code></td>
143 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</a></strong></code> </td>
145 <tr class="altColor">
146 <td class="colFirst"><code>protected int</code></td>
147 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</a></strong></code> </td>
149 <tr class="rowColor">
150 <td class="colFirst"><code>protected int</code></td>
151 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</a></strong></code> </td>
153 <tr class="altColor">
154 <td class="colFirst"><code>protected int</code></td>
155 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</a></strong></code> </td>
157 <tr class="rowColor">
158 <td class="colFirst"><code>protected <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
159 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></strong></code> </td>
164 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
165 <ul class="blockList">
166 <li class="blockList"><a name="constructor_summary">
169 <h3>Constructor Summary</h3>
170 <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
171 <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
173 <th class="colOne" scope="col">Constructor and Description</th>
175 <tr class="altColor">
176 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor()">TJDecompressor</a></strong>()</code>
177 <div class="block">Create a TurboJPEG decompresssor instance.</div>
180 <tr class="rowColor">
181 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor</a></strong>(byte[] jpegImage)</code>
182 <div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
183 image stored in <code>jpegImage</code> with the newly created instance.</div>
186 <tr class="altColor">
187 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor</a></strong>(byte[] jpegImage,
188 int imageSize)</code>
189 <div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
190 image of length <code>imageSize</code> bytes stored in
191 <code>jpegImage</code> with the newly created instance.</div>
194 <tr class="rowColor">
195 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)</code>
196 <div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
197 source image stored in <code>yuvImage</code> with the newly created
204 <!-- ========== METHOD SUMMARY =========== -->
205 <ul class="blockList">
206 <li class="blockList"><a name="method_summary">
209 <h3>Method Summary</h3>
210 <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
211 <caption><span>Methods</span><span class="tabEnd"> </span></caption>
213 <th class="colFirst" scope="col">Modifier and Type</th>
214 <th class="colLast" scope="col">Method and Description</th>
216 <tr class="altColor">
217 <td class="colFirst"><code>void</code></td>
218 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</a></strong>()</code>
219 <div class="block">Free the native structures associated with this decompressor instance.</div>
222 <tr class="rowColor">
223 <td class="colFirst"><code>void</code></td>
224 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress</a></strong>(java.awt.image.BufferedImage dstImage,
225 int flags)</code>
226 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
227 with this decompressor instance and output a decompressed/decoded image to
228 the given <code>BufferedImage</code> instance.</div>
231 <tr class="altColor">
232 <td class="colFirst"><code>void</code></td>
233 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(byte[] dstBuf,
234 int desiredWidth,
236 int desiredHeight,
237 int pixelFormat,
238 int flags)</code>
239 <div class="block"><strong>Deprecated.</strong>
240 <div class="block"><i>Use
241 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
245 <tr class="rowColor">
246 <td class="colFirst"><code>void</code></td>
247 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(byte[] dstBuf,
250 int desiredWidth,
252 int desiredHeight,
253 int pixelFormat,
254 int flags)</code>
255 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
256 with this decompressor instance and output a grayscale, RGB, or CMYK image
257 to the given destination buffer.</div>
260 <tr class="altColor">
261 <td class="colFirst"><code>void</code></td>
262 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(int[] dstBuf,
265 int desiredWidth,
267 int desiredHeight,
268 int pixelFormat,
269 int flags)</code>
270 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
271 with this decompressor instance and output a grayscale, RGB, or CMYK image
272 to the given destination buffer.</div>
275 <tr class="rowColor">
276 <td class="colFirst"><code>java.awt.image.BufferedImage</code></td>
277 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress</a></strong>(int desiredWidth,
278 int desiredHeight,
279 int bufferedImageType,
280 int flags)</code>
281 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
282 with this decompressor instance and return a <code>BufferedImage</code>
283 instance containing the decompressed/decoded image.</div>
286 <tr class="altColor">
287 <td class="colFirst"><code>byte[]</code></td>
288 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress</a></strong>(int desiredWidth,
290 int desiredHeight,
291 int pixelFormat,
292 int flags)</code>
293 <div class="block">Decompress the JPEG source image associated with this decompressor
294 instance and return a buffer containing the decompressed image.</div>
297 <tr class="rowColor">
298 <td class="colFirst"><code>void</code></td>
299 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">decompressToYUV</a></strong>(byte[] dstBuf,
300 int flags)</code>
301 <div class="block"><strong>Deprecated.</strong>
302 <div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
306 <tr class="altColor">
307 <td class="colFirst"><code>byte[]</code></td>
308 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a></strong>(int flags)</code>
309 <div class="block"><strong>Deprecated.</strong>
310 <div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
314 <tr class="rowColor">
315 <td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
316 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int[],%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
318 int desiredHeight,
319 int flags)</code>
320 <div class="block">Decompress the JPEG source image associated with this decompressor
321 instance into a set of Y, U (Cb), and V (Cr) image planes and return a
322 <code>YUVImage</code> instance containing the decompressed image planes.</div>
325 <tr class="altColor">
326 <td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
327 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
329 int desiredHeight,
330 int flags)</code>
331 <div class="block">Decompress the JPEG source image associated with this decompressor
332 instance into a unified YUV planar image buffer and return a
333 <code>YUVImage</code> instance containing the decompressed image.</div>
336 <tr class="rowColor">
337 <td class="colFirst"><code>void</code></td>
338 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
339 int flags)</code>
340 <div class="block">Decompress the JPEG source image associated with this decompressor
341 instance into a YUV planar image and store it in the given
342 <code>YUVImage</code> instance.</div>
345 <tr class="altColor">
346 <td class="colFirst"><code>protected void</code></td>
347 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</a></strong>()</code> </td>
349 <tr class="rowColor">
350 <td class="colFirst"><code>int</code></td>
351 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</a></strong>()</code>
352 <div class="block">Returns the colorspace used in the source image (JPEG or YUV) associated
353 with this decompressor instance.</div>
356 <tr class="altColor">
357 <td class="colFirst"><code>int</code></td>
358 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</a></strong>()</code>
359 <div class="block">Returns the height of the source image (JPEG or YUV) associated with this
360 decompressor instance.</div>
363 <tr class="rowColor">
364 <td class="colFirst"><code>byte[]</code></td>
365 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a></strong>()</code>
366 <div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
369 <tr class="altColor">
370 <td class="colFirst"><code>int</code></td>
371 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</a></strong>()</code>
372 <div class="block">Returns the size of the JPEG image (in bytes) associated with this
373 decompressor instance.</div>
376 <tr class="rowColor">
377 <td class="colFirst"><code>int</code></td>
378 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)">getScaledHeight</a></strong>(int desiredWidth,
379 int desiredHeight)</code>
380 <div class="block">Returns the height of the largest scaled-down image that the TurboJPEG
381 decompressor can generate without exceeding the desired image width and
385 <tr class="altColor">
386 <td class="colFirst"><code>int</code></td>
387 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)">getScaledWidth</a></strong>(int desiredWidth,
388 int desiredHeight)</code>
389 <div class="block">Returns the width of the largest scaled-down image that the TurboJPEG
390 decompressor can generate without exceeding the desired image width and
394 <tr class="rowColor">
395 <td class="colFirst"><code>int</code></td>
396 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</a></strong>()</code>
397 <div class="block">Returns the level of chrominance subsampling used in the source image
398 (JPEG or YUV) associated with this decompressor instance.</div>
401 <tr class="altColor">
402 <td class="colFirst"><code>int</code></td>
403 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</a></strong>()</code>
404 <div class="block">Returns the width of the source image (JPEG or YUV) associated with this
405 decompressor instance.</div>
408 <tr class="rowColor">
409 <td class="colFirst"><code>void</code></td>
410 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">setJPEGImage</a></strong>(byte[] jpegImage,
411 int imageSize)</code>
412 <div class="block"><strong>Deprecated.</strong>
413 <div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
417 <tr class="altColor">
418 <td class="colFirst"><code>void</code></td>
419 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage</a></strong>(byte[] jpegImage,
420 int imageSize)</code>
421 <div class="block">Associate the JPEG image or "abbreviated table specification" (AKA
422 "tables-only") datastream of length <code>imageSize</code> bytes stored in
423 <code>jpegImage</code> with this decompressor instance.</div>
426 <tr class="rowColor">
427 <td class="colFirst"><code>void</code></td>
428 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
429 <div class="block">Associate the specified YUV planar source image with this decompressor
434 <ul class="blockList">
435 <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
438 <h3>Methods inherited from class java.lang.Object</h3>
439 <code>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
446 <div class="details">
447 <ul class="blockList">
448 <li class="blockList">
449 <!-- ============ FIELD DETAIL =========== -->
450 <ul class="blockList">
451 <li class="blockList"><a name="field_detail">
454 <h3>Field Detail</h3>
458 <ul class="blockList">
459 <li class="blockList">
461 <pre>protected long handle</pre>
467 <ul class="blockList">
468 <li class="blockList">
470 <pre>protected byte[] jpegBuf</pre>
473 <a name="jpegBufSize">
476 <ul class="blockList">
477 <li class="blockList">
479 <pre>protected int jpegBufSize</pre>
485 <ul class="blockList">
486 <li class="blockList">
488 <pre>protected <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage</pre>
494 <ul class="blockList">
495 <li class="blockList">
497 <pre>protected int jpegWidth</pre>
500 <a name="jpegHeight">
503 <ul class="blockList">
504 <li class="blockList">
506 <pre>protected int jpegHeight</pre>
509 <a name="jpegSubsamp">
512 <ul class="blockList">
513 <li class="blockList">
515 <pre>protected int jpegSubsamp</pre>
518 <a name="jpegColorspace">
521 <ul class="blockListLast">
522 <li class="blockList">
523 <h4>jpegColorspace</h4>
524 <pre>protected int jpegColorspace</pre>
529 <!-- ========= CONSTRUCTOR DETAIL ======== -->
530 <ul class="blockList">
531 <li class="blockList"><a name="constructor_detail">
534 <h3>Constructor Detail</h3>
535 <a name="TJDecompressor()">
538 <ul class="blockList">
539 <li class="blockList">
540 <h4>TJDecompressor</h4>
541 <pre>public TJDecompressor()
542 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
543 <div class="block">Create a TurboJPEG decompresssor instance.</div>
544 <dl><dt><span class="strong">Throws:</span></dt>
545 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
548 <a name="TJDecompressor(byte[])">
551 <ul class="blockList">
552 <li class="blockList">
553 <h4>TJDecompressor</h4>
554 <pre>public TJDecompressor(byte[] jpegImage)
555 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
556 <div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
557 image stored in <code>jpegImage</code> with the newly created instance.</div>
558 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
559 be the length of the array.) This buffer is not modified.</dd>
560 <dt><span class="strong">Throws:</span></dt>
561 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
564 <a name="TJDecompressor(byte[], int)">
567 <ul class="blockList">
568 <li class="blockList">
569 <h4>TJDecompressor</h4>
570 <pre>public TJDecompressor(byte[] jpegImage,
572 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
573 <div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
574 image of length <code>imageSize</code> bytes stored in
575 <code>jpegImage</code> with the newly created instance.</div>
576 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
577 <dt><span class="strong">Throws:</span></dt>
578 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
581 <a name="TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">
584 <ul class="blockListLast">
585 <li class="blockList">
586 <h4>TJDecompressor</h4>
587 <pre>public TJDecompressor(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)
588 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
589 <div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
590 source image stored in <code>yuvImage</code> with the newly created
592 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar
593 image to be decoded. This image is not modified.</dd>
594 <dt><span class="strong">Throws:</span></dt>
595 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
600 <!-- ============ METHOD DETAIL ========== -->
601 <ul class="blockList">
602 <li class="blockList"><a name="method_detail">
605 <h3>Method Detail</h3>
606 <a name="setSourceImage(byte[], int)">
609 <ul class="blockList">
610 <li class="blockList">
611 <h4>setSourceImage</h4>
612 <pre>public void setSourceImage(byte[] jpegImage,
614 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
615 <div class="block">Associate the JPEG image or "abbreviated table specification" (AKA
616 "tables-only") datastream of length <code>imageSize</code> bytes stored in
617 <code>jpegImage</code> with this decompressor instance. If
618 <code>jpegImage</code> contains a JPEG image, then this image will be used
619 as the source image for subsequent decompress operations. Passing a
620 tables-only datastream to this method primes the decompressor with
621 quantization and Huffman tables that can be used when decompressing
622 subsequent "abbreviated image" datastreams. This is useful, for instance,
623 when decompressing video streams in which all frames share the same
624 quantization and Huffman tables.</div>
625 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG image or an "abbreviated table
626 specification" (AKA "tables-only") datastream. This buffer is not
627 modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
628 <dt><span class="strong">Throws:</span></dt>
629 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
632 <a name="setJPEGImage(byte[], int)">
635 <ul class="blockList">
636 <li class="blockList">
637 <h4>setJPEGImage</h4>
639 public void setJPEGImage(byte[] jpegImage,
641 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
642 <div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
643 <dl><dt><span class="strong">Throws:</span></dt>
644 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
647 <a name="setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">
650 <ul class="blockList">
651 <li class="blockList">
652 <h4>setSourceImage</h4>
653 <pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</pre>
654 <div class="block">Associate the specified YUV planar source image with this decompressor
655 instance. Subsequent decompress operations will decode this image into an
656 RGB or grayscale destination image.</div>
657 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar image to
658 be decoded. This image is not modified.</dd></dl>
661 <a name="getWidth()">
664 <ul class="blockList">
665 <li class="blockList">
667 <pre>public int getWidth()</pre>
668 <div class="block">Returns the width of the source image (JPEG or YUV) associated with this
669 decompressor instance.</div>
670 <dl><dt><span class="strong">Returns:</span></dt><dd>the width of the source image (JPEG or YUV) associated with this
671 decompressor instance.</dd></dl>
674 <a name="getHeight()">
677 <ul class="blockList">
678 <li class="blockList">
680 <pre>public int getHeight()</pre>
681 <div class="block">Returns the height of the source image (JPEG or YUV) associated with this
682 decompressor instance.</div>
683 <dl><dt><span class="strong">Returns:</span></dt><dd>the height of the source image (JPEG or YUV) associated with this
684 decompressor instance.</dd></dl>
687 <a name="getSubsamp()">
690 <ul class="blockList">
691 <li class="blockList">
693 <pre>public int getSubsamp()</pre>
694 <div class="block">Returns the level of chrominance subsampling used in the source image
695 (JPEG or YUV) associated with this decompressor instance. See
696 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>.</div>
697 <dl><dt><span class="strong">Returns:</span></dt><dd>the level of chrominance subsampling used in the source image
698 (JPEG or YUV) associated with this decompressor instance.</dd></dl>
701 <a name="getColorspace()">
704 <ul class="blockList">
705 <li class="blockList">
706 <h4>getColorspace</h4>
707 <pre>public int getColorspace()</pre>
708 <div class="block">Returns the colorspace used in the source image (JPEG or YUV) associated
709 with this decompressor instance. See <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_RGB"><code>TJ.CS_*</code></a>. If the
710 source image is YUV, then this always returns <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>.</div>
711 <dl><dt><span class="strong">Returns:</span></dt><dd>the colorspace used in the source image (JPEG or YUV) associated
712 with this decompressor instance.</dd></dl>
715 <a name="getJPEGBuf()">
718 <ul class="blockList">
719 <li class="blockList">
721 <pre>public byte[] getJPEGBuf()</pre>
722 <div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
723 <dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG image buffer associated with this decompressor instance.</dd></dl>
726 <a name="getJPEGSize()">
729 <ul class="blockList">
730 <li class="blockList">
732 <pre>public int getJPEGSize()</pre>
733 <div class="block">Returns the size of the JPEG image (in bytes) associated with this
734 decompressor instance.</div>
735 <dl><dt><span class="strong">Returns:</span></dt><dd>the size of the JPEG image (in bytes) associated with this
736 decompressor instance.</dd></dl>
739 <a name="getScaledWidth(int, int)">
742 <ul class="blockList">
743 <li class="blockList">
744 <h4>getScaledWidth</h4>
745 <pre>public int getScaledWidth(int desiredWidth,
746 int desiredHeight)</pre>
747 <div class="block">Returns the width of the largest scaled-down image that the TurboJPEG
748 decompressor can generate without exceeding the desired image width and
750 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
751 Setting this to 0 is the same as setting it to the width of the JPEG image
752 (in other words, the width will not be considered when determining the
753 scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
754 Setting this to 0 is the same as setting it to the height of the JPEG
755 image (in other words, the height will not be considered when determining
756 the scaled image size.)</dd>
757 <dt><span class="strong">Returns:</span></dt><dd>the width of the largest scaled-down image that the TurboJPEG
758 decompressor can generate without exceeding the desired image width and
762 <a name="getScaledHeight(int, int)">
765 <ul class="blockList">
766 <li class="blockList">
767 <h4>getScaledHeight</h4>
768 <pre>public int getScaledHeight(int desiredWidth,
769 int desiredHeight)</pre>
770 <div class="block">Returns the height of the largest scaled-down image that the TurboJPEG
771 decompressor can generate without exceeding the desired image width and
773 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
774 Setting this to 0 is the same as setting it to the width of the JPEG image
775 (in other words, the width will not be considered when determining the
776 scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
777 Setting this to 0 is the same as setting it to the height of the JPEG
778 image (in other words, the height will not be considered when determining
779 the scaled image size.)</dd>
780 <dt><span class="strong">Returns:</span></dt><dd>the height of the largest scaled-down image that the TurboJPEG
781 decompressor can generate without exceeding the desired image width and
785 <a name="decompress(byte[], int, int, int, int, int, int, int)">
788 <ul class="blockList">
789 <li class="blockList">
791 <pre>public void decompress(byte[] dstBuf,
794 int desiredWidth,
796 int desiredHeight,
797 int pixelFormat,
799 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
800 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
801 with this decompressor instance and output a grayscale, RGB, or CMYK image
802 to the given destination buffer.
804 NOTE: The output image is fully recoverable if this method throws a
805 non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
806 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
807 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
808 If the source image is a JPEG image, then this buffer should normally be
809 <code>pitch * scaledHeight</code> bytes in size, where
810 <code>scaledHeight</code> can be determined by calling <code>
811 scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
812 </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
813 source image is a YUV image, then this buffer should normally be
814 <code>pitch * height</code> bytes in size, where <code>height</code> is
815 the height of the YUV image. However, the buffer may also be larger than
816 the dimensions of the source image, in which case the <code>x</code>,
817 <code>y</code>, and <code>pitch</code> parameters can be used to specify
818 the region into which the source image should be decompressed/decoded.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
819 which the source image should be decompressed/decoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the destination image into
820 which the source image should be decompressed/decoded</dd><dd><code>desiredWidth</code> - If the source image is a JPEG image, then this
821 specifies the desired width (in pixels) of the decompressed image (or
822 image region.) If the desired destination image dimensions are different
823 than the source image dimensions, then TurboJPEG will use scaling in the
824 JPEG decompressor to generate the largest possible image that will fit
825 within the desired dimensions. Setting this to 0 is the same as setting
826 it to the width of the JPEG image (in other words, the width will not be
827 considered when determining the scaled image size.) This parameter is
828 ignored if the source image is a YUV image.</dd><dd><code>pitch</code> - bytes per line of the destination image. Normally, this
829 should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
830 the destination image is unpadded, but you can use this to, for instance,
831 pad each line of the destination image to a 4-byte boundary or to
832 decompress/decode the source image into a region of a larger image. NOTE:
833 if the source image is a JPEG image, then <code>scaledWidth</code> can be
834 determined by calling <code>
835 scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
836 </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
837 YUV image, then <code>scaledWidth</code> is the width of the YUV image.
838 Setting this parameter to 0 is the equivalent of setting it to
839 <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
840 specifies the desired height (in pixels) of the decompressed image (or
841 image region.) If the desired destination image dimensions are different
842 than the source image dimensions, then TurboJPEG will use scaling in the
843 JPEG decompressor to generate the largest possible image that will fit
844 within the desired dimensions. Setting this to 0 is the same as setting
845 it to the height of the JPEG image (in other words, the height will not be
846 considered when determining the scaled image size.) This parameter is
847 ignored if the source image is a YUV image.</dd><dd><code>pixelFormat</code> - pixel format of the decompressed/decoded image (one of
848 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
849 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
850 <dt><span class="strong">Throws:</span></dt>
851 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
854 <a name="decompress(byte[], int, int, int, int, int)">
857 <ul class="blockList">
858 <li class="blockList">
861 public void decompress(byte[] dstBuf,
862 int desiredWidth,
864 int desiredHeight,
865 int pixelFormat,
867 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
868 <div class="block"><span class="strong">Deprecated.</span> <i>Use
869 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
870 <dl><dt><span class="strong">Throws:</span></dt>
871 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
874 <a name="decompress(int, int, int, int, int)">
877 <ul class="blockList">
878 <li class="blockList">
880 <pre>public byte[] decompress(int desiredWidth,
882 int desiredHeight,
883 int pixelFormat,
885 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
886 <div class="block">Decompress the JPEG source image associated with this decompressor
887 instance and return a buffer containing the decompressed image.</div>
888 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
889 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
890 for description</dd><dd><code>pitch</code> - see
891 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
892 for description</dd><dd><code>desiredHeight</code> - see
893 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
894 for description</dd><dd><code>pixelFormat</code> - pixel format of the decompressed image (one of
895 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
896 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
897 <dt><span class="strong">Returns:</span></dt><dd>a buffer containing the decompressed image.</dd>
898 <dt><span class="strong">Throws:</span></dt>
899 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
902 <a name="decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">
905 <ul class="blockList">
906 <li class="blockList">
907 <h4>decompressToYUV</h4>
908 <pre>public void decompressToYUV(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
910 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
911 <div class="block">Decompress the JPEG source image associated with this decompressor
912 instance into a YUV planar image and store it in the given
913 <code>YUVImage</code> instance. This method performs JPEG decompression
914 but leaves out the color conversion step, so a planar YUV image is
915 generated instead of an RGB or grayscale image. This method cannot be
916 used to decompress JPEG source images with the CMYK or YCCK colorspace.
918 NOTE: The YUV planar output image is fully recoverable if this method
919 throws a non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
920 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
921 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the YUV planar
922 image. The level of subsampling specified in this <code>YUVImage</code>
923 instance must match that of the JPEG image, and the width and height
924 specified in the <code>YUVImage</code> instance must match one of the
925 scaled image sizes that TurboJPEG is capable of generating from the JPEG
926 source image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
927 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
928 <dt><span class="strong">Throws:</span></dt>
929 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
932 <a name="decompressToYUV(byte[], int)">
935 <ul class="blockList">
936 <li class="blockList">
937 <h4>decompressToYUV</h4>
939 public void decompressToYUV(byte[] dstBuf,
941 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
942 <div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
943 <dl><dt><span class="strong">Throws:</span></dt>
944 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
947 <a name="decompressToYUV(int, int[], int, int)">
950 <ul class="blockList">
951 <li class="blockList">
952 <h4>decompressToYUV</h4>
953 <pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> decompressToYUV(int desiredWidth,
955 int desiredHeight,
957 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
958 <div class="block">Decompress the JPEG source image associated with this decompressor
959 instance into a set of Y, U (Cb), and V (Cr) image planes and return a
960 <code>YUVImage</code> instance containing the decompressed image planes.
961 This method performs JPEG decompression but leaves out the color
962 conversion step, so a planar YUV image is generated instead of an RGB or
963 grayscale image. This method cannot be used to decompress JPEG source
964 images with the CMYK or YCCK colorspace.</div>
965 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
966 desired image dimensions are different than the dimensions of the JPEG
967 image being decompressed, then TurboJPEG will use scaling in the JPEG
968 decompressor to generate the largest possible image that will fit within
969 the desired dimensions. Setting this to 0 is the same as setting it to
970 the width of the JPEG image (in other words, the width will not be
971 considered when determining the scaled image size.)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
972 per line in the corresponding plane of the output image. Setting the
973 stride for any plane to 0 is the same as setting it to the scaled
974 component width of the plane. If <tt>strides</tt> is NULL, then the
975 strides for all planes will be set to their respective scaled component
976 widths. You can adjust the strides in order to add an arbitrary amount of
977 line padding to each plane.</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
978 desired image dimensions are different than the dimensions of the JPEG
979 image being decompressed, then TurboJPEG will use scaling in the JPEG
980 decompressor to generate the largest possible image that will fit within
981 the desired dimensions. Setting this to 0 is the same as setting it to
982 the height of the JPEG image (in other words, the height will not be
983 considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
984 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
985 <dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
986 <dt><span class="strong">Throws:</span></dt>
987 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
990 <a name="decompressToYUV(int, int, int, int)">
993 <ul class="blockList">
994 <li class="blockList">
995 <h4>decompressToYUV</h4>
996 <pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> decompressToYUV(int desiredWidth,
998 int desiredHeight,
1000 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1001 <div class="block">Decompress the JPEG source image associated with this decompressor
1002 instance into a unified YUV planar image buffer and return a
1003 <code>YUVImage</code> instance containing the decompressed image. This
1004 method performs JPEG decompression but leaves out the color conversion
1005 step, so a planar YUV image is generated instead of an RGB or grayscale
1006 image. This method cannot be used to decompress JPEG source images with
1007 the CMYK or YCCK colorspace.</div>
1008 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
1009 desired image dimensions are different than the dimensions of the JPEG
1010 image being decompressed, then TurboJPEG will use scaling in the JPEG
1011 decompressor to generate the largest possible image that will fit within
1012 the desired dimensions. Setting this to 0 is the same as setting it to
1013 the width of the JPEG image (in other words, the width will not be
1014 considered when determining the scaled image size.)</dd><dd><code>pad</code> - the width of each line in each plane of the YUV image will be
1015 padded to the nearest multiple of this number of bytes (must be a power of
1016 2.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
1017 desired image dimensions are different than the dimensions of the JPEG
1018 image being decompressed, then TurboJPEG will use scaling in the JPEG
1019 decompressor to generate the largest possible image that will fit within
1020 the desired dimensions. Setting this to 0 is the same as setting it to
1021 the height of the JPEG image (in other words, the height will not be
1022 considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
1023 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
1024 <dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
1025 <dt><span class="strong">Throws:</span></dt>
1026 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1029 <a name="decompressToYUV(int)">
1032 <ul class="blockList">
1033 <li class="blockList">
1034 <h4>decompressToYUV</h4>
1036 public byte[] decompressToYUV(int flags)
1037 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1038 <div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
1039 <dl><dt><span class="strong">Throws:</span></dt>
1040 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1043 <a name="decompress(int[], int, int, int, int, int, int, int)">
1046 <ul class="blockList">
1047 <li class="blockList">
1049 <pre>public void decompress(int[] dstBuf,
1052 int desiredWidth,
1054 int desiredHeight,
1055 int pixelFormat,
1057 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1058 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
1059 with this decompressor instance and output a grayscale, RGB, or CMYK image
1060 to the given destination buffer.
1062 NOTE: The output image is fully recoverable if this method throws a
1063 non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
1064 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
1065 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
1066 If the source image is a JPEG image, then this buffer should normally be
1067 <code>stride * scaledHeight</code> pixels in size, where
1068 <code>scaledHeight</code> can be determined by calling <code>
1069 scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
1070 </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
1071 source image is a YUV image, then this buffer should normally be
1072 <code>stride * height</code> pixels in size, where <code>height</code> is
1073 the height of the YUV image. However, the buffer may also be larger than
1074 the dimensions of the JPEG image, in which case the <code>x</code>,
1075 <code>y</code>, and <code>stride</code> parameters can be used to specify
1076 the region into which the source image should be decompressed.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
1077 which the source image should be decompressed/decoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the destination image into
1078 which the source image should be decompressed/decoded</dd><dd><code>desiredWidth</code> - If the source image is a JPEG image, then this
1079 specifies the desired width (in pixels) of the decompressed image (or
1080 image region.) If the desired destination image dimensions are different
1081 than the source image dimensions, then TurboJPEG will use scaling in the
1082 JPEG decompressor to generate the largest possible image that will fit
1083 within the desired dimensions. Setting this to 0 is the same as setting
1084 it to the width of the JPEG image (in other words, the width will not be
1085 considered when determining the scaled image size.) This parameter is
1086 ignored if the source image is a YUV image.</dd><dd><code>stride</code> - pixels per line of the destination image. Normally, this
1087 should be set to <code>scaledWidth</code>, but you can use this to, for
1088 instance, decompress the JPEG image into a region of a larger image.
1089 NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
1090 can be determined by calling <code>
1091 scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
1092 </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
1093 YUV image, then <code>scaledWidth</code> is the width of the YUV image.
1094 Setting this parameter to 0 is the equivalent of setting it to
1095 <code>scaledWidth</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
1096 specifies the desired height (in pixels) of the decompressed image (or
1097 image region.) If the desired destination image dimensions are different
1098 than the source image dimensions, then TurboJPEG will use scaling in the
1099 JPEG decompressor to generate the largest possible image that will fit
1100 within the desired dimensions. Setting this to 0 is the same as setting
1101 it to the height of the JPEG image (in other words, the height will not be
1102 considered when determining the scaled image size.) This parameter is
1103 ignored if the source image is a YUV image.</dd><dd><code>pixelFormat</code> - pixel format of the decompressed image (one of
1104 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
1105 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
1106 <dt><span class="strong">Throws:</span></dt>
1107 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1110 <a name="decompress(java.awt.image.BufferedImage, int)">
1113 <ul class="blockList">
1114 <li class="blockList">
1116 <pre>public void decompress(java.awt.image.BufferedImage dstImage,
1118 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1119 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
1120 with this decompressor instance and output a decompressed/decoded image to
1121 the given <code>BufferedImage</code> instance.
1123 NOTE: The output image is fully recoverable if this method throws a
1124 non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
1125 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
1126 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - a <code>BufferedImage</code> instance that will receive
1127 the decompressed/decoded image. If the source image is a JPEG image, then
1128 the width and height of the <code>BufferedImage</code> instance must match
1129 one of the scaled image sizes that TurboJPEG is capable of generating from
1130 the JPEG image. If the source image is a YUV image, then the width and
1131 height of the <code>BufferedImage</code> instance must match the width and
1132 height of the YUV image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
1133 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
1134 <dt><span class="strong">Throws:</span></dt>
1135 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1138 <a name="decompress(int, int, int, int)">
1141 <ul class="blockList">
1142 <li class="blockList">
1144 <pre>public java.awt.image.BufferedImage decompress(int desiredWidth,
1145 int desiredHeight,
1146 int bufferedImageType,
1148 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1149 <div class="block">Decompress the JPEG source image or decode the YUV source image associated
1150 with this decompressor instance and return a <code>BufferedImage</code>
1151 instance containing the decompressed/decoded image.</div>
1152 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
1153 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
1154 description</dd><dd><code>desiredHeight</code> - see
1155 <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
1156 description</dd><dd><code>bufferedImageType</code> - the image type of the <code>BufferedImage</code>
1157 instance that will be created (for instance,
1158 <code>BufferedImage.TYPE_INT_RGB</code>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
1159 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
1160 <dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the
1161 decompressed/decoded image.</dd>
1162 <dt><span class="strong">Throws:</span></dt>
1163 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1169 <ul class="blockList">
1170 <li class="blockList">
1172 <pre>public void close()
1173 throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
1174 <div class="block">Free the native structures associated with this decompressor instance.</div>
1176 <dt><strong>Specified by:</strong></dt>
1177 <dd><code>close</code> in interface <code>java.io.Closeable</code></dd>
1178 <dt><strong>Specified by:</strong></dt>
1179 <dd><code>close</code> in interface <code>java.lang.AutoCloseable</code></dd>
1180 <dt><span class="strong">Throws:</span></dt>
1181 <dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
1184 <a name="finalize()">
1187 <ul class="blockListLast">
1188 <li class="blockList">
1190 <pre>protected void finalize()
1191 throws java.lang.Throwable</pre>
1193 <dt><strong>Overrides:</strong></dt>
1194 <dd><code>finalize</code> in class <code>java.lang.Object</code></dd>
1195 <dt><span class="strong">Throws:</span></dt>
1196 <dd><code>java.lang.Throwable</code></dd></dl>
1205 <!-- ========= END OF CLASS DATA ========= -->
1206 <!-- ======= START OF BOTTOM NAVBAR ====== -->
1207 <div class="bottomNav"><a name="navbar_bottom">
1209 </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
1212 <ul class="navList" title="Navigation">
1213 <li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li>
1214 <li class="navBarCell1Rev">Class</li>
1215 <li><a href="package-tree.html">Tree</a></li>
1216 <li><a href="../../../deprecated-list.html">Deprecated</a></li>
1217 <li><a href="../../../index-all.html">Index</a></li>
1218 <li><a href="../../../help-doc.html">Help</a></li>
1221 <div class="subNav">
1222 <ul class="navList">
1223 <li><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li>
1224 <li><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Next Class</span></a></li>
1226 <ul class="navList">
1227 <li><a href="../../../index.html?org/libjpegturbo/turbojpeg/TJDecompressor.html" target="_top">Frames</a></li>
1228 <li><a href="TJDecompressor.html" target="_top">No Frames</a></li>
1230 <ul class="navList" id="allclasses_navbar_bottom">
1231 <li><a href="../../../allclasses-noframe.html">All Classes</a></li>
1234 <script type="text/javascript"><!--
1235 allClassesLink = document.getElementById("allclasses_navbar_bottom");
1237 allClassesLink.style.display = "block";
1240 allClassesLink.style.display = "none";
1246 <ul class="subNavList">
1247 <li>Summary: </li>
1248 <li>Nested | </li>
1249 <li><a href="#field_summary">Field</a> | </li>
1250 <li><a href="#constructor_summary">Constr</a> | </li>
1251 <li><a href="#method_summary">Method</a></li>
1253 <ul class="subNavList">
1254 <li>Detail: </li>
1255 <li><a href="#field_detail">Field</a> | </li>
1256 <li><a href="#constructor_detail">Constr</a> | </li>
1257 <li><a href="#method_detail">Method</a></li>
1260 <a name="skip-navbar_bottom">
1263 <!-- ======== END OF BOTTOM NAVBAR ======= -->