Revision 3577
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/GdalFile.java | ||
---|---|---|
209 | 209 |
} |
210 | 210 |
|
211 | 211 |
// Selecciona las bandas y los overviews necesarios |
212 |
//TODO:La banda de transparencia hay que comprobarla con GDALGetColorInterpretationName( |
|
213 |
//GDALGetRasterColorInterpretation(hBand)) ); cuando est? el nuevo jgdal |
|
212 | 214 |
bandR = getRasterBand(rBandNr); |
213 | 215 |
setDataType(bandR.getRasterDataType()); |
214 | 216 |
if (this.getRasterCount() > 1) { |
... | ... | |
336 | 338 |
g = bandG.readRaster(x, y, w, 1, w, 1, dataType); |
337 | 339 |
if (bandB != null) |
338 | 340 |
b = bandB.readRaster(x, y, w, 1, w, 1, dataType); |
341 |
|
|
342 |
//TODO:La banda de transparencia hay que comprobarla con GDALGetColorInterpretationName( |
|
343 |
//GDALGetRasterColorInterpretation(hBand)) ); cuando est? el nuevo jgdal |
|
339 | 344 |
if(getRasterCount() >= 4 && ext.equals("png")) |
340 | 345 |
a = bandA.readRaster(x, y, w, 1, w, 1, GDT_Byte); |
341 | 346 |
else{ |
... | ... | |
418 | 423 |
r = bandR.readRaster(x, y, w, h, w, h, GDT_Byte); |
419 | 424 |
g = bandG.readRaster(x, y, w, h, w, h, GDT_Byte); |
420 | 425 |
b = bandB.readRaster(x, y, w, h, w, h, GDT_Byte); |
426 |
|
|
427 |
//TODO:La banda de transparencia hay que comprobarla con GDALGetColorInterpretationName( |
|
428 |
//GDALGetRasterColorInterpretation(hBand)) ); cuando est? el nuevo jgdal |
|
421 | 429 |
if(getRasterCount() >= 4 && ext.equals("png")) |
422 | 430 |
a = bandA.readRaster(x, y, w, h, w, h, GDT_Byte); |
423 | 431 |
else{ |
... | ... | |
474 | 482 |
*/ |
475 | 483 |
public class GdalFile extends GeoRasterFile { |
476 | 484 |
public final static int BAND_HEIGHT = 64; |
477 |
protected GdalNative file = null;
|
|
485 |
public GdalNative file = null;
|
|
478 | 486 |
|
479 | 487 |
private Extent v = null; |
480 | 488 |
|
... | ... | |
740 | 748 |
int offset, int scansize, int origBand, int destBandFlag) { |
741 | 749 |
int [] line = new int[rgbArray.length]; |
742 | 750 |
image.getRGB(startX, startY, w, h, line, offset, scansize); |
751 |
|
|
743 | 752 |
if (origBand == 0 && destBandFlag == GeoRasterFile.RED_BAND) |
744 | 753 |
for (int i=0; i<line.length; i++) |
745 |
line[i] = (line[i] & 0x0000ffff) | (rgbArray[i] & 0xffff0000);
|
|
754 |
line[i] = (line[i] & 0xff00ffff) | (rgbArray[i] & 0x00ff0000);
|
|
746 | 755 |
else if (origBand == 1 && destBandFlag == GeoRasterFile.GREEN_BAND) |
747 | 756 |
for (int i=0; i<line.length; i++) |
748 |
line[i] = (line[i] & 0x00ff00ff) | (rgbArray[i] & 0xff00ff00);
|
|
757 |
line[i] = (line[i] & 0xffff00ff) | (rgbArray[i] & 0x0000ff00);
|
|
749 | 758 |
else if (origBand == 2 && destBandFlag == GeoRasterFile.BLUE_BAND) |
750 | 759 |
for (int i=0; i<line.length; i++) |
751 |
line[i] = (line[i] & 0x00ffff00) | (rgbArray[i] & 0xff0000ff);
|
|
760 |
line[i] = (line[i] & 0xffffff00) | (rgbArray[i] & 0x000000ff);
|
|
752 | 761 |
|
753 | 762 |
else if (origBand == 0 && destBandFlag == GeoRasterFile.GREEN_BAND) |
754 | 763 |
for (int i=0; i<line.length; i++) |
... | ... | |
813 | 822 |
if(width<=0)width=1; |
814 | 823 |
if(height<=0)height=1; |
815 | 824 |
|
816 |
pRGBArray = new int[width/**BAND_HEIGHT*/];
|
|
825 |
pRGBArray = new int[width]; |
|
817 | 826 |
try { |
818 | 827 |
setBand(RED_BAND, rBandNr); |
819 | 828 |
setBand(GREEN_BAND, gBandNr); |
820 | 829 |
setBand(BLUE_BAND, bBandNr); |
821 | 830 |
file.setAlpha(getAlpha()); |
831 |
|
|
822 | 832 |
if(img!=null){ |
823 | 833 |
for (line=0; line < height; line++) { |
824 | 834 |
file.readLineRGBA(pRGBArray); |
Also available in: Unified diff