Added new alpha channel colorspace constants/pixel formats, so applications can specify that they need the unused byte in a 4-component RGB output buffer set to 0xFF when decompressing.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@732 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 0776105..083a0a4 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -14,6 +14,11 @@
 [3] Added a compile-time macro (LIBJPEG_TURBO_VERSION) that can be used to
 check the version of libjpeg-turbo against which an application was compiled.
 
+[4] Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API)
+and pixel formats (TurboJPEG API), which allow applications to specify that,
+when decompressing to a 4-component RGB buffer, the unused byte should be set
+to 0xFF so that it can be interpreted as an opaque alpha channel.
+
 
 1.1.90 (1.2 beta1)
 ==================
diff --git a/README-turbo.txt b/README-turbo.txt
index b1ed218..8b18d4c 100755
--- a/README-turbo.txt
+++ b/README-turbo.txt
@@ -210,7 +210,7 @@
 
 libjpeg-turbo includes extensions that allow JPEG images to be compressed
 directly from (and decompressed directly to) buffers that use BGR, BGRX,
-RGBX, XBGR, and XRGB pixel ordering.  This is implemented with six new
+RGBX, XBGR, and XRGB pixel ordering.  This is implemented with ten new
 colorspace constants:
 
   JCS_EXT_RGB   /* red/green/blue */
@@ -219,6 +219,10 @@
   JCS_EXT_BGRX  /* blue/green/red/x */
   JCS_EXT_XBGR  /* x/blue/green/red */
   JCS_EXT_XRGB  /* x/red/green/blue */
+  JCS_EXT_RGBA  /* red/green/blue/alpha */
+  JCS_EXT_BGRA  /* blue/green/red/alpha */
+  JCS_EXT_ABGR  /* alpha/blue/green/red */
+  JCS_EXT_ARGB  /* alpha/red/green/blue */
 
 Setting cinfo.in_color_space (compression) or cinfo.out_color_space
 (decompression) to one of these values will cause libjpeg-turbo to read the
@@ -233,6 +237,18 @@
 At run time, attempting to use these extensions with a version of libjpeg
 that doesn't support them will result in a "Bogus input colorspace" error.
 
+When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the
+X byte is undefined, and in order to ensure the best performance, libjpeg-turbo
+can set that byte to whatever value it wishes.  If an application expects the X
+byte to be used as an alpha channel, then it should use JCS_EXT_RGBA,
+JCS_EXT_BGRA, JCS_EXT_ABGR, or JCS_EXT_ARGB.  When these colorspace constants
+are used, the X byte is guaranteed to be 0xFF, which is interpreted as opaque.
+
+Your application can check for the existence of the alpha channel colorspace
+extensions at compile time with:
+
+  #ifdef JCS_ALPHA_EXTENSIONS
+
 =================================
 libjpeg v7 and v8 API/ABI support
 =================================
diff --git a/doc/html/annotated.html b/doc/html/annotated.html
index a089c5a..b7d3b54 100644
--- a/doc/html/annotated.html
+++ b/doc/html/annotated.html
@@ -81,7 +81,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/classes.html b/doc/html/classes.html
index bdc333f..e3c582f 100644
--- a/doc/html/classes.html
+++ b/doc/html/classes.html
@@ -80,7 +80,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/functions.html b/doc/html/functions.html
index 3363a21..a0e9d85 100644
--- a/doc/html/functions.html
+++ b/doc/html/functions.html
@@ -113,7 +113,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html
index 6ac28f0..f808a68 100644
--- a/doc/html/functions_vars.html
+++ b/doc/html/functions_vars.html
@@ -113,7 +113,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html
index 91835a6..0c48317 100644
--- a/doc/html/group___turbo_j_p_e_g.html
+++ b/doc/html/group___turbo_j_p_e_g.html
@@ -135,7 +135,12 @@
 <br/>
 &#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>, 
 <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12">TJPF_RGBA</a>, 
+<br/>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4">TJPF_BGRA</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081">TJPF_ABGR</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c">TJPF_ARGB</a>
 <br/>
  }</td></tr>
 <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel formats.  <a href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">More...</a><br/></td></tr>
@@ -537,24 +542,40 @@
 </td></tr>
 <tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a><!-- doxytag: member="TJPF_RGBX" ref="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01" args="" -->TJPF_RGBX</em>&nbsp;</td><td>
 <p>RGBX pixel format. </p>
-<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
 </td></tr>
 <tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a><!-- doxytag: member="TJPF_BGRX" ref="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8" args="" -->TJPF_BGRX</em>&nbsp;</td><td>
 <p>BGRX pixel format. </p>
-<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
 </td></tr>
 <tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a><!-- doxytag: member="TJPF_XBGR" ref="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af" args="" -->TJPF_XBGR</em>&nbsp;</td><td>
 <p>XBGR pixel format. </p>
-<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
 </td></tr>
 <tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a><!-- doxytag: member="TJPF_XRGB" ref="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84" args="" -->TJPF_XRGB</em>&nbsp;</td><td>
 <p>XRGB pixel format. </p>
-<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
 </td></tr>
 <tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a><!-- doxytag: member="TJPF_GRAY" ref="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a" args="" -->TJPF_GRAY</em>&nbsp;</td><td>
 <p>Grayscale pixel format. </p>
 <p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
 </td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12"></a><!-- doxytag: member="TJPF_RGBA" ref="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12" args="" -->TJPF_RGBA</em>&nbsp;</td><td>
+<p>RGBA pixel format. </p>
+<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4"></a><!-- doxytag: member="TJPF_BGRA" ref="ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4" args="" -->TJPF_BGRA</em>&nbsp;</td><td>
+<p>BGRA pixel format. </p>
+<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081"></a><!-- doxytag: member="TJPF_ABGR" ref="ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081" args="" -->TJPF_ABGR</em>&nbsp;</td><td>
+<p>ABGR pixel format. </p>
+<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c"></a><!-- doxytag: member="TJPF_ARGB" ref="ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c" args="" -->TJPF_ARGB</em>&nbsp;</td><td>
+<p>ARGB pixel format. </p>
+<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
+</td></tr>
 </table>
 </dd>
 </dl>
