Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#1751 closed enhancement (fixed)

[PATCH] Adds a transparent color index for handling empty CADRG subblocks

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: 1.4.2
Severity: normal Keywords: CADRG nitf
Cc: warmerdam

Description

Currently, NITFRasterBand::IReadBlock returns a block with color index 0 if there is no noDataValue (see code below). Unfortunatelly a lot of CADRG products (no to say all of them) do not define a transparent color. My patch consists in adding an extra color index for transparency if there is none in the product. Thus, empty subblocks will be displayed with this transparent color.

    else /* nBlockResult == BLKREAD_NULL */
    {
        if( psImage->bNoDataSet )
            memset( pImage, psImage->nNoDataValue,
                    psImage->nWordSize*psImage->nBlockWidth*psImage->nBlockHeight);
        else
            memset( pImage, 0,
                    psImage->nWordSize*psImage->nBlockWidth*psImage->nBlockHeight);

        return CE_None;
    }

Attachments (1)

gdal_svn_cadrg_empty_subblock_bug1751.patch (1.7 KB ) - added by Even Rouault 17 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Even Rouault, 17 years ago

Type: defectenhancement

comment:2 by warmerdam, 17 years ago

Keywords: nitf added
Milestone: 1.5.0

Even,

This patch looks ok. Go ahead and apply it, but only in trunk. I don't want risky behavior changes in 1.4.3.

PS. please include "nitf" in keywords for all nitf driver bugs.

comment:3 by Even Rouault, 17 years ago

Resolution: fixed
Status: newclosed

Commited in trunk in r11906

comment:4 by warmerdam, 17 years ago

In r11923 I changed this code to only add the transparent LUT entry if there is a LUT. Fixes test stream crash.

Note: See TracTickets for help on using tickets.