76 |
* </ul> |
* </ul> |
77 |
* |
* |
78 |
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no> |
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no> |
79 |
* @author C. Brian Jones (cbj@gnu.org) |
* @author C. Brian Jones <cbj@gnu.org> |
80 |
*/ |
*/ |
81 |
public abstract class ColorModel implements Transparency |
public abstract class ColorModel implements Transparency |
82 |
{ |
{ |
155 |
this.transferType = transferType; |
this.transferType = transferType; |
156 |
} |
} |
157 |
|
|
158 |
|
public void finalize() |
159 |
|
{ |
160 |
|
// Do nothing here. |
161 |
|
} |
162 |
|
|
163 |
/** |
/** |
164 |
* Returns the default color model which in Sun's case is an instance |
* Returns the default color model which in Sun's case is an instance |
165 |
* of <code>DirectColorModel</code>. |
* of <code>DirectColorModel</code>. |
231 |
* |
* |
232 |
* @see #getRed(int) |
* @see #getRed(int) |
233 |
*/ |
*/ |
234 |
public abstract int getGreen(int pixel); |
public abstract int getGreen(int pixel); |
235 |
|
|
236 |
/** |
/** |
237 |
* Converts pixel value to sRGB and extract blue int sample |
* Converts pixel value to sRGB and extract blue int sample |
389 |
*/ |
*/ |
390 |
public Object getDataElements(int rgb, Object pixel) |
public Object getDataElements(int rgb, Object pixel) |
391 |
{ |
{ |
392 |
// FIXME: implement |
// subclasses has to implement this method. |
393 |
throw new UnsupportedOperationException(); |
throw new UnsupportedOperationException(); |
394 |
} |
} |
395 |
|
|
408 |
* according to the color model. Each component sample is stored |
* according to the color model. Each component sample is stored |
409 |
* as a separate element in the array. |
* as a separate element in the array. |
410 |
*/ |
*/ |
411 |
public int[] getComponents(int pixel, int[] components, int offset) { |
public int[] getComponents(int pixel, int[] components, int offset) |
412 |
// FIXME: implement |
{ |
413 |
|
// subclasses has to implement this method. |
414 |
throw new UnsupportedOperationException(); |
throw new UnsupportedOperationException(); |
415 |
} |
} |
416 |
|
|
432 |
*/ |
*/ |
433 |
public int[] getComponents(Object pixel, int[] components, int offset) |
public int[] getComponents(Object pixel, int[] components, int offset) |
434 |
{ |
{ |
435 |
|
// subclasses has to implement this method. |
436 |
throw new UnsupportedOperationException(); |
throw new UnsupportedOperationException(); |
437 |
} |
} |
438 |
|
|
483 |
} |
} |
484 |
|
|
485 |
/** |
/** |
486 |
|
* Convert unnormalized components to normalized components. |
487 |
|
* |
488 |
|
* @since 1.4 |
489 |
|
*/ |
490 |
|
public float[] getNormalizedComponents (Object pixel, |
491 |
|
float[] normComponents, |
492 |
|
int normOffset) |
493 |
|
{ |
494 |
|
// subclasses has to implement this method. |
495 |
|
throw new UnsupportedOperationException(); |
496 |
|
} |
497 |
|
|
498 |
|
/** |
499 |
* Converts the unnormalized component samples from an array to a |
* Converts the unnormalized component samples from an array to a |
500 |
* pixel value. I.e. composes the pixel from component samples, but |
* pixel value. I.e. composes the pixel from component samples, but |
501 |
* does not perform any color conversion or scaling of the samples. |
* does not perform any color conversion or scaling of the samples. |
519 |
*/ |
*/ |
520 |
public int getDataElement(int[] components, int offset) |
public int getDataElement(int[] components, int offset) |
521 |
{ |
{ |
522 |
|
// subclasses has to implement this method. |
523 |
throw new UnsupportedOperationException(); |
throw new UnsupportedOperationException(); |
524 |
} |
} |
525 |
|
|
526 |
|
public int getDataElement (float[] components, int offset) |
527 |
|
{ |
528 |
|
// subclasses has to implement this method. |
529 |
|
throw new UnsupportedOperationException(); |
530 |
|
} |
531 |
|
|
532 |
public Object getDataElements(int[] components, int offset, Object obj) |
public Object getDataElements(int[] components, int offset, Object obj) |
533 |
{ |
{ |
534 |
|
// subclasses has to implement this method. |
535 |
throw new UnsupportedOperationException(); |
throw new UnsupportedOperationException(); |
536 |
} |
} |
537 |
|
|
538 |
|
public int getDataElements (float[] components, Object obj) |
539 |
|
{ |
540 |
|
// subclasses has to implement this method. |
541 |
|
throw new UnsupportedOperationException(); |
542 |
|
} |
543 |
|
|
544 |
public boolean equals(Object obj) |
public boolean equals(Object obj) |
545 |
{ |
{ |
546 |
if (!(obj instanceof ColorModel)) return false; |
if (!(obj instanceof ColorModel)) return false; |
628 |
return transferType; |
return transferType; |
629 |
} |
} |
630 |
|
|
|
public void finalize() |
|
|
{ |
|
|
} |
|
|
|
|
631 |
/** |
/** |
632 |
* Subclasses must override this method if it is possible for the |
* Subclasses must override this method if it is possible for the |
633 |
* color model to have an alpha channel. |
* color model to have an alpha channel. |