@@ -1536,7 +1557,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/index.html b/doc/html/index.html
index 9b11ce3..be0e810 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -69,7 +69,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/modules.html b/doc/html/modules.html
index d5a9df1..5277997 100644
--- a/doc/html/modules.html
+++ b/doc/html/modules.html
@@ -72,7 +72,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjregion.html b/doc/html/structtjregion.html
index 6b0730e..fd293fa 100644
--- a/doc/html/structtjregion.html
+++ b/doc/html/structtjregion.html
@@ -165,7 +165,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjscalingfactor.html b/doc/html/structtjscalingfactor.html
index b480caf..33f7c05 100644
--- a/doc/html/structtjscalingfactor.html
+++ b/doc/html/structtjscalingfactor.html
@@ -127,7 +127,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html
index 88746ab..39f9e47 100644
--- a/doc/html/structtjtransform.html
+++ b/doc/html/structtjtransform.html
@@ -191,7 +191,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 15 2011 06:54:38 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/java/TJUnitTest.java b/java/TJUnitTest.java
index b732930..557a85a 100644
--- a/java/TJUnitTest.java
+++ b/java/TJUnitTest.java
@@ -58,11 +58,12 @@
   };
 
   private final static String pixFormatStr[] = {
-    "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale"
+    "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale",
+    "RGBA", "BGRA", "ABGR", "ARGB"
   };
 
   private final static int alphaOffset[] = {
-    -1, -1, 3, 3, 0, 0, -1
+    -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0
   };
 
   private final static int _3byteFormats[] = {
@@ -112,12 +113,16 @@
         else
           return TJ.PF_RGBX;
       case BufferedImage.TYPE_INT_RGB:
-      case BufferedImage.TYPE_INT_ARGB:
-      case BufferedImage.TYPE_INT_ARGB_PRE:
         if(byteOrder == ByteOrder.BIG_ENDIAN)
           return TJ.PF_XRGB;
         else
           return TJ.PF_BGRX;
+      case BufferedImage.TYPE_INT_ARGB:
+      case BufferedImage.TYPE_INT_ARGB_PRE:
+        if(byteOrder == ByteOrder.BIG_ENDIAN)
+          return TJ.PF_ARGB;
+        else
+          return TJ.PF_BGRA;
     }
     return 0;
   }
@@ -769,6 +774,9 @@
           size = compTest(tjc, dstBuf, w, h, pf, baseName, subsamp, 100,
             flags);
           decompTest(tjd, dstBuf, size, w, h, pf, baseName, subsamp, flags);
+          if(pf >= TJ.PF_RGBX && pf <= TJ.PF_XRGB && !bi)
+            decompTest(tjd, dstBuf, size, w, h, pf + (TJ.PF_RGBA - TJ.PF_RGBX),
+              baseName, subsamp, flags);
         }
       }
     }
diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html
index 0932734..a2b0499 100644
--- a/java/doc/allclasses-frame.html
+++ b/java/doc/allclasses-frame.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 All Classes
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html
index 0d20a31..e3c96ca 100644
--- a/java/doc/allclasses-noframe.html
+++ b/java/doc/allclasses-noframe.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 All Classes
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html
index a1dc69c..667e3ef 100644
--- a/java/doc/constant-values.html
+++ b/java/doc/constant-values.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 Constant Field Values
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
@@ -140,7 +140,7 @@
 <A NAME="org.libjpegturbo.turbojpeg.TJ.NUMPF"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
 <CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
 <TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</A></CODE></TD>
-<TD ALIGN="right"><CODE>7</CODE></TD>
+<TD ALIGN="right"><CODE>11</CODE></TD>
 </TR>
 <TR BGCOLOR="white" CLASS="TableRowColor">
 <A NAME="org.libjpegturbo.turbojpeg.TJ.NUMSAMP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
@@ -149,12 +149,30 @@
 <TD ALIGN="right"><CODE>5</CODE></TD>
 </TR>
 <TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_ABGR"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</A></CODE></TD>
+<TD ALIGN="right"><CODE>9</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_ARGB"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</A></CODE></TD>
+<TD ALIGN="right"><CODE>10</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
 <A NAME="org.libjpegturbo.turbojpeg.TJ.PF_BGR"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
 <CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
 <TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</A></CODE></TD>
 <TD ALIGN="right"><CODE>1</CODE></TD>
 </TR>
 <TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_BGRA"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</A></CODE></TD>
+<TD ALIGN="right"><CODE>8</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
 <A NAME="org.libjpegturbo.turbojpeg.TJ.PF_BGRX"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
 <CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
 <TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</A></CODE></TD>
@@ -173,6 +191,12 @@
 <TD ALIGN="right"><CODE>0</CODE></TD>
 </TR>
 <TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_RGBA"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</A></CODE></TD>
+<TD ALIGN="right"><CODE>7</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
 <A NAME="org.libjpegturbo.turbojpeg.TJ.PF_RGBX"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
 <CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
 <TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</A></CODE></TD>
diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html
index 0e1ca19..8654476 100644
--- a/java/doc/deprecated-list.html
+++ b/java/doc/deprecated-list.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 Deprecated List
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html
index 94aadcc..9d609c3 100644
--- a/java/doc/help-doc.html
+++ b/java/doc/help-doc.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 API Help
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/index-all.html b/java/doc/index-all.html
index 38d328a..1589d6d 100644
--- a/java/doc/index-all.html
+++ b/java/doc/index-all.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 Index
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">
 
@@ -404,9 +404,18 @@
 <A NAME="_P_"><!-- --></A><H2>
 <B>P</B></H2>
 <DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR"><B>PF_ABGR</B></A> - 
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>ABGR pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB"><B>PF_ARGB</B></A> - 
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>ARGB pixel format.
 <DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_BGR"><B>PF_BGR</B></A> - 
 Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
 <DD>BGR pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA"><B>PF_BGRA</B></A> - 
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>BGRA pixel format.
 <DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX"><B>PF_BGRX</B></A> - 
 Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
 <DD>BGRX pixel format.
