Index: turbojpeg.h |
=================================================================== |
--- turbojpeg.h (revision 111873) |
+++ turbojpeg.h (working copy) |
@@ -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}; |
/** |
@@ -489,7 +517,7 @@ |
* size of your pre-allocated buffer. In any case, unless you have |
* set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon |
* return from this function, as it may have changed. |
- * @param jpegSize pointer to an unsigned long variable which holds the size of |
+ * @param jpegSize pointer to an unsigned long variable that holds the size of |
* the JPEG image buffer. If <tt>*jpegBuf</tt> points to a |
* pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the |
* size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the |
@@ -576,7 +604,7 @@ |
* @param height height (in pixels) of the source image |
* @param pixelFormat pixel format of the source image (see @ref TJPF |
* "Pixel formats".) |
- * @param dstBuf pointer to an image buffer which will receive the YUV image. |
+ * @param dstBuf pointer to an image buffer that will receive the YUV image. |
* Use #tjBufSizeYUV() to determine the appropriate size for this buffer |
* based on the image width, height, and level of chrominance |
* subsampling. |
@@ -608,11 +636,11 @@ |
* @param handle a handle to a TurboJPEG decompressor or transformer instance |
* @param jpegBuf pointer to a buffer containing a JPEG image |
* @param jpegSize size of the JPEG image (in bytes) |
- * @param width pointer to an integer variable which will receive the width (in |
+ * @param width pointer to an integer variable that will receive the width (in |
* pixels) of the JPEG image |
- * @param height pointer to an integer variable which will receive the height |
+ * @param height pointer to an integer variable that will receive the height |
* (in pixels) of the JPEG image |
- * @param jpegSubsamp pointer to an integer variable which will receive the |
+ * @param jpegSubsamp pointer to an integer variable that will receive the |
* level of chrominance subsampling used when compressing the JPEG image |
* (see @ref TJSAMP "Chrominance subsampling options".) |
* |
@@ -642,7 +670,7 @@ |
* @param handle a handle to a TurboJPEG decompressor or transformer instance |
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
* @param jpegSize size of the JPEG image (in bytes) |
- * @param dstBuf pointer to an image buffer which will receive the decompressed |
+ * @param dstBuf pointer to an image buffer that will receive the decompressed |
* image. This buffer should normally be <tt>pitch * scaledHeight</tt> |
* bytes in size, where <tt>scaledHeight</tt> can be determined by |
* calling #TJSCALED() with the JPEG image height and one of the scaling |
@@ -695,7 +723,7 @@ |
* @param handle a handle to a TurboJPEG decompressor or transformer instance |
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
* @param jpegSize size of the JPEG image (in bytes) |
- * @param dstBuf pointer to an image buffer which will receive the YUV image. |
+ * @param dstBuf pointer to an image buffer that will receive the YUV image. |
* Use #tjBufSizeYUV to determine the appropriate size for this buffer |
* based on the image width, height, and level of subsampling. |
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
@@ -752,7 +780,7 @@ |
* the size of your pre-allocated buffer. In any case, unless you have |
* set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt> |
* upon return from this function, as it may have changed. |
- * @param dstSizes pointer to an array of n unsigned long variables which will |
+ * @param dstSizes pointer to an array of n unsigned long variables that will |
* receive the actual sizes (in bytes) of each transformed JPEG image. |
* If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then |
* <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon |