/[classpath]/classpath/java/awt/image/ComponentSampleModel.java
ViewVC logotype

Diff of /classpath/java/awt/image/ComponentSampleModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mkoch, Thu Sep 23 05:50:41 2004 UTC revision 1.5 by smarothy, Sat Nov 6 16:24:37 2004 UTC
# Line 265  public class ComponentSampleModel extend Line 265  public class ComponentSampleModel extend
265                }                }
266              return outUShort;              return outUShort;
267    
268              case DataBuffer.TYPE_SHORT:
269                DataBufferShort inShort = (DataBufferShort) data;
270                short[] outShort = (short[]) obj;
271                if (outShort == null) outShort = new short[numBands];
272                    
273                for (int b=0; b<numBands; b++)
274                  {
275                    int dOffset = totalBandDataOffsets[b];
276                    outShort[b] = inShort.getData(bankIndices[b])[dOffset];
277                  }
278                return outShort;
279    
280            case DataBuffer.TYPE_INT:            case DataBuffer.TYPE_INT:
281              DataBufferInt inInt = (DataBufferInt) data;              DataBufferInt inInt = (DataBufferInt) data;
282              int[] outInt = (int[]) obj;              int[] outInt = (int[]) obj;
# Line 276  public class ComponentSampleModel extend Line 288  public class ComponentSampleModel extend
288                  outInt[b] = inInt.getData(bankIndices[b])[dOffset];                  outInt[b] = inInt.getData(bankIndices[b])[dOffset];
289                }                }
290              return outInt;              return outInt;
291                    
292              // FIXME: Fill in the other possible types.            case DataBuffer.TYPE_FLOAT:
293                DataBufferFloat inFloat = (DataBufferFloat) data;
294                float[] outFloat = (float[]) obj;
295                if (outFloat == null) outFloat = new float[numBands];
296    
297                for (int b=0; b<numBands; b++)
298                  {
299                    int dOffset = totalBandDataOffsets[b];
300                    outFloat[b] = inFloat.getData(bankIndices[b])[dOffset];
301                  }
302                return outFloat;
303                
304              case DataBuffer.TYPE_DOUBLE:
305                DataBufferDouble inDouble = (DataBufferDouble) data;
306                double[] outDouble = (double[]) obj;
307                if (outDouble == null) outDouble = new double[numBands];
308    
309                for (int b=0; b<numBands; b++)
310                  {
311                    int dOffset = totalBandDataOffsets[b];
312                    outDouble[b] = inDouble.getData(bankIndices[b])[dOffset];
313                  }
314                return outDouble;
315                
316            default:            default:
317                throw new IllegalStateException("unknown transfer type " +                throw new IllegalStateException("unknown transfer type " +
318                                                getTransferType());                                                getTransferType());
# Line 449  public class ComponentSampleModel extend Line 484  public class ComponentSampleModel extend
484                        
485            return;            return;
486          }          }
487          case DataBuffer.TYPE_SHORT:
488            {
489              DataBufferShort out = (DataBufferShort) data;
490              short[] in = (short[]) obj;
491              
492              for (int b=0; b<numBands; b++)
493                out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
494              
495              return;
496            }
497        case DataBuffer.TYPE_INT:        case DataBuffer.TYPE_INT:
498          {          {
499            DataBufferInt out = (DataBufferInt) data;            DataBufferInt out = (DataBufferInt) data;
# Line 456  public class ComponentSampleModel extend Line 501  public class ComponentSampleModel extend
501                        
502            for (int b=0; b<numBands; b++)            for (int b=0; b<numBands; b++)
503              out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];              out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
504              
505              return;
506            }
507          case DataBuffer.TYPE_FLOAT:
508            {
509              DataBufferFloat out = (DataBufferFloat) data;
510              float[] in = (float[]) obj;
511              
512              for (int b=0; b<numBands; b++)
513                out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
514              
515              return;
516            }
517          case DataBuffer.TYPE_DOUBLE:
518            {
519              DataBufferDouble out = (DataBufferDouble) data;
520              double[] in = (double[]) obj;
521              
522              for (int b=0; b<numBands; b++)
523                out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
524                        
525            return;            return;
526          }          }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26