mirror of
https://github.com/libjpeg-turbo/libjpeg-turbo.git
synced 2026-01-18 21:41:20 +01:00
TJ/xform: Check crop region against dest. image
Lossless cropping is performed after other lossless transform operations, so the cropping region must be specified relative to the destination image dimensions and level of chrominance subsampling, not the source image dimensions and level of chrominance subsampling. More specifically, if the lossless transform operation swaps the X and Y axes, or if the image is converted to grayscale, then that changes the cropping region requirements.
This commit is contained in:
Binary file not shown.
@@ -932,7 +932,8 @@ extends java.lang.Object</pre>
|
||||
images can be decompressed into packed-pixel images, but they cannot be
|
||||
<ul>
|
||||
<li> decompressed into planar YUV images,
|
||||
<li> losslessly transformed if <a href="TJTransform.html#OPT_CROP"><code>TJTransform.OPT_CROP</code></a> is specified,
|
||||
<li> losslessly transformed if <a href="TJTransform.html#OPT_CROP"><code>TJTransform.OPT_CROP</code></a> is specified
|
||||
and <a href="TJTransform.html#OPT_GRAY"><code>TJTransform.OPT_GRAY</code></a> is not specified,
|
||||
or
|
||||
<li> partially decompressed using a cropping region.
|
||||
</ul></div>
|
||||
|
||||
@@ -818,9 +818,10 @@ extends java.awt.Rectangle</pre>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>x</code> - the left boundary of the cropping region. This must be evenly
|
||||
divisible by the iMCU width (see <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>)</dd>
|
||||
divisible by the iMCU width (see <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>)
|
||||
of the destination image.</dd>
|
||||
<dd><code>y</code> - the upper boundary of the cropping region. This must be evenly
|
||||
divisible by the iMCU height (see <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>)</dd>
|
||||
divisible by the iMCU height (see <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>) of the destination image.</dd>
|
||||
<dd><code>w</code> - the width of the cropping region. Setting this to 0 is the
|
||||
equivalent of setting it to (width of the source JPEG image -
|
||||
<code>x</code>).</dd>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -112,7 +112,8 @@ public final class TJ {
|
||||
* images can be decompressed into packed-pixel images, but they cannot be
|
||||
* <ul>
|
||||
* <li> decompressed into planar YUV images,
|
||||
* <li> losslessly transformed if {@link TJTransform#OPT_CROP} is specified,
|
||||
* <li> losslessly transformed if {@link TJTransform#OPT_CROP} is specified
|
||||
* and {@link TJTransform#OPT_GRAY} is not specified,
|
||||
* or
|
||||
* <li> partially decompressed using a cropping region.
|
||||
* </ul>
|
||||
|
||||
@@ -165,10 +165,11 @@ public class TJTransform extends Rectangle {
|
||||
*
|
||||
* @param x the left boundary of the cropping region. This must be evenly
|
||||
* divisible by the iMCU width (see {@link TJ#getMCUWidth TJ.getMCUWidth()})
|
||||
* of the destination image.
|
||||
*
|
||||
* @param y the upper boundary of the cropping region. This must be evenly
|
||||
* divisible by the iMCU height (see {@link TJ#getMCUHeight
|
||||
* TJ.getMCUHeight()})
|
||||
* TJ.getMCUHeight()}) of the destination image.
|
||||
*
|
||||
* @param w the width of the cropping region. Setting this to 0 is the
|
||||
* equivalent of setting it to (width of the source JPEG image -
|
||||
|
||||
Reference in New Issue
Block a user