MCPcopy Create free account
hub / github.com/SpartanJ/eepp / saveToFile

Method saveToFile

src/eepp/graphics/textureregion.cpp:425–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425bool TextureRegion::saveToFile( const std::string& filepath, const Image::SaveType& Format,
426 const Image::FormatConfiguration& imageFormatConfiguration ) {
427 bool Res = false;
428
429 lock();
430
431 if ( NULL != mTexture ) {
432 if ( Image::SaveType::JPG != Format ) {
433 Res = 0 != ( SOIL_save_image( filepath.c_str(), (int)Format, getRealSize().getWidth(),
434 getRealSize().getHeight(), mTexture->getChannels(),
435 getPixelsPtr() ) );
436 } else {
437 jpge::params params;
438 params.m_quality = imageFormatConfiguration.jpegSaveQuality();
439 Res = jpge::compress_image_to_jpeg_file(
440 filepath.c_str(), getRealSize().getWidth(), getRealSize().getHeight(),
441 mTexture->getChannels(), getPixelsPtr(), params );
442 }
443 }
444
445 unlock();
446
447 return Res;
448}
449
450void TextureRegion::resetDestSize() {
451 mDestSize.x = mOriDestSize.getWidth();

Callers

nothing calls this directly

Calls 5

c_strMethod · 0.80
getChannelsMethod · 0.80
jpegSaveQualityMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected