Changeset 4178


Ignore:
Timestamp:
07/09/08 14:09:35 (12 years ago)
Author:
melissa
Message:

Moved 16-bit lookup table support from IndexedColorModel to Index16ColorModel (closes #307).
32-bit lookup tables are no longer supported (they weren't really supported to begin with) and java.awt.image.IndexColorModel is now used for 8-bit support.

Location:
trunk/loci
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/ImageTools.java

    r4048 r4178  
    523523 
    524524    if (r.isIndexed()) { 
    525       IndexedColorModel model = null; 
     525      ColorModel model = null; 
    526526      if (pixelType == FormatTools.UINT8 || pixelType == FormatTools.INT8) { 
    527527        byte[][] table = r.get8BitLookupTable(); 
    528         model = new IndexedColorModel(8, table[0].length, table); 
     528        model = new IndexColorModel(8, table[0].length, 
     529          table[0], table[1], table[2]); 
    529530      } 
    530531      else if (pixelType == FormatTools.UINT16 || 
     
    532533      { 
    533534        short[][] table = r.get16BitLookupTable(); 
    534         model = new IndexedColorModel(16, table[0].length, table); 
     535        model = new Index16ColorModel(16, table[0].length, table); 
    535536      } 
    536537      if (model != null) { 
     
    18031804 
    18041805    BufferedImage result = null; 
    1805     if ((source.getColorModel() instanceof IndexedColorModel) || 
     1806    if ((source.getColorModel() instanceof Index16ColorModel) || 
    18061807      (source.getColorModel() instanceof IndexColorModel)) 
    18071808    { 
     
    19531954    if (indices.length > 1) return img; 
    19541955    if (getPixelType(img) == FormatTools.UINT8) { 
    1955       IndexedColorModel model = (IndexedColorModel) img.getColorModel(); 
     1956      IndexColorModel model = (IndexColorModel) img.getColorModel(); 
    19561957      byte[][] b = new byte[3][indices[0].length]; 
    19571958      for (int i=0; i<indices[0].length; i++) { 
     
    19631964    } 
    19641965    else if (getPixelType(img) == FormatTools.UINT16) { 
    1965       IndexedColorModel model = (IndexedColorModel) img.getColorModel(); 
     1966      Index16ColorModel model = (Index16ColorModel) img.getColorModel(); 
    19661967      short[][] s = new short[3][indices[0].length / 2]; 
    19671968      for (int i=0; i<s[0].length; i++) { 
  • trunk/loci/plugins/Util.java

    r4137 r4178  
    152152 
    153153    IndexColorModel cm = null; 
    154     IndexedColorModel model = null; 
     154    Index16ColorModel model = null; 
    155155    if (r.isIndexed()) { 
    156156      byte[][] byteTable = r.get8BitLookupTable(); 
     
    161161      //else { 
    162162      //  short[][] shortTable = r.get16BitLookupTable(); 
    163       //  model = new IndexedColorModel(16, shortTable[0].length, shortTable); 
     163      //  model = new Index16ColorModel(16, shortTable[0].length, shortTable); 
    164164      //} 
    165165    } 
Note: See TracChangeset for help on using the changeset viewer.