egami/sample/read.cpp

55 lines
1.5 KiB
C++
Raw Normal View History

2016-07-13 22:27:54 +02:00
/** @file
* @author Edouard DUPIN
* @copyright 2016, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
2016-07-13 22:27:54 +02:00
*/
//! [egami_sample_read_all]
2016-09-30 22:28:36 +02:00
#include <test-debug/debug.hpp>
#include <etk/math/Vector2D.hpp>
2016-07-13 22:27:54 +02:00
//! [egami_sample_include]
2016-09-30 22:28:36 +02:00
#include <egami/egami.hpp>
2016-07-13 22:27:54 +02:00
//! [egami_sample_include]
2016-09-30 22:28:36 +02:00
#include "read.hpp"
2016-07-13 22:27:54 +02:00
static void readBMP() {
//! [egami_sample_declare_image]
// create an empty Image (no type and no inside data)
egami::Image image;
//! [egami_sample_declare_image]
//! [egami_sample_read_file_bmp]
2018-10-09 23:03:07 +02:00
image = egami::load("DATA:///read.bmp");
2016-07-13 22:27:54 +02:00
//! [egami_sample_read_file_bmp]
TEST_INFO("image exist (BMP): " << image.exist());
}
static void readSVG() {
//! [egami_sample_read_file_svg]
2018-10-09 23:03:07 +02:00
egami::Image image = egami::load("DATA:///read.svg");
2016-07-13 22:27:54 +02:00
//! [egami_sample_read_file_svg]
TEST_INFO("image exist (SVG): " << image.exist());
//! [egami_sample_read_file_svg_rescale]
2018-10-09 23:03:07 +02:00
image = egami::load("DATA:///read.svg", ivec2(800,600));
2016-07-13 22:27:54 +02:00
//! [egami_sample_read_file_svg_rescale]
TEST_INFO("image exist (SVG-rescale): " << image.exist());
//! [egami_sample_read_file_svg_scale_factor]
2018-10-09 23:03:07 +02:00
// TODO : image = egami::load("DATA:///read.svg", 0.5);
2016-07-13 22:27:54 +02:00
//! [egami_sample_read_file_svg_scale_factor]
TEST_INFO("image exist (SVG-scale): " << image.exist());
}
static void readPNG() {
//! [egami_sample_read_file_png]
2018-10-09 23:03:07 +02:00
egami::Image image = egami::load("DATA:///read_128x128.png");
2016-07-13 22:27:54 +02:00
//! [egami_sample_read_file_png]
TEST_INFO("image exist (PNG): " << image.exist());
}
void appl::read() {
readBMP();
readSVG();
readPNG();
}
//! [egami_sample_read_all]