Co-Simulation/Sumo/sumo-1.7.0/src/utils/foxtools/MFXImageHelper.cpp
// smell: yellow (the save functions may have additional options, not regarded)
// Save file
yellow (the save functions may have additional options, not regarded)
Save file
yellow ( the save functions may have additional options not regarded ) Save file
FXbool
MFXImageHelper::saveImage(const std::string& file,
                          int width, int height, FXColor* data) {
    FXString ext = FXPath::extension(file.c_str());
    checkSupported(ext);
    FXFileStream stream;
    if (!stream.open(file.c_str(), FXStreamSave)) {
        throw InvalidArgument("Could not open file for writing!");
    }
    if (comparecase(ext, "gif") == 0) {
        return fxsaveGIF(stream, data, width, height, false );
    } else if (comparecase(ext, "bmp") == 0) {
        return fxsaveBMP(stream, data, width, height);
    } else if (comparecase(ext, "xpm") == 0) {
        return fxsaveXPM(stream, data, width, height);
    } else if (comparecase(ext, "pcx") == 0) {
        return fxsavePCX(stream, data, width, height);
    } else if (comparecase(ext, "ico") == 0 || comparecase(ext, "cur") == 0) {
        return fxsaveICO(stream, data, width, height);
    } else if (comparecase(ext, "tga") == 0) {
        return fxsaveTGA(stream, data, width, height);
    } else if (comparecase(ext, "rgb") == 0) {
        return fxsaveRGB(stream, data, width, height);
    } else if (comparecase(ext, "xbm") == 0) {
        return fxsaveXBM(stream, data, width, height);
    } else if (comparecase(ext, "png") == 0) {
        return fxsavePNG(stream, data, width, height);
    } else if (comparecase(ext, "jpg") == 0 || comparecase(ext, "jpeg") == 0) {
        return fxsaveJPG(stream, data, width, height, 75);
    } else if (comparecase(ext, "tif") == 0 || comparecase(ext, "tiff") == 0) {
        return fxsaveTIF(stream, data, width, height, 0);
    }
    throw InvalidArgument("Unknown file extension for image!");
}
FXbool MFXImageHelper :: saveImage ( const std :: string & file , int width , int height , FXColor * data ) { FXString ext = FXPath :: extension ( file . c_str ( ) ) ; checkSupported ( ext ) ; FXFileStream stream ; if ( ! stream . open ( file . c_str ( ) , FXStreamSave ) ) { throw InvalidArgument ( " " ) ; } if ( comparecase ( ext , " " ) == 0 ) { return fxsaveGIF ( stream , data , width , height , false ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsaveBMP ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsaveXPM ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsavePCX ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 || comparecase ( ext , " " ) == 0 ) { return fxsaveICO ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsaveTGA ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsaveRGB ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsaveXBM ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 ) { return fxsavePNG ( stream , data , width , height ) ; } else if ( comparecase ( ext , " " ) == 0 || comparecase ( ext , " " ) == 0 ) { return fxsaveJPG ( stream , data , width , height , 75 ) ; } else if ( comparecase ( ext , " " ) == 0 || comparecase ( ext , " " ) == 0 ) { return fxsaveTIF ( stream , data , width , height , 0 ) ; } throw InvalidArgument ( " " ) ; }
smell: yellow (the save functions may have additional options, not regarded)
Save file
smell : yellow ( the save functions may have additional options not regarded ) Save file
/* !!! "fast" */