Changeset 11906

Show
Ignore:
Timestamp:
08/18/07 12:08:22 (1 year ago)
Author:
rouault
Message:

* Fix for bug #1751 : Adds a transparent color index for handling empty CADRG subblocks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/nitf/nitfdataset.cpp

    r11798 r11906  
    240240            sEntry.c2 = psBandInfo->pabyLUT[256 + iColor]; 
    241241            sEntry.c3 = psBandInfo->pabyLUT[512 + iColor]; 
    242             sEntry.c4 = 255; 
     242            sEntry.c4 = (psImage->bNoDataSet && psImage->nNoDataValue == iColor) ? 0 : 255; 
    243243 
    244244            poColorTable->SetColorEntry( iColor, &sEntry ); 
  • trunk/gdal/frmts/nitf/nitfimage.c

    r11904 r11906  
    772772    } 
    773773 
     774    /* Bug #1751 : Add a transparent color if they are none. Absent subblocks will be then transparent */ 
     775    if (psImage->bNoDataSet == FALSE && psImage->nBands == 1 && psImage->nBitsPerSample == 8) 
     776    { 
     777      NITFBandInfo *psBandInfo = psImage->pasBandInfo; 
     778      if (psBandInfo->nSignificantLUTEntries < 256-1) 
     779      { 
     780        psBandInfo->pabyLUT[0+psBandInfo->nSignificantLUTEntries] = 0; 
     781        psBandInfo->pabyLUT[256+psBandInfo->nSignificantLUTEntries] = 0; 
     782        psBandInfo->pabyLUT[512+psBandInfo->nSignificantLUTEntries] = 0; 
     783        psImage->bNoDataSet = TRUE; 
     784        psImage->nNoDataValue = psBandInfo->nSignificantLUTEntries; 
     785        psBandInfo->nSignificantLUTEntries ++; 
     786      } 
     787    } 
     788 
    774789/* -------------------------------------------------------------------- */ 
    775790/*  We override the coordinates found in IGEOLO in case a BLOCKA is     */