@@ -416,6 +425,9 @@
 <DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><B>PF_RGB</B></A> - 
 Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
 <DD>RGB pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA"><B>PF_RGBA</B></A> - 
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>RGBA pixel format.
 <DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX"><B>PF_RGBX</B></A> - 
 Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
 <DD>RGBX pixel format.
diff --git a/java/doc/index.html b/java/doc/index.html
index 7d77dc3..8e6f370 100644
--- a/java/doc/index.html
+++ b/java/doc/index.html
@@ -2,7 +2,7 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc on Thu Dec 15 07:00:40 CST 2011-->
+<!-- Generated by javadoc on Sun Dec 18 20:09:44 CST 2011-->
 <TITLE>
 Generated Documentation (Untitled)
 </TITLE>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJ.html b/java/doc/org/libjpegturbo/turbojpeg/TJ.html
index 756af3e..b3300e2 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJ.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJ.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJ
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
@@ -187,6 +187,22 @@
 <TR BGCOLOR="white" CLASS="TableRowColor">
 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 <CODE>static&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABGR pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ARGB pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static&nbsp;int</CODE></FONT></TD>
 <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</A></B></CODE>
 
 <BR>
@@ -195,6 +211,14 @@
 <TR BGCOLOR="white" CLASS="TableRowColor">
 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 <CODE>static&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BGRA pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static&nbsp;int</CODE></FONT></TD>
 <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</A></B></CODE>
 
 <BR>
@@ -219,6 +243,14 @@
 <TR BGCOLOR="white" CLASS="TableRowColor">
 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 <CODE>static&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RGBA pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static&nbsp;int</CODE></FONT></TD>
 <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</A></B></CODE>
 
 <BR>
@@ -538,7 +570,8 @@
 <DL>
 <DD>RGBX pixel format.  The red, green, and blue components in the image are
  stored in 4-byte pixels in the order R, G, B from lowest to highest byte
- address within each pixel.
+ address within each pixel.  The X component is ignored when compressing
+ and undefined when decompressing.
 <P>
 <DL>
 <DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_RGBX">Constant Field Values</A></DL>
@@ -552,7 +585,8 @@
 <DL>
 <DD>BGRX pixel format.  The red, green, and blue components in the image are
  stored in 4-byte pixels in the order B, G, R from lowest to highest byte
- address within each pixel.
+ address within each pixel.  The X component is ignored when compressing
+ and undefined when decompressing.
 <P>
 <DL>
 <DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_BGRX">Constant Field Values</A></DL>
@@ -566,7 +600,8 @@
 <DL>
 <DD>XBGR pixel format.  The red, green, and blue components in the image are
  stored in 4-byte pixels in the order R, G, B from highest to lowest byte
- address within each pixel.
+ address within each pixel.  The X component is ignored when compressing
+ and undefined when decompressing.
 <P>
 <DL>
 <DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_XBGR">Constant Field Values</A></DL>
@@ -580,7 +615,8 @@
 <DL>
 <DD>XRGB pixel format.  The red, green, and blue components in the image are
  stored in 4-byte pixels in the order B, G, R from highest to lowest byte
- address within each pixel.
+ address within each pixel.  The X component is ignored when compressing
+ and undefined when decompressing.
 <P>
 <DL>
 <DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_XRGB">Constant Field Values</A></DL>
@@ -600,6 +636,62 @@
 </DL>
 <HR>
 
+<A NAME="PF_RGBA"><!-- --></A><H3>
+PF_RGBA</H3>
+<PRE>
+public static final int <B>PF_RGBA</B></PRE>
+<DL>
+<DD>RGBA pixel format.  This is the same as <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX"><CODE>PF_RGBX</CODE></A>, except that when
+ decompressing, the X byte is guaranteed to be 0xFF, which can be
+ interpreted as an opaque alpha channel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_RGBA">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_BGRA"><!-- --></A><H3>
+PF_BGRA</H3>
+<PRE>
+public static final int <B>PF_BGRA</B></PRE>
+<DL>
+<DD>BGRA pixel format.  This is the same as <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX"><CODE>PF_BGRX</CODE></A>, except that when
+ decompressing, the X byte is guaranteed to be 0xFF, which can be
+ interpreted as an opaque alpha channel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_BGRA">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_ABGR"><!-- --></A><H3>
+PF_ABGR</H3>
+<PRE>
+public static final int <B>PF_ABGR</B></PRE>
+<DL>
+<DD>ABGR pixel format.  This is the same as <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR"><CODE>PF_XBGR</CODE></A>, except that when
+ decompressing, the X byte is guaranteed to be 0xFF, which can be
+ interpreted as an opaque alpha channel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_ABGR">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_ARGB"><!-- --></A><H3>
+PF_ARGB</H3>
+<PRE>
+public static final int <B>PF_ARGB</B></PRE>
+<DL>
+<DD>ARGB pixel format.  This is the same as <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB"><CODE>PF_XRGB</CODE></A>, except that when
+ decompressing, the X byte is guaranteed to be 0xFF, which can be
+ interpreted as an opaque alpha channel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_ARGB">Constant Field Values</A></DL>
+</DL>
+<HR>
+
 <A NAME="FLAG_BOTTOMUP"><!-- --></A><H3>
 FLAG_BOTTOMUP</H3>
 <PRE>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html
index de74d4f..ba5b1da 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJCompressor
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html
index e830e89..5a93ded 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJCustomFilter
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
index c34abac..8eabb59 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJDecompressor
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html
index febc69f..decf430 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJScalingFactor
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
index a4ff5b8..b207637 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJTransform
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html
index 75ddc3f..9e74a6e 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 TJTransformer
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-frame.html b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html
index a63781e..50ede9f 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/package-frame.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 org.libjpegturbo.turbojpeg
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html
index 55c74a3..d98f285 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 org.libjpegturbo.turbojpeg
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-tree.html b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html
index 30997a6..319c1eb 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/package-tree.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 org.libjpegturbo.turbojpeg Class Hierarchy
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html
index 37d8cd4..e3839ee 100644
--- a/java/doc/overview-tree.html
+++ b/java/doc/overview-tree.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 Class Hierarchy
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html
index 41175d6..39ec91f 100644
--- a/java/doc/serialized-form.html
+++ b/java/doc/serialized-form.html
@@ -2,12 +2,12 @@
 <!--NewPage-->
 <HTML>
 <HEAD>
