예제 #1
0
extern "C" int CPL_STDCALL
GDALComputeMedianCutPCT( GDALRasterBandH hRed,
                         GDALRasterBandH hGreen,
                         GDALRasterBandH hBlue,
                         int (*pfnIncludePixel)(int, int, void*),
                         int nColors,
                         GDALColorTableH hColorTable,
                         GDALProgressFunc pfnProgress,
                         void * pProgressArg )

{
    VALIDATE_POINTER1( hRed, "GDALComputeMedianCutPCT", CE_Failure );
    const int nXSize = GDALGetRasterBandXSize( hRed );
    const int nYSize = GDALGetRasterBandYSize( hRed );
    if( nYSize == 0 )
        return CE_Failure;
    if( static_cast<GUInt32>(nXSize) < UINT_MAX / static_cast<GUInt32>(nYSize) )
    {
        return GDALComputeMedianCutPCTInternal(hRed, hGreen, hBlue,
                                               NULL, NULL, NULL,
                                               pfnIncludePixel, nColors,
                                               5,
                                               static_cast<GUInt32 *>(NULL),
                                               hColorTable,
                                               pfnProgress, pProgressArg);
    }
    else
    {
#ifdef CPL_HAS_GINT64
        return GDALComputeMedianCutPCTInternal(hRed, hGreen, hBlue,
                                               NULL, NULL, NULL,
                                               pfnIncludePixel, nColors,
                                               5,
                                               static_cast<GUIntBig * >(NULL),
                                               hColorTable,
                                               pfnProgress, pProgressArg);
#else
        return CE_Failure;
#endif
    }
}
예제 #2
0
extern "C" int CPL_STDCALL
GDALComputeMedianCutPCT( GDALRasterBandH hRed,
                         GDALRasterBandH hGreen,
                         GDALRasterBandH hBlue,
                         int (*pfnIncludePixel)(int,int,void*),
                         int nColors,
                         GDALColorTableH hColorTable,
                         GDALProgressFunc pfnProgress,
                         void * pProgressArg )

{
    return GDALComputeMedianCutPCTInternal(hRed, hGreen, hBlue,
                                           NULL, NULL, NULL,
                                           pfnIncludePixel, nColors,
                                           5,
                                           NULL,
                                           hColorTable,
                                           pfnProgress, pProgressArg);
}