diff options
author | Roman Kennke <roman@kennke.org> | 2006-11-13 15:04:22 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2006-11-13 15:04:22 +0000 |
commit | dcf721efe83fd1f784394ce5d0eabd006fb82c35 (patch) | |
tree | d3b007d09a3064519f0e84c66d2fa4eda6d7cf2b | |
parent | 4f2e151d9760dd10d67bbf7bb55453a349609497 (diff) | |
download | classpath-dcf721efe83fd1f784394ce5d0eabd006fb82c35.tar.gz |
2006-11-13 Roman Kennke <kennke@aicas.com>
* java/awt/image/IndexColorModel.java
(createCompatibleSampleModel): Implemented missing method.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | java/awt/image/IndexColorModel.java | 22 |
2 files changed, 26 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2006-11-13 Roman Kennke <kennke@aicas.com> + + * java/awt/image/IndexColorModel.java + (createCompatibleSampleModel): Implemented missing method. + 2006-11-11 Andreas Tobler <a.tobler@schweiz.org> * gnu/java/awt/peer/gtk/GtkImageConsumer.java (setPixels): Handle data diff --git a/java/awt/image/IndexColorModel.java b/java/awt/image/IndexColorModel.java index 701362d53..a16c01b69 100644 --- a/java/awt/image/IndexColorModel.java +++ b/java/awt/image/IndexColorModel.java @@ -710,5 +710,25 @@ public class IndexColorModel extends ColorModel transferType); cm.isAlphaPremultiplied = !(cm.isAlphaPremultiplied); return cm; - } + } + + /** + * Creates a {@link SampleModel} that is compatible to this color model. + * This will be a {@link MultiPixelPackedSampleModel} for bits/pixel of + * 1, 2 or 4, or a {@link ComponentColorModel} for the other cases. + * + * @param w the width of the sample model to create + * @param h the height of the sample model to create + * + * @return a compatible sample model + */ + public SampleModel createCompatibleSampleModel(int w, int h) + { + SampleModel sm; + if (pixel_bits == 1 || pixel_bits == 2 || pixel_bits == 4) + sm = new MultiPixelPackedSampleModel(transferType, w, h, pixel_bits); + else + sm = new ComponentSampleModel(transferType, w, h, 1, w, new int[]{0}); + return sm; + } } |