-<!-- Generated by javadoc (build 1.6.0_29) on Thu Dec 15 07:00:40 CST 2011 -->
+<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
 <TITLE>
 Serialized Form
 </TITLE>
 
-<META NAME="date" CONTENT="2011-12-15">
+<META NAME="date" CONTENT="2011-12-18">
 
 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
 
diff --git a/java/org/libjpegturbo/turbojpeg/TJ.java b/java/org/libjpegturbo/turbojpeg/TJ.java
index cd22ee0..5e0c0b7 100644
--- a/java/org/libjpegturbo/turbojpeg/TJ.java
+++ b/java/org/libjpegturbo/turbojpeg/TJ.java
@@ -109,7 +109,7 @@
   /**
    * The number of pixel formats
    */
-  final public static int NUMPF    = 7;
+  final public static int NUMPF   = 11;
   /**
    * RGB pixel format.  The red, green, and blue components in the image are
    * stored in 3-byte pixels in the order R, G, B from lowest to highest byte
@@ -125,25 +125,29 @@
   /**
    * RGBX pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order R, G, B from lowest to highest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   final public static int PF_RGBX = 2;
   /**
    * BGRX pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order B, G, R from lowest to highest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   final public static int PF_BGRX = 3;
   /**
    * XBGR pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order R, G, B from highest to lowest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   final public static int PF_XBGR = 4;
   /**
    * XRGB pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order B, G, R from highest to lowest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   final public static int PF_XRGB = 5;
   /**
@@ -151,6 +155,30 @@
    * (brightness) level from 0 to 255.
    */
   final public static int PF_GRAY = 6;
