Ticket #1751 (closed enhancement: fixed)

Opened 11 months ago

Last modified 11 months ago

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

Reported by: rouault Assigned to: 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

gdal_svn_cadrg_empty_subblock_bug1751.patch (1.7 kB) - added by rouault on 08/17/07 17:09:26.

Change History

08/17/07 17:09:26 changed by rouault

  • attachment gdal_svn_cadrg_empty_subblock_bug1751.patch added.

08/17/07 17:33:22 changed by rouault

  • type changed from defect to enhancement.

08/18/07 11:15:44 changed by warmerdam

  • keywords changed from CADRG to CADRG nitf.
  • milestone set to 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.

08/18/07 12:08:47 changed by rouault

  • status changed from new to closed.
  • resolution set to fixed.

Commited in trunk in r11906

08/22/07 10:17:23 changed by warmerdam

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