+ /**
+ * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& )
+ */
+ inline bool EncodeToFile( const std::string& filename ) const
+ {
+ return EncodeToFile( filename, DEFAULT_QUALITY );
+ }
+
+ /**
+ * @brief Converts the current pixel contents to either a JPEG or PNG format
+ * and write that to the filesystem.
+ *
+ * @param[in] filename Identify the filesystem location at which to write the encoded image.
+ * The extension determines the encoding used.
+ * The two valid encoding are (".jpeg"|".jpg") and ".png".
+ * @param[in] quality The quality of encoded jpeg image
+ * @return @c true if the pixels were written, and @c false otherwise
+ */
+ inline bool EncodeToFile( const std::string& filename, const uint32_t quality ) const
+ {
+ std::vector< uint8_t > pixbuf;
+ uint32_t width( 0 ), height( 0 );
+ Pixel::Format pixelFormat;
+
+ if( GetPixels( pixbuf, width, height, pixelFormat ) )
+ {
+ return Dali::EncodeToFile( &pixbuf[0], filename, pixelFormat, width, height, quality );
+ }
+ return false;
+ }
+