+  /**
+   * RGBA pixel format.  This is the same as {@link #PF_RGBX}, except that when
+   * decompressing, the X byte is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  final public static int PF_RGBA = 7;
+  /**
+   * BGRA pixel format.  This is the same as {@link #PF_BGRX}, except that when
+   * decompressing, the X byte is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  final public static int PF_BGRA = 8;
+  /**
+   * ABGR pixel format.  This is the same as {@link #PF_XBGR}, except that when
+   * decompressing, the X byte is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  final public static int PF_ABGR = 9;
+  /**
+   * ARGB pixel format.  This is the same as {@link #PF_XRGB}, except that when
+   * decompressing, the X byte is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  final public static int PF_ARGB = 10;
 
 
   /**
@@ -167,7 +195,7 @@
   }
 
   final private static int pixelSize[] = {
-    3, 3, 4, 4, 4, 4, 1
+    3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4
   };
 
 
@@ -189,7 +217,7 @@
   }
 
   final private static int redOffset[] = {
-    0, 2, 0, 2, 3, 1, 0
+    0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1
   };
 
 
@@ -211,7 +239,7 @@
   }
 
   final private static int greenOffset[] = {
-    1, 1, 1, 1, 2, 2, 0
+    1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2
   };
 
 
@@ -233,7 +261,7 @@
   }
 
   final private static int blueOffset[] = {
-    2, 0, 2, 0, 1, 3, 0
+    2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3
   };
 
 
diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
index 184061b..de6cacc 100644
--- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
+++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
@@ -399,13 +399,18 @@
           pixelFormat = TJ.PF_RGBX;
         intPixels = true;  break;
       case BufferedImage.TYPE_INT_RGB:
-      case BufferedImage.TYPE_INT_ARGB:
-      case BufferedImage.TYPE_INT_ARGB_PRE:
         if(byteOrder == ByteOrder.BIG_ENDIAN)
           pixelFormat = TJ.PF_XRGB;
         else
           pixelFormat = TJ.PF_BGRX;
         intPixels = true;  break;
+      case BufferedImage.TYPE_INT_ARGB:
+      case BufferedImage.TYPE_INT_ARGB_PRE:
+        if(byteOrder == ByteOrder.BIG_ENDIAN)
+          pixelFormat = TJ.PF_ARGB;
+        else
+          pixelFormat = TJ.PF_BGRA;
+        intPixels = true;  break;
       default:
         throw new Exception("Unsupported BufferedImage format");
     }
diff --git a/java/org_libjpegturbo_turbojpeg_TJ.h b/java/org_libjpegturbo_turbojpeg_TJ.h
index 54479be..c892086 100644
--- a/java/org_libjpegturbo_turbojpeg_TJ.h
+++ b/java/org_libjpegturbo_turbojpeg_TJ.h
@@ -20,7 +20,7 @@
 #undef org_libjpegturbo_turbojpeg_TJ_SAMP_440
 #define org_libjpegturbo_turbojpeg_TJ_SAMP_440 4L
 #undef org_libjpegturbo_turbojpeg_TJ_NUMPF
-#define org_libjpegturbo_turbojpeg_TJ_NUMPF 7L
+#define org_libjpegturbo_turbojpeg_TJ_NUMPF 11L
 #undef org_libjpegturbo_turbojpeg_TJ_PF_RGB
 #define org_libjpegturbo_turbojpeg_TJ_PF_RGB 0L
 #undef org_libjpegturbo_turbojpeg_TJ_PF_BGR
@@ -35,6 +35,14 @@
 #define org_libjpegturbo_turbojpeg_TJ_PF_XRGB 5L
 #undef org_libjpegturbo_turbojpeg_TJ_PF_GRAY
 #define org_libjpegturbo_turbojpeg_TJ_PF_GRAY 6L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_RGBA
+#define org_libjpegturbo_turbojpeg_TJ_PF_RGBA 7L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_BGRA
+#define org_libjpegturbo_turbojpeg_TJ_PF_BGRA 8L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_ABGR
+#define org_libjpegturbo_turbojpeg_TJ_PF_ABGR 9L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_ARGB
+#define org_libjpegturbo_turbojpeg_TJ_PF_ARGB 10L
 #undef org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP
 #define org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP 2L
 #undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCEMMX
diff --git a/jccolor.c b/jccolor.c
index 12804f3..0d8910a 100644
--- a/jccolor.c
+++ b/jccolor.c
@@ -225,6 +225,7 @@
                                   num_rows);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       extrgbx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
                                    num_rows);
       break;
@@ -233,14 +234,17 @@
                                   num_rows);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       extbgrx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
                                    num_rows);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       extxbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
                                    num_rows);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       extxrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
                                    num_rows);
       break;
@@ -270,6 +274,7 @@
                                    num_rows);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       extrgbx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
                                     num_rows);
       break;
@@ -278,14 +283,17 @@
                                    num_rows);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       extbgrx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
                                     num_rows);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       extxbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
                                     num_rows);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       extxrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
                                     num_rows);
       break;
@@ -458,6 +466,10 @@
   case JCS_EXT_BGRX:
   case JCS_EXT_XBGR:
   case JCS_EXT_XRGB:
+  case JCS_EXT_RGBA:
+  case JCS_EXT_BGRA:
+  case JCS_EXT_ABGR:
+  case JCS_EXT_ARGB:
     if (cinfo->input_components != rgb_pixelsize[cinfo->in_color_space])
       ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
     break;
@@ -492,7 +504,11 @@
              cinfo->in_color_space == JCS_EXT_BGR ||
              cinfo->in_color_space == JCS_EXT_BGRX ||
              cinfo->in_color_space == JCS_EXT_XBGR ||
-             cinfo->in_color_space == JCS_EXT_XRGB) {
+             cinfo->in_color_space == JCS_EXT_XRGB ||
+             cinfo->in_color_space == JCS_EXT_RGBA ||
+             cinfo->in_color_space == JCS_EXT_BGRA ||
+             cinfo->in_color_space == JCS_EXT_ABGR ||
+             cinfo->in_color_space == JCS_EXT_ARGB) {
       if (jsimd_can_rgb_gray())
         cconvert->pub.color_convert = jsimd_rgb_gray_convert;
       else {
@@ -512,6 +528,10 @@
   case JCS_EXT_BGRX:
   case JCS_EXT_XBGR:
   case JCS_EXT_XRGB:
+  case JCS_EXT_RGBA:
+  case JCS_EXT_BGRA:
+  case JCS_EXT_ABGR:
+  case JCS_EXT_ARGB:
     if (cinfo->num_components != 3)
       ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
     if (cinfo->in_color_space == cinfo->jpeg_color_space &&
@@ -530,7 +550,11 @@
         cinfo->in_color_space == JCS_EXT_BGR ||
         cinfo->in_color_space == JCS_EXT_BGRX ||
         cinfo->in_color_space == JCS_EXT_XBGR ||
-        cinfo->in_color_space == JCS_EXT_XRGB) {
+        cinfo->in_color_space == JCS_EXT_XRGB ||
+        cinfo->in_color_space == JCS_EXT_RGBA ||
+        cinfo->in_color_space == JCS_EXT_BGRA ||
+        cinfo->in_color_space == JCS_EXT_ABGR ||
+        cinfo->in_color_space == JCS_EXT_ARGB) {
       if (jsimd_can_rgb_ycc())
         cconvert->pub.color_convert = jsimd_rgb_ycc_convert;
       else {
diff --git a/jcparam.c b/jcparam.c
index 27b5a03..557fdc9 100644
--- a/jcparam.c
+++ b/jcparam.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1991-1998, Thomas G. Lane.
  * Modified 2003-2008 by Guido Vollbeding.
- * Copyright (C) 2009-2010, D. R. Commander.
+ * Copyright (C) 2009-2011, D. R. Commander.
  * This file is part of the Independent JPEG Group's software.
  * For conditions of distribution and use, see the accompanying README file.
  *
@@ -398,6 +398,10 @@
   case JCS_EXT_BGRX:
   case JCS_EXT_XBGR:
   case JCS_EXT_XRGB:
+  case JCS_EXT_RGBA:
+  case JCS_EXT_BGRA:
+  case JCS_EXT_ABGR:
+  case JCS_EXT_ARGB:
     jpeg_set_colorspace(cinfo, JCS_YCbCr);
     break;
   case JCS_YCbCr:
diff --git a/jdcolor.c b/jdcolor.c
index 05d389a..a9a9220 100644
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -224,6 +224,7 @@
                                   num_rows);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
                                    num_rows);
       break;
@@ -232,14 +233,17 @@
                                   num_rows);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
                                    num_rows);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
                                    num_rows);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
                                    num_rows);
       break;
@@ -316,6 +320,7 @@
                                    num_rows);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
                                     num_rows);
       break;
@@ -324,14 +329,17 @@
                                    num_rows);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
                                     num_rows);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
                                     num_rows);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
                                     num_rows);
       break;
@@ -471,6 +479,10 @@
   case JCS_EXT_BGRX:
   case JCS_EXT_XBGR:
   case JCS_EXT_XRGB:
+  case JCS_EXT_RGBA:
+  case JCS_EXT_BGRA:
+  case JCS_EXT_ABGR:
+  case JCS_EXT_ARGB:
     cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
     if (cinfo->jpeg_color_space == JCS_YCbCr) {
       if (jsimd_can_ycc_rgb())
diff --git a/jdmaster.c b/jdmaster.c
index 14520da..c73ec02 100644
--- a/jdmaster.c
+++ b/jdmaster.c
@@ -2,7 +2,7 @@
  * jdmaster.c
  *
  * Copyright (C) 1991-1997, Thomas G. Lane.
- * Copyright (C) 2009-2010, D. R. Commander.
+ * Copyright (C) 2009-2011, D. R. Commander.
  * This file is part of the Independent JPEG Group's software.
  * For conditions of distribution and use, see the accompanying README file.
  *
@@ -57,7 +57,11 @@
       cinfo->out_color_space != JCS_EXT_BGR &&
       cinfo->out_color_space != JCS_EXT_BGRX &&
       cinfo->out_color_space != JCS_EXT_XBGR &&
-      cinfo->out_color_space != JCS_EXT_XRGB) ||
+      cinfo->out_color_space != JCS_EXT_XRGB &&
+      cinfo->out_color_space != JCS_EXT_RGBA &&
+      cinfo->out_color_space != JCS_EXT_BGRA &&
+      cinfo->out_color_space != JCS_EXT_ABGR &&
+      cinfo->out_color_space != JCS_EXT_ARGB) ||
       cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space])
     return FALSE;
   /* and it only handles 2h1v or 2h2v sampling ratios */
