192 * int red = (array[i+0] & 0xff); 193 * int green = (array[i+1] & 0xff); 194 * int blue = (array[i+2] & 0xff); 195 * }</pre> 196 * 197 * @return a {@code PixelFormat<ByteBuffer>} describing the 198 * indicated pixel format 199 */ 200 public static PixelFormat<ByteBuffer> getByteRgbInstance() { 201 return ByteRgb.instance; 202 } 203 204 /** 205 * Creates a {@code PixelFormat} instance describing a pixel layout 206 * with the pixels stored as single bytes representing an index 207 * into the specified lookup table of <b>premultiplied</b> color 208 * values in the {@link Type#INT_ARGB_PRE INT_ARGB_PRE} format. 209 * <p> 210 * Pixels in this format can be decoded using the following sample code: 211 * <pre>{@code 212 * int pixel = array[rowstart + x] & 0xff; 213 * int argb = colors[pixel]; 214 * 215 * int alpha = ((argb >> 24) & 0xff); 216 * int red = ((argb >> 16) & 0xff); 217 * int green = ((argb >> 8) & 0xff); 218 * int blue = ((argb ) & 0xff); 219 * }</pre> 220 * 221 * @param colors an {@code int[]} array of 32-bit color values in 222 * the {@link Type#INT_ARGB_PRE INT_ARGB_PRE} format 223 * @return a {@code PixelFormat<ByteBuffer>} describing the indicated 224 * pixel format with the specified list of premultiplied colors 225 */ 226 public static PixelFormat<ByteBuffer> 227 createByteIndexedPremultipliedInstance(int colors[]) 228 { 229 return IndexedPixelFormat.createByte(colors, true); 230 } 231 232 /** 233 * Creates a {@code PixelFormat} instance describing a pixel layout 234 * with the pixels stored as single bytes representing an index 235 * into the specified lookup table of <b>non-premultiplied</b> color 236 * values in the {@link Type#INT_ARGB INT_ARGB} format. 237 * <p> 238 * Pixels in this format can be decoded using the following sample code: 239 * <pre>{@code 240 * int pixel = array[rowstart + x] & 0xff; 241 * int argb = colors[pixel]; 242 * 243 * int alpha = ((argb >> 24) & 0xff); 244 * int red = ((argb >> 16) & 0xff); 245 * int green = ((argb >> 8) & 0xff); 246 * int blue = ((argb ) & 0xff); 247 * }</pre> 248 * 249 * @param colors an {@code int[]} array of 32-bit color values in 250 * the {@link Type#INT_ARGB INT_ARGB} format 251 * @return a {@code PixelFormat<ByteBuffer>} describing the indicated 252 * pixel format with the specified list of non-premultiplied colors 253 */ 254 public static PixelFormat<ByteBuffer> 255 createByteIndexedInstance(int colors[]) 256 { 257 return IndexedPixelFormat.createByte(colors, false); 258 } 259 260 /** | 192 * int red = (array[i+0] & 0xff); 193 * int green = (array[i+1] & 0xff); 194 * int blue = (array[i+2] & 0xff); 195 * }</pre> 196 * 197 * @return a {@code PixelFormat<ByteBuffer>} describing the 198 * indicated pixel format 199 */ 200 public static PixelFormat<ByteBuffer> getByteRgbInstance() { 201 return ByteRgb.instance; 202 } 203 204 /** 205 * Creates a {@code PixelFormat} instance describing a pixel layout 206 * with the pixels stored as single bytes representing an index 207 * into the specified lookup table of <b>premultiplied</b> color 208 * values in the {@link Type#INT_ARGB_PRE INT_ARGB_PRE} format. 209 * <p> 210 * Pixels in this format can be decoded using the following sample code: 211 * <pre>{@code 212 * int pixel = array[rowstart + x] & 0xff; 213 * int argb = colors[pixel]; 214 * 215 * int alpha = ((argb >> 24) & 0xff); 216 * int red = ((argb >> 16) & 0xff); 217 * int green = ((argb >> 8) & 0xff); 218 * int blue = ((argb ) & 0xff); 219 * }</pre> 220 * 221 * @param colors an {@code int[]} array of 32-bit color values in 222 * the {@link Type#INT_ARGB_PRE INT_ARGB_PRE} format 223 * @return a {@code PixelFormat<ByteBuffer>} describing the indicated 224 * pixel format with the specified list of premultiplied colors 225 */ 226 public static PixelFormat<ByteBuffer> 227 createByteIndexedPremultipliedInstance(int colors[]) 228 { 229 return IndexedPixelFormat.createByte(colors, true); 230 } 231 232 /** 233 * Creates a {@code PixelFormat} instance describing a pixel layout 234 * with the pixels stored as single bytes representing an index 235 * into the specified lookup table of <b>non-premultiplied</b> color 236 * values in the {@link Type#INT_ARGB INT_ARGB} format. 237 * <p> 238 * Pixels in this format can be decoded using the following sample code: 239 * <pre>{@code 240 * int pixel = array[rowstart + x] & 0xff; 241 * int argb = colors[pixel]; 242 * 243 * int alpha = ((argb >> 24) & 0xff); 244 * int red = ((argb >> 16) & 0xff); 245 * int green = ((argb >> 8) & 0xff); 246 * int blue = ((argb ) & 0xff); 247 * }</pre> 248 * 249 * @param colors an {@code int[]} array of 32-bit color values in 250 * the {@link Type#INT_ARGB INT_ARGB} format 251 * @return a {@code PixelFormat<ByteBuffer>} describing the indicated 252 * pixel format with the specified list of non-premultiplied colors 253 */ 254 public static PixelFormat<ByteBuffer> 255 createByteIndexedInstance(int colors[]) 256 { 257 return IndexedPixelFormat.createByte(colors, false); 258 } 259 260 /** |