1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <title>TJCompressor</title>
6 <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
9 <script type="text/javascript"><!--
10 if (location.href.indexOf('is-external=true') == -1) {
11 parent.document.title="TJCompressor";
16 <div>JavaScript is disabled on your browser.</div>
18 <!-- ========= START OF TOP NAVBAR ======= -->
19 <div class="topNav"><a name="navbar_top">
21 </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
24 <ul class="navList" title="Navigation">
25 <li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li>
26 <li class="navBarCell1Rev">Class</li>
27 <li><a href="package-tree.html">Tree</a></li>
28 <li><a href="../../../deprecated-list.html">Deprecated</a></li>
29 <li><a href="../../../index-all.html">Index</a></li>
30 <li><a href="../../../help-doc.html">Help</a></li>
35 <li><a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li>
36 <li><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><span class="strong">Next Class</span></a></li>
39 <li><a href="../../../index.html?org/libjpegturbo/turbojpeg/TJCompressor.html" target="_top">Frames</a></li>
40 <li><a href="TJCompressor.html" target="_top">No Frames</a></li>
42 <ul class="navList" id="allclasses_navbar_top">
43 <li><a href="../../../allclasses-noframe.html">All Classes</a></li>
46 <script type="text/javascript"><!--
47 allClassesLink = document.getElementById("allclasses_navbar_top");
49 allClassesLink.style.display = "block";
52 allClassesLink.style.display = "none";
58 <ul class="subNavList">
59 <li>Summary: </li>
60 <li>Nested | </li>
61 <li>Field | </li>
62 <li><a href="#constructor_summary">Constr</a> | </li>
63 <li><a href="#method_summary">Method</a></li>
65 <ul class="subNavList">
66 <li>Detail: </li>
67 <li>Field | </li>
68 <li><a href="#constructor_detail">Constr</a> | </li>
69 <li><a href="#method_detail">Method</a></li>
72 <a name="skip-navbar_top">
75 <!-- ========= END OF TOP NAVBAR ========= -->
76 <!-- ======== START OF CLASS DATA ======== -->
78 <div class="subTitle">org.libjpegturbo.turbojpeg</div>
79 <h2 title="Class TJCompressor" class="title">Class TJCompressor</h2>
81 <div class="contentContainer">
82 <ul class="inheritance">
83 <li>java.lang.Object</li>
85 <ul class="inheritance">
86 <li>org.libjpegturbo.turbojpeg.TJCompressor</li>
90 <div class="description">
91 <ul class="blockList">
92 <li class="blockList">
95 <pre>public class <span class="strong">TJCompressor</span>
96 extends java.lang.Object</pre>
97 <div class="block">TurboJPEG compressor</div>
101 <div class="summary">
102 <ul class="blockList">
103 <li class="blockList">
104 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
105 <ul class="blockList">
106 <li class="blockList"><a name="constructor_summary">
109 <h3>Constructor Summary</h3>
110 <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
111 <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
113 <th class="colOne" scope="col">Constructor and Description</th>
115 <tr class="altColor">
116 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor()">TJCompressor</a></strong>()</code>
117 <div class="block">Create a TurboJPEG compressor instance.</div>
120 <tr class="rowColor">
121 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(java.awt.image.BufferedImage srcImage,
125 int height)</code>
126 <div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
127 source image stored in <code>srcImage</code> with the newly created
131 <tr class="altColor">
132 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(byte[] srcImage,
136 int pixelFormat)</code>
137 <div class="block"><strong>Deprecated.</strong>
138 <div class="block"><i>Use
139 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
143 <tr class="rowColor">
144 <td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(byte[] srcImage,
150 int pixelFormat)</code>
151 <div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
152 source image stored in <code>srcImage</code> with the newly created
159 <!-- ========== METHOD SUMMARY =========== -->
160 <ul class="blockList">
161 <li class="blockList"><a name="method_summary">
164 <h3>Method Summary</h3>
165 <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
166 <caption><span>Methods</span><span class="tabEnd"> </span></caption>
168 <th class="colFirst" scope="col">Modifier and Type</th>
169 <th class="colLast" scope="col">Method and Description</th>
171 <tr class="altColor">
172 <td class="colFirst"><code>void</code></td>
173 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#close()">close</a></strong>()</code>
174 <div class="block">Free the native structures associated with this compressor instance.</div>
177 <tr class="rowColor">
178 <td class="colFirst"><code>void</code></td>
179 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20byte[],%20int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
181 int flags)</code>
182 <div class="block"><strong>Deprecated.</strong>
183 <div class="block"><i>Use
184 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
185 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>compress(byte[], int)</code></a> instead.</i></div>
189 <tr class="altColor">
190 <td class="colFirst"><code>byte[]</code></td>
191 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
192 int flags)</code>
193 <div class="block"><strong>Deprecated.</strong>
194 <div class="block"><i>Use
195 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
196 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>compress(int)</code></a> instead.</i></div>
200 <tr class="rowColor">
201 <td class="colFirst"><code>void</code></td>
202 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress</a></strong>(byte[] dstBuf,
203 int flags)</code>
204 <div class="block">Compress the uncompressed source image associated with this compressor
205 instance and output a JPEG image to the given destination buffer.</div>
208 <tr class="altColor">
209 <td class="colFirst"><code>byte[]</code></td>
210 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress</a></strong>(int flags)</code>
211 <div class="block">Compress the uncompressed source image associated with this compressor
212 instance and return a buffer containing a JPEG image.</div>
215 <tr class="rowColor">
216 <td class="colFirst"><code>void</code></td>
217 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20byte[],%20int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
219 int flags)</code>
220 <div class="block"><strong>Deprecated.</strong>
221 <div class="block"><i>Use
222 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
223 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
227 <tr class="altColor">
228 <td class="colFirst"><code>byte[]</code></td>
229 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
230 int flags)</code>
231 <div class="block"><strong>Deprecated.</strong>
232 <div class="block"><i>Use
233 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
234 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
238 <tr class="rowColor">
239 <td class="colFirst"><code>void</code></td>
240 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)">encodeYUV</a></strong>(byte[] dstBuf,
241 int flags)</code>
242 <div class="block"><strong>Deprecated.</strong>
243 <div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
247 <tr class="altColor">
248 <td class="colFirst"><code>byte[]</code></td>
249 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">encodeYUV</a></strong>(int flags)</code>
250 <div class="block"><strong>Deprecated.</strong>
251 <div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
255 <tr class="rowColor">
256 <td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
257 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV</a></strong>(int[] strides,
258 int flags)</code>
259 <div class="block">Encode the uncompressed source image associated with this compressor
260 instance into separate Y, U (Cb), and V (Cr) image planes and return a
261 <code>YUVImage</code> instance containing the encoded image planes.</div>
264 <tr class="altColor">
265 <td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
266 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int pad,
267 int flags)</code>
268 <div class="block">Encode the uncompressed source image associated with this compressor
269 instance into a unified YUV planar image buffer and return a
270 <code>YUVImage</code> instance containing the encoded image.</div>
273 <tr class="rowColor">
274 <td class="colFirst"><code>void</code></td>
275 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
276 int flags)</code>
277 <div class="block">Encode the uncompressed source image associated with this compressor
278 instance into a YUV planar image and store it in the given
279 <code>YUVImage</code> instance.</div>
282 <tr class="altColor">
283 <td class="colFirst"><code>protected void</code></td>
284 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#finalize()">finalize</a></strong>()</code> </td>
286 <tr class="rowColor">
287 <td class="colFirst"><code>int</code></td>
288 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()">getCompressedSize</a></strong>()</code>
289 <div class="block">Returns the size of the image (in bytes) generated by the most recent
290 compress operation.</div>
293 <tr class="altColor">
294 <td class="colFirst"><code>void</code></td>
295 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</a></strong>(int quality)</code>
296 <div class="block">Set the JPEG image quality level for subsequent compress operations.</div>
299 <tr class="rowColor">
300 <td class="colFirst"><code>void</code></td>
301 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(java.awt.image.BufferedImage srcImage,
305 int height)</code>
306 <div class="block">Associate an uncompressed RGB or grayscale source image with this
307 compressor instance.</div>
310 <tr class="altColor">
311 <td class="colFirst"><code>void</code></td>
312 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(byte[] srcImage,
316 int pixelFormat)</code>
317 <div class="block"><strong>Deprecated.</strong>
318 <div class="block"><i>Use
319 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
323 <tr class="rowColor">
324 <td class="colFirst"><code>void</code></td>
325 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(byte[] srcImage,
331 int pixelFormat)</code>
332 <div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
333 compressor instance.</div>
336 <tr class="altColor">
337 <td class="colFirst"><code>void</code></td>
338 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.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>
339 <div class="block">Associate an uncompressed YUV planar source image with this compressor
343 <tr class="rowColor">
344 <td class="colFirst"><code>void</code></td>
345 <td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</a></strong>(int newSubsamp)</code>
346 <div class="block">Set the level of chrominance subsampling for subsequent compress/encode
351 <ul class="blockList">
352 <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
355 <h3>Methods inherited from class java.lang.Object</h3>
356 <code>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
363 <div class="details">
364 <ul class="blockList">
365 <li class="blockList">
366 <!-- ========= CONSTRUCTOR DETAIL ======== -->
367 <ul class="blockList">
368 <li class="blockList"><a name="constructor_detail">
371 <h3>Constructor Detail</h3>
372 <a name="TJCompressor()">
375 <ul class="blockList">
376 <li class="blockList">
377 <h4>TJCompressor</h4>
378 <pre>public TJCompressor()
379 throws java.lang.Exception</pre>
380 <div class="block">Create a TurboJPEG compressor instance.</div>
381 <dl><dt><span class="strong">Throws:</span></dt>
382 <dd><code>java.lang.Exception</code></dd></dl>
385 <a name="TJCompressor(byte[], int, int, int, int, int, int)">
388 <ul class="blockList">
389 <li class="blockList">
390 <h4>TJCompressor</h4>
391 <pre>public TJCompressor(byte[] srcImage,
397 int pixelFormat)
398 throws java.lang.Exception</pre>
399 <div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
400 source image stored in <code>srcImage</code> with the newly created
402 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pitch</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
403 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd>
404 <dt><span class="strong">Throws:</span></dt>
405 <dd><code>java.lang.Exception</code></dd></dl>
408 <a name="TJCompressor(byte[], int, int, int, int)">
411 <ul class="blockList">
412 <li class="blockList">
413 <h4>TJCompressor</h4>
415 public TJCompressor(byte[] srcImage,
419 int pixelFormat)
420 throws java.lang.Exception</pre>
421 <div class="block"><span class="strong">Deprecated.</span> <i>Use
422 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
423 <dl><dt><span class="strong">Throws:</span></dt>
424 <dd><code>java.lang.Exception</code></dd></dl>
427 <a name="TJCompressor(java.awt.image.BufferedImage, int, int, int, int)">
430 <ul class="blockListLast">
431 <li class="blockList">
432 <h4>TJCompressor</h4>
433 <pre>public TJCompressor(java.awt.image.BufferedImage srcImage,
438 throws java.lang.Exception</pre>
439 <div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
440 source image stored in <code>srcImage</code> with the newly created
442 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see
443 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see
444 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see
445 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see
446 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see
447 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd>
448 <dt><span class="strong">Throws:</span></dt>
449 <dd><code>java.lang.Exception</code></dd></dl>
454 <!-- ============ METHOD DETAIL ========== -->
455 <ul class="blockList">
456 <li class="blockList"><a name="method_detail">
459 <h3>Method Detail</h3>
460 <a name="setSourceImage(byte[], int, int, int, int, int, int)">
463 <ul class="blockList">
464 <li class="blockList">
465 <h4>setSourceImage</h4>
466 <pre>public void setSourceImage(byte[] srcImage,
472 int pixelFormat)
473 throws java.lang.Exception</pre>
474 <div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
475 compressor instance.</div>
476 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - image buffer containing RGB, grayscale, or CMYK pixels to
477 be compressed or encoded. This buffer is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
478 the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
479 the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
480 which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pitch</code> - bytes per line of the source image. Normally, this should be
481 <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
482 unpadded, but you can use this parameter to, for instance, specify that
483 the scanlines in the source image are padded to a 4-byte boundary or to
484 compress/encode a JPEG or YUV image from a region of a larger source
485 image. You can also be clever and use this parameter to skip lines, etc.
486 Setting this parameter to 0 is the equivalent of setting it to
487 <code>width * TJ.pixelSize(pixelFormat)</code>.</dd><dd><code>height</code> - height (in pixels) of the region in the source image from
488 which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
489 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd>
490 <dt><span class="strong">Throws:</span></dt>
491 <dd><code>java.lang.Exception</code></dd></dl>
494 <a name="setSourceImage(byte[], int, int, int, int)">
497 <ul class="blockList">
498 <li class="blockList">
499 <h4>setSourceImage</h4>
501 public void setSourceImage(byte[] srcImage,
505 int pixelFormat)
506 throws java.lang.Exception</pre>
507 <div class="block"><span class="strong">Deprecated.</span> <i>Use
508 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
509 <dl><dt><span class="strong">Throws:</span></dt>
510 <dd><code>java.lang.Exception</code></dd></dl>
513 <a name="setSourceImage(java.awt.image.BufferedImage, int, int, int, int)">
516 <ul class="blockList">
517 <li class="blockList">
518 <h4>setSourceImage</h4>
519 <pre>public void setSourceImage(java.awt.image.BufferedImage srcImage,
524 throws java.lang.Exception</pre>
525 <div class="block">Associate an uncompressed RGB or grayscale source image with this
526 compressor instance.</div>
527 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing RGB or
528 grayscale pixels to be compressed or encoded. This image is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
529 the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
530 the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
531 which the JPEG or YUV image should be compressed/encoded (0 = use the
532 width of the source image)</dd><dd><code>height</code> - height (in pixels) of the region in the source image from
533 which the JPEG or YUV image should be compressed/encoded (0 = use the
534 height of the source image)</dd>
535 <dt><span class="strong">Throws:</span></dt>
536 <dd><code>java.lang.Exception</code></dd></dl>
539 <a name="setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">
542 <ul class="blockList">
543 <li class="blockList">
544 <h4>setSourceImage</h4>
545 <pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)
546 throws java.lang.Exception</pre>
547 <div class="block">Associate an uncompressed YUV planar source image with this compressor
549 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed. This image is not
551 <dt><span class="strong">Throws:</span></dt>
552 <dd><code>java.lang.Exception</code></dd></dl>
555 <a name="setSubsamp(int)">
558 <ul class="blockList">
559 <li class="blockList">
561 <pre>public void setSubsamp(int newSubsamp)
562 throws java.lang.Exception</pre>
563 <div class="block">Set the level of chrominance subsampling for subsequent compress/encode
564 operations. When pixels are converted from RGB to YCbCr (see
565 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>) or from CMYK to YCCK (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>TJ.CS_YCCK</code></a>) as part
566 of the JPEG compression process, some of the Cb and Cr (chrominance)
567 components can be discarded or averaged together to produce a smaller
568 image with little perceptible loss of image clarity (the human eye is more
569 sensitive to small changes in brightness than to small changes in color.)
570 This is called "chrominance subsampling".
572 NOTE: This method has no effect when compressing a JPEG image from a YUV
573 planar source. In that case, the level of chrominance subsampling in
574 the JPEG image is determined by the source. Further, this method has no
575 effect when encoding to a pre-allocated <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. In
576 that case, the level of chrominance subsampling is determined by the
578 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>newSubsamp</code> - the level of chrominance subsampling to use in
579 subsequent compress/encode oeprations (one of
580 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
581 <dt><span class="strong">Throws:</span></dt>
582 <dd><code>java.lang.Exception</code></dd></dl>
585 <a name="setJPEGQuality(int)">
588 <ul class="blockList">
589 <li class="blockList">
590 <h4>setJPEGQuality</h4>
591 <pre>public void setJPEGQuality(int quality)
592 throws java.lang.Exception</pre>
593 <div class="block">Set the JPEG image quality level for subsequent compress operations.</div>
594 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>quality</code> - the new JPEG image quality level (1 to 100, 1 = worst,
596 <dt><span class="strong">Throws:</span></dt>
597 <dd><code>java.lang.Exception</code></dd></dl>
600 <a name="compress(byte[], int)">
603 <ul class="blockList">
604 <li class="blockList">
606 <pre>public void compress(byte[] dstBuf,
608 throws java.lang.Exception</pre>
609 <div class="block">Compress the uncompressed source image associated with this compressor
610 instance and output a JPEG image to the given destination buffer.</div>
611 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the JPEG image. Use
612 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for this buffer based on
613 the source image's width and height and the desired level of chrominance
614 subsampling.</dd><dd><code>flags</code> - the bitwise OR of one or more of
615 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
616 <dt><span class="strong">Throws:</span></dt>
617 <dd><code>java.lang.Exception</code></dd></dl>
620 <a name="compress(int)">
623 <ul class="blockList">
624 <li class="blockList">
626 <pre>public byte[] compress(int flags)
627 throws java.lang.Exception</pre>
628 <div class="block">Compress the uncompressed source image associated with this compressor
629 instance and return a buffer containing a JPEG image.</div>
630 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>flags</code> - the bitwise OR of one or more of
631 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
632 <dt><span class="strong">Returns:</span></dt><dd>a buffer containing a JPEG image. The length of this buffer will
633 not be equal to the size of the JPEG image. Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><code>getCompressedSize()</code></a> to obtain the size of the JPEG image.</dd>
634 <dt><span class="strong">Throws:</span></dt>
635 <dd><code>java.lang.Exception</code></dd></dl>
638 <a name="compress(java.awt.image.BufferedImage, byte[], int)">
641 <ul class="blockList">
642 <li class="blockList">
645 public void compress(java.awt.image.BufferedImage srcImage,
648 throws java.lang.Exception</pre>
649 <div class="block"><span class="strong">Deprecated.</span> <i>Use
650 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
651 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>compress(byte[], int)</code></a> instead.</i></div>
652 <dl><dt><span class="strong">Throws:</span></dt>
653 <dd><code>java.lang.Exception</code></dd></dl>
656 <a name="compress(java.awt.image.BufferedImage, int)">
659 <ul class="blockList">
660 <li class="blockList">
663 public byte[] compress(java.awt.image.BufferedImage srcImage,
665 throws java.lang.Exception</pre>
666 <div class="block"><span class="strong">Deprecated.</span> <i>Use
667 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
668 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>compress(int)</code></a> instead.</i></div>
669 <dl><dt><span class="strong">Throws:</span></dt>
670 <dd><code>java.lang.Exception</code></dd></dl>
673 <a name="encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">
676 <ul class="blockList">
677 <li class="blockList">
679 <pre>public void encodeYUV(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
681 throws java.lang.Exception</pre>
682 <div class="block">Encode the uncompressed source image associated with this compressor
683 instance into a YUV planar image and store it in the given
684 <code>YUVImage</code> instance. This method uses the accelerated color
685 conversion routines in TurboJPEG's underlying codec but does not execute
686 any of the other steps in the JPEG compression process. Encoding
687 CMYK source images to YUV is not supported.</div>
688 <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
689 image</dd><dd><code>flags</code> - the bitwise OR of one or more of
690 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
691 <dt><span class="strong">Throws:</span></dt>
692 <dd><code>java.lang.Exception</code></dd></dl>
695 <a name="encodeYUV(byte[], int)">
698 <ul class="blockList">
699 <li class="blockList">
702 public void encodeYUV(byte[] dstBuf,
704 throws java.lang.Exception</pre>
705 <div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
706 <dl><dt><span class="strong">Throws:</span></dt>
707 <dd><code>java.lang.Exception</code></dd></dl>
710 <a name="encodeYUV(int, int)">
713 <ul class="blockList">
714 <li class="blockList">
716 <pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int pad,
718 throws java.lang.Exception</pre>
719 <div class="block">Encode the uncompressed source image associated with this compressor
720 instance into a unified YUV planar image buffer and return a
721 <code>YUVImage</code> instance containing the encoded image. This method
722 uses the accelerated color conversion routines in TurboJPEG's underlying
723 codec but does not execute any of the other steps in the JPEG compression
724 process. Encoding CMYK source images to YUV is not supported.</div>
725 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>pad</code> - the width of each line in each plane of the YUV image will be
726 padded to the nearest multiple of this number of bytes (must be a power of
727 2.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
728 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
729 <dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
730 <dt><span class="strong">Throws:</span></dt>
731 <dd><code>java.lang.Exception</code></dd></dl>
734 <a name="encodeYUV(int[], int)">
737 <ul class="blockList">
738 <li class="blockList">
740 <pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int[] strides,
742 throws java.lang.Exception</pre>
743 <div class="block">Encode the uncompressed source image associated with this compressor
744 instance into separate Y, U (Cb), and V (Cr) image planes and return a
745 <code>YUVImage</code> instance containing the encoded image planes. This
746 method uses the accelerated color conversion routines in TurboJPEG's
747 underlying codec but does not execute any of the other steps in the JPEG
748 compression process. Encoding CMYK source images to YUV is not supported.</div>
749 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>strides</code> - an array of integers, each specifying the number of bytes
750 per line in the corresponding plane of the output image. Setting the
751 stride for any plane to 0 is the same as setting it to the component width
752 of the plane. If <code>strides</code> is null, then the strides for all
753 planes will be set to their respective component widths. You can adjust
754 the strides in order to add an arbitrary amount of line padding to each
755 plane.</dd><dd><code>flags</code> - the bitwise OR of one or more of
756 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
757 <dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
758 <dt><span class="strong">Throws:</span></dt>
759 <dd><code>java.lang.Exception</code></dd></dl>
762 <a name="encodeYUV(int)">
765 <ul class="blockList">
766 <li class="blockList">
769 public byte[] encodeYUV(int flags)
770 throws java.lang.Exception</pre>
771 <div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
772 <dl><dt><span class="strong">Throws:</span></dt>
773 <dd><code>java.lang.Exception</code></dd></dl>
776 <a name="encodeYUV(java.awt.image.BufferedImage, byte[], int)">
779 <ul class="blockList">
780 <li class="blockList">
783 public void encodeYUV(java.awt.image.BufferedImage srcImage,
786 throws java.lang.Exception</pre>
787 <div class="block"><span class="strong">Deprecated.</span> <i>Use
788 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
789 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
790 <dl><dt><span class="strong">Throws:</span></dt>
791 <dd><code>java.lang.Exception</code></dd></dl>
794 <a name="encodeYUV(java.awt.image.BufferedImage, int)">
797 <ul class="blockList">
798 <li class="blockList">
801 public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,
803 throws java.lang.Exception</pre>
804 <div class="block"><span class="strong">Deprecated.</span> <i>Use
805 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
806 <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
807 <dl><dt><span class="strong">Throws:</span></dt>
808 <dd><code>java.lang.Exception</code></dd></dl>
811 <a name="getCompressedSize()">
814 <ul class="blockList">
815 <li class="blockList">
816 <h4>getCompressedSize</h4>
817 <pre>public int getCompressedSize()</pre>
818 <div class="block">Returns the size of the image (in bytes) generated by the most recent
819 compress operation.</div>
820 <dl><dt><span class="strong">Returns:</span></dt><dd>the size of the image (in bytes) generated by the most recent
821 compress operation.</dd></dl>
827 <ul class="blockList">
828 <li class="blockList">
830 <pre>public void close()
831 throws java.lang.Exception</pre>
832 <div class="block">Free the native structures associated with this compressor instance.</div>
833 <dl><dt><span class="strong">Throws:</span></dt>
834 <dd><code>java.lang.Exception</code></dd></dl>
837 <a name="finalize()">
840 <ul class="blockListLast">
841 <li class="blockList">
843 <pre>protected void finalize()
844 throws java.lang.Throwable</pre>
846 <dt><strong>Overrides:</strong></dt>
847 <dd><code>finalize</code> in class <code>java.lang.Object</code></dd>
848 <dt><span class="strong">Throws:</span></dt>
849 <dd><code>java.lang.Throwable</code></dd></dl>
858 <!-- ========= END OF CLASS DATA ========= -->
859 <!-- ======= START OF BOTTOM NAVBAR ====== -->
860 <div class="bottomNav"><a name="navbar_bottom">
862 </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
865 <ul class="navList" title="Navigation">
866 <li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li>
867 <li class="navBarCell1Rev">Class</li>
868 <li><a href="package-tree.html">Tree</a></li>
869 <li><a href="../../../deprecated-list.html">Deprecated</a></li>
870 <li><a href="../../../index-all.html">Index</a></li>
871 <li><a href="../../../help-doc.html">Help</a></li>
876 <li><a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li>
877 <li><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><span class="strong">Next Class</span></a></li>
880 <li><a href="../../../index.html?org/libjpegturbo/turbojpeg/TJCompressor.html" target="_top">Frames</a></li>
881 <li><a href="TJCompressor.html" target="_top">No Frames</a></li>
883 <ul class="navList" id="allclasses_navbar_bottom">
884 <li><a href="../../../allclasses-noframe.html">All Classes</a></li>
887 <script type="text/javascript"><!--
888 allClassesLink = document.getElementById("allclasses_navbar_bottom");
890 allClassesLink.style.display = "block";
893 allClassesLink.style.display = "none";
899 <ul class="subNavList">
900 <li>Summary: </li>
901 <li>Nested | </li>
902 <li>Field | </li>
903 <li><a href="#constructor_summary">Constr</a> | </li>
904 <li><a href="#method_summary">Method</a></li>
906 <ul class="subNavList">
907 <li>Detail: </li>
908 <li>Field | </li>
909 <li><a href="#constructor_detail">Constr</a> | </li>
910 <li><a href="#method_detail">Method</a></li>
913 <a name="skip-navbar_bottom">
916 <!-- ======== END OF BOTTOM NAVBAR ======= -->