@@ -209,6 +213,10 @@
   case JCS_EXT_BGRX:
   case JCS_EXT_XBGR:
   case JCS_EXT_XRGB:
+  case JCS_EXT_RGBA:
+  case JCS_EXT_BGRA:
+  case JCS_EXT_ABGR:
+  case JCS_EXT_ARGB:
     cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
     break;
   case JCS_YCbCr:
diff --git a/jdmerge.c b/jdmerge.c
index c75497a..c813080 100644
--- a/jdmerge.c
+++ b/jdmerge.c
@@ -329,6 +329,7 @@
                                            output_buf);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       extrgbx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
@@ -337,14 +338,17 @@
                                            output_buf);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       extbgrx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       extxbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       extxrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
@@ -371,6 +375,7 @@
                                            output_buf);
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       extrgbx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
@@ -379,14 +384,17 @@
                                            output_buf);
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       extbgrx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       extxbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       extxrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
                                             output_buf);
       break;
diff --git a/jmorecfg.h b/jmorecfg.h
index 1448779..f22c4f3 100644
--- a/jmorecfg.h
+++ b/jmorecfg.h
@@ -2,7 +2,7 @@
  * jmorecfg.h
  *
  * Copyright (C) 1991-1997, Thomas G. Lane.
- * Copyright (C) 2009, D. R. Commander.
+ * Copyright (C) 2009, 2011, D. R. Commander.
  * This file is part of the Independent JPEG Group's software.
  * For conditions of distribution and use, see the accompanying README file.
  *
@@ -313,7 +313,7 @@
 #define RGB_BLUE	2	/* Offset of Blue */
 #define RGB_PIXELSIZE	3	/* JSAMPLEs per RGB scanline element */
 
-#define JPEG_NUMCS 12
+#define JPEG_NUMCS 16
 
 #define EXT_RGB_RED        0
 #define EXT_RGB_GREEN      1
@@ -347,22 +347,26 @@
 
 static const int rgb_red[JPEG_NUMCS] = {
   -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED,
-  EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED
+  EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED,
+  EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED
 };
 
 static const int rgb_green[JPEG_NUMCS] = {
   -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN,
-  EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN
+  EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN,
+  EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN
 };
 
 static const int rgb_blue[JPEG_NUMCS] = {
   -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE,
-  EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE
+  EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE,
+  EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE
 };
 
 static const int rgb_pixelsize[JPEG_NUMCS] = {
   -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE,
-  EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE
+  EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE,
+  EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE
 };
 
 /* Definitions for speed-related optimizations. */
diff --git a/jpeglib.h b/jpeglib.h
index cb3acaf..d19a3ef 100644
--- a/jpeglib.h
+++ b/jpeglib.h
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1991-1998, Thomas G. Lane.
  * Modified 2002-2009 by Guido Vollbeding.
- * Copyright (C) 2009-2010, D. R. Commander.
+ * Copyright (C) 2009-2011, D. R. Commander.
  * This file is part of the Independent JPEG Group's software.
  * For conditions of distribution and use, see the accompanying README file.
  *
@@ -211,12 +211,13 @@
 /* Known color spaces. */
 
 #define JCS_EXTENSIONS 1
+#define JCS_ALPHA_EXTENSIONS 1
 
 typedef enum {
 	JCS_UNKNOWN,		/* error/unspecified */
 	JCS_GRAYSCALE,		/* monochrome */
 	JCS_RGB,		/* red/green/blue as specified by the RGB_RED, RGB_GREEN,
-                 RGB_BLUE, and RGB_PIXELSIZE macros */
+				   RGB_BLUE, and RGB_PIXELSIZE macros */
 	JCS_YCbCr,		/* Y/Cb/Cr (also known as YUV) */
 	JCS_CMYK,		/* C/M/Y/K */
 	JCS_YCCK,		/* Y/Cb/Cr/K */
@@ -225,7 +226,18 @@
 	JCS_EXT_BGR,		/* blue/green/red */
 	JCS_EXT_BGRX,		/* blue/green/red/x */
 	JCS_EXT_XBGR,		/* x/blue/green/red */
-	JCS_EXT_XRGB		/* x/red/green/blue */
+	JCS_EXT_XRGB,		/* x/red/green/blue */
+	/* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX,
+	   JCS_EXT_XBGR, or JCS_EXT_XRGB during decompression, the X byte is
+	   undefined, and in order to ensure the best performance,
+	   libjpeg-turbo can set that byte to whatever value it wishes.  Use
+	   the following colorspace constants to ensure that the X byte is set
+	   to 0xFF, so that it can be interpreted as an opaque alpha
+	   channel. */
+	JCS_EXT_RGBA,		/* red/green/blue/alpha */
+	JCS_EXT_BGRA,		/* blue/green/red/alpha */
+	JCS_EXT_ABGR,		/* alpha/blue/green/red */
+	JCS_EXT_ARGB		/* alpha/red/green/blue */
 } J_COLOR_SPACE;
 
 /* DCT/IDCT algorithm options. */
