1 package gov
.nasa
.worldwind
.formats
.nitfs
;
3 import gov
.nasa
.worldwind
.*;
7 Copyright (C) 2001, 2007 United States Government
8 as represented by the Administrator of the
9 National Aeronautics and Space Administration.
14 * @author Lado Garakanidze
15 * @version $Id: Cadrg2DdsCompress Apr 23, 2007 11:00:07 AM lado
17 class Cadrg2DdsCompress
extends AbstractRpf2DdsCompress
19 public DDSBlock4x4
compressDxt1Block4x4(NitfsImageBand imageBand
, byte[] pixelCodes
, boolean hasTransparentPixels
)
21 int[] pixels565
= new int[16];
22 Color
[] colors565
= new Color
[16];
23 for(int i
= 0; i
< pixelCodes
.length
; i
++ )
25 pixels565
[i
] = imageBand
.lookupR5G6B5( 0x00FF & pixelCodes
[i
] );
26 colors565
[i
] = DDSConverter
.getColor565( pixels565
[i
] );
29 int[] extremaIndices
= determineExtremeColors( colors565
);
31 if(pixels565
[extremaIndices
[0]] < pixels565
[extremaIndices
[1]])
33 int t
= extremaIndices
[0];
34 extremaIndices
[0] = extremaIndices
[1];
35 extremaIndices
[1] = t
;
38 return new DDSBlock4x4(
39 (short) pixels565
[extremaIndices
[0]],
40 (short) pixels565
[extremaIndices
[1]],
41 (int) DDSConverter
.computeBitMask(colors565
, extremaIndices
)