diff --git a/simd/jsimd_arm.c b/simd/jsimd_arm.c
index a9d920c..5a095f2 100644
--- a/simd/jsimd_arm.c
+++ b/simd/jsimd_arm.c
@@ -189,18 +189,22 @@
       neonfct=jsimd_extrgb_ycc_convert_neon;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       neonfct=jsimd_extrgbx_ycc_convert_neon;
       break;
     case JCS_EXT_BGR:
       neonfct=jsimd_extbgr_ycc_convert_neon;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       neonfct=jsimd_extbgrx_ycc_convert_neon;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       neonfct=jsimd_extxbgr_ycc_convert_neon;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       neonfct=jsimd_extxrgb_ycc_convert_neon;
       break;
     default:
@@ -233,18 +237,22 @@
       neonfct=jsimd_ycc_extrgb_convert_neon;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       neonfct=jsimd_ycc_extrgbx_convert_neon;
       break;
     case JCS_EXT_BGR:
       neonfct=jsimd_ycc_extbgr_convert_neon;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       neonfct=jsimd_ycc_extbgrx_convert_neon;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       neonfct=jsimd_ycc_extxbgr_convert_neon;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       neonfct=jsimd_ycc_extxrgb_convert_neon;
       break;
   default:
diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c
index f77c5ef..120eb02 100644
--- a/simd/jsimd_i386.c
+++ b/simd/jsimd_i386.c
@@ -142,6 +142,7 @@
       mmxfct=jsimd_extrgb_ycc_convert_mmx;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_extrgbx_ycc_convert_sse2;
       mmxfct=jsimd_extrgbx_ycc_convert_mmx;
       break;
@@ -150,14 +151,17 @@
       mmxfct=jsimd_extbgr_ycc_convert_mmx;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_extbgrx_ycc_convert_sse2;
       mmxfct=jsimd_extbgrx_ycc_convert_mmx;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_extxbgr_ycc_convert_sse2;
       mmxfct=jsimd_extxbgr_ycc_convert_mmx;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_extxrgb_ycc_convert_sse2;
       mmxfct=jsimd_extxrgb_ycc_convert_mmx;
       break;
@@ -191,6 +195,7 @@
       mmxfct=jsimd_extrgb_gray_convert_mmx;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_extrgbx_gray_convert_sse2;
       mmxfct=jsimd_extrgbx_gray_convert_mmx;
       break;
@@ -199,14 +204,17 @@
       mmxfct=jsimd_extbgr_gray_convert_mmx;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_extbgrx_gray_convert_sse2;
       mmxfct=jsimd_extbgrx_gray_convert_mmx;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_extxbgr_gray_convert_sse2;
       mmxfct=jsimd_extxbgr_gray_convert_mmx;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_extxrgb_gray_convert_sse2;
       mmxfct=jsimd_extxrgb_gray_convert_mmx;
       break;
@@ -240,6 +248,7 @@
       mmxfct=jsimd_ycc_extrgb_convert_mmx;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_ycc_extrgbx_convert_sse2;
       mmxfct=jsimd_ycc_extrgbx_convert_mmx;
       break;
@@ -248,14 +257,17 @@
       mmxfct=jsimd_ycc_extbgr_convert_mmx;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_ycc_extbgrx_convert_sse2;
       mmxfct=jsimd_ycc_extbgrx_convert_mmx;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_ycc_extxbgr_convert_sse2;
       mmxfct=jsimd_ycc_extxbgr_convert_mmx;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_ycc_extxrgb_convert_sse2;
       mmxfct=jsimd_ycc_extxrgb_convert_mmx;
       break;
@@ -532,6 +544,7 @@
       mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
       mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx;
       break;
@@ -540,14 +553,17 @@
       mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
       mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
       mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
       mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx;
       break;
@@ -582,6 +598,7 @@
       mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
       mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx;
       break;
@@ -590,14 +607,17 @@
       mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
       mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
       mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
       mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx;
       break;
diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c
index 2951268..8d17db3 100644
--- a/simd/jsimd_x86_64.c
+++ b/simd/jsimd_x86_64.c
@@ -93,18 +93,22 @@
       sse2fct=jsimd_extrgb_ycc_convert_sse2;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_extrgbx_ycc_convert_sse2;
       break;
     case JCS_EXT_BGR:
       sse2fct=jsimd_extbgr_ycc_convert_sse2;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_extbgrx_ycc_convert_sse2;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_extxbgr_ycc_convert_sse2;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_extxrgb_ycc_convert_sse2;
       break;
     default:
@@ -128,18 +132,22 @@
       sse2fct=jsimd_extrgb_gray_convert_sse2;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_extrgbx_gray_convert_sse2;
       break;
     case JCS_EXT_BGR:
       sse2fct=jsimd_extbgr_gray_convert_sse2;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_extbgrx_gray_convert_sse2;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_extxbgr_gray_convert_sse2;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_extxrgb_gray_convert_sse2;
       break;
     default:
@@ -163,18 +171,22 @@
       sse2fct=jsimd_ycc_extrgb_convert_sse2;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_ycc_extrgbx_convert_sse2;
       break;
     case JCS_EXT_BGR:
       sse2fct=jsimd_ycc_extbgr_convert_sse2;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_ycc_extbgrx_convert_sse2;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_ycc_extxbgr_convert_sse2;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_ycc_extxrgb_convert_sse2;
       break;
     default:
@@ -373,18 +385,22 @@
       sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
       break;
     case JCS_EXT_BGR:
       sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
       break;
     default:
@@ -409,18 +425,22 @@
       sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
       break;
     case JCS_EXT_RGBX:
+    case JCS_EXT_RGBA:
       sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
       break;
     case JCS_EXT_BGR:
       sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2;
       break;
     case JCS_EXT_BGRX:
+    case JCS_EXT_BGRA:
       sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
       break;
     case JCS_EXT_XBGR:
+    case JCS_EXT_ABGR:
       sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
       break;
     case JCS_EXT_XRGB:
+    case JCS_EXT_ARGB:
       sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
       break;
     default:
diff --git a/tjunittest.c b/tjunittest.c
index 3a57347..d14ec52 100644
--- a/tjunittest.c
+++ b/tjunittest.c
@@ -65,10 +65,11 @@
 
 const char *pixFormatStr[TJ_NUMPF]=
 {
-	"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale"
+	"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale",
+	"RGBA", "BGRA", "ABGR", "ARGB"
 };
 
-const int alphaOffset[TJ_NUMPF] = {-1, -1, 3, 3, 0, 0, -1};
+const int alphaOffset[TJ_NUMPF] = {-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0};
 
 const int _3byteFormats[]={TJPF_RGB, TJPF_BGR};
 const int _4byteFormats[]={TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB};
@@ -76,7 +77,7 @@
 const int _onlyRGB[]={TJPF_RGB};
 
 enum {YUVENCODE=1, YUVDECODE};
-int yuv=0, alloc=0;
+int yuv=0, alloc=0, alpha=0;
 
 int exitStatus=0;
 #define bailout() {exitStatus=-1;  goto bailout;}
@@ -511,6 +512,9 @@
 				flags);
 			decompTest(dhandle, dstBuf, size, w, h, pf, basename, subsamp,
 				flags);
+			if(pf>=TJPF_RGBX && pf<=TJPF_XRGB)
+				decompTest(dhandle, dstBuf, size, w, h, pf+(TJPF_RGBA-TJPF_RGBX),
+					basename, subsamp, flags);
 		}
 	}
 
diff --git a/turbojpeg.c b/turbojpeg.c
index 9fc60ce..e27f0da 100644
--- a/turbojpeg.c
+++ b/turbojpeg.c
@@ -147,12 +147,16 @@
 		case TJPF_BGR:
 			cinfo->in_color_space=JCS_EXT_BGR;  break;
 		case TJPF_RGBX:
+		case TJPF_RGBA:
 			cinfo->in_color_space=JCS_EXT_RGBX;  break;
 		case TJPF_BGRX:
+		case TJPF_BGRA:
 			cinfo->in_color_space=JCS_EXT_BGRX;  break;
 		case TJPF_XRGB:
+		case TJPF_ARGB:
 			cinfo->in_color_space=JCS_EXT_XRGB;  break;
 		case TJPF_XBGR:
+		case TJPF_ABGR:
 			cinfo->in_color_space=JCS_EXT_XBGR;  break;
 		#else
 		case TJPF_RGB:
@@ -213,20 +217,28 @@
 			dinfo->out_color_space=JCS_EXT_XRGB;  break;
 		case TJPF_XBGR:
 			dinfo->out_color_space=JCS_EXT_XBGR;  break;
+		#if JCS_ALPHA_EXTENSIONS==1
+		case TJPF_RGBA:
+			dinfo->out_color_space=JCS_EXT_RGBA;  break;
+		case TJPF_BGRA:
+			dinfo->out_color_space=JCS_EXT_BGRA;  break;
+		case TJPF_ARGB:
+			dinfo->out_color_space=JCS_EXT_ARGB;  break;
+		case TJPF_ABGR:
+			dinfo->out_color_space=JCS_EXT_ABGR;  break;
+		#endif
 		#else
 		case TJPF_RGB:
 			if(RGB_RED==0 && RGB_GREEN==1 && RGB_BLUE==2 && RGB_PIXELSIZE==3)
 			{
 				dinfo->out_color_space=JCS_RGB;  break;
 			}
+		#endif
 		default:
 			_throw("Unsupported pixel format");
-		#endif
 	}
 
-	#if JCS_EXTENSIONS!=1
 	bailout:
-	#endif
 	return retval;
 }
 
diff --git a/turbojpeg.h b/turbojpeg.h
index 98997af..343788a 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -113,7 +113,7 @@
 /**
  * The number of pixel formats
  */
-#define TJ_NUMPF 7
+#define TJ_NUMPF 11
 
 /**
  * Pixel formats
@@ -135,32 +135,60 @@
   /**
    * RGBX pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order R, G, B from lowest to highest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   TJPF_RGBX,
   /**
    * BGRX pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order B, G, R from lowest to highest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   TJPF_BGRX,
   /**
    * XBGR pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order R, G, B from highest to lowest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   TJPF_XBGR,
   /**
    * XRGB pixel format.  The red, green, and blue components in the image are
    * stored in 4-byte pixels in the order B, G, R from highest to lowest byte
-   * address within each pixel.
+   * address within each pixel.  The X component is ignored when compressing
+   * and undefined when decompressing.
    */
   TJPF_XRGB,
   /**
    * Grayscale pixel format.  Each 1-byte pixel represents a luminance
    * (brightness) level from 0 to 255.
    */
-  TJPF_GRAY
+  TJPF_GRAY,
+  /**
+   * RGBA pixel format.  This is the same as @ref TJPF_RGBX, except that when
+   * decompressing, the X component is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  TJPF_RGBA,
+  /**
+   * BGRA pixel format.  This is the same as @ref TJPF_BGRX, except that when
+   * decompressing, the X component is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  TJPF_BGRA,
+  /**
+   * ABGR pixel format.  This is the same as @ref TJPF_XBGR, except that when
+   * decompressing, the X component is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  TJPF_ABGR,
+  /**
+   * ARGB pixel format.  This is the same as @ref TJPF_XRGB, except that when
+   * decompressing, the X component is guaranteed to be 0xFF, which can be
+   * interpreted as an opaque alpha channel.
+   */
+  TJPF_ARGB
 };
 
 /**
@@ -169,7 +197,7 @@
  * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
  * then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>.
  */
-static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0};
+static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1};
 /**
  * Green offset (in bytes) for a given pixel format.  This specifies the number
  * of bytes that the green component is offset from the start of the pixel.
@@ -177,19 +205,19 @@
  * <tt>char pixel[]</tt>, then the green component will be
  * <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>.
  */
-static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0};
+static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2};
 /**
  * Blue offset (in bytes) for a given pixel format.  This specifies the number
  * of bytes that the Blue component is offset from the start of the pixel.  For
  * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
  * then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>.
  */
-static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0};
+static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3};
 
 /**
  * Pixel size (in bytes) for a given pixel format.
  */
-static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1};
+static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4};
 
 
 /**