本文整理汇总了C++中TgaImporter类的典型用法代码示例。如果您正苦于以下问题:C++ TgaImporter类的具体用法?C++ TgaImporter怎么用?C++ TgaImporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TgaImporter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void TgaImporterTest::colorBits32() {
TgaImporter importer;
const unsigned char data[] = {
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 32, 0,
1, 2, 3, 1, 2, 3, 4, 1,
3, 4, 5, 1, 4, 5, 6, 1,
5, 6, 7, 1, 6, 7, 8, 1
};
#ifndef MAGNUM_TARGET_GLES
const char* pixels = reinterpret_cast<const char*>(data) + 18;
#else
const char pixels[] = {
3, 2, 1, 1, 4, 3, 2, 1,
5, 4, 3, 1, 6, 5, 4, 1,
7, 6, 5, 1, 8, 7, 6, 1
};
#endif
CORRADE_VERIFY(importer.openData(data));
std::optional<Trade::ImageData2D> image = importer.image2D(0);
CORRADE_VERIFY(image);
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(image->format(), ImageFormat::BGRA);
#else
CORRADE_COMPARE(image->format(), ImageFormat::RGBA);
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ImageType::UnsignedByte);
CORRADE_COMPARE(std::string(reinterpret_cast<const char*>(image->data()), 2*3*3), std::string(pixels, 2*3*3));
}
开发者ID:severin-lemaignan,项目名称:magnum-plugins,代码行数:30,代码来源:TgaImporterTest.cpp
示例2: CORRADE_VERIFY
void TgaImporterTest::openNonexistent() {
std::ostringstream debug;
Error::setOutput(&debug);
TgaImporter importer;
CORRADE_VERIFY(!importer.openFile("nonexistent.file"));
CORRADE_COMPARE(debug.str(), "Trade::TgaImporter::openFile(): cannot open file nonexistent.file\n");
}
开发者ID:msomeone,项目名称:magnum,代码行数:8,代码来源:TgaImporterTest.cpp
示例3: TgaImageConverter
void TgaImageConverterTest::rgba() {
const auto data = TgaImageConverter().exportToData(OriginalRGBA);
TgaImporter importer;
CORRADE_VERIFY(importer.openData(data));
std::optional<Trade::ImageData2D> converted = importer.image2D(0);
CORRADE_VERIFY(converted);
CORRADE_COMPARE(converted->storage().alignment(), 4);
CORRADE_COMPARE(converted->size(), Vector2i(2, 3));
CORRADE_COMPARE(converted->format(), PixelFormat::RGBA);
CORRADE_COMPARE(converted->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(converted->data(), Containers::ArrayView<const char> {OriginalDataRGBA},
TestSuite::Compare::Container);
}
开发者ID:yaroslav-tarasov,项目名称:magnum,代码行数:15,代码来源:TgaImageConverterTest.cpp
示例4: TgaImageConverter
void TgaImageConverterTest::data() {
const auto data = TgaImageConverter().exportToData(original);
TgaImporter importer;
CORRADE_VERIFY(importer.openData(data));
std::optional<Trade::ImageData2D> converted = importer.image2D(0);
CORRADE_VERIFY(converted);
CORRADE_COMPARE(converted->size(), Vector2i(2, 3));
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(converted->format(), ColorFormat::BGR);
#else
CORRADE_COMPARE(converted->format(), ColorFormat::RGB);
#endif
CORRADE_COMPARE(converted->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{converted->data(), 2*3*3}),
(std::string{original.data(), 2*3*3}));
}
开发者ID:NextGenIntelligence,项目名称:magnum,代码行数:18,代码来源:TgaImageConverterTest.cpp
示例5: file
void TgaImporterTest::file() {
TgaImporter importer;
const unsigned char data[] = {
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 8, 0,
1, 2,
3, 4,
5, 6
};
CORRADE_VERIFY(importer.openFile(Utility::Directory::join(TGAIMPORTER_TEST_DIR, "file.tga")));
std::optional<Trade::ImageData2D> image = importer.image2D(0);
CORRADE_VERIFY(image);
CORRADE_COMPARE(image->format(), ImageFormat::Red);
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ImageType::UnsignedByte);
CORRADE_COMPARE(std::string(reinterpret_cast<const char*>(image->data()), 2*3),
std::string(reinterpret_cast<const char*>(data) + 18, 2*3));
}
开发者ID:severin-lemaignan,项目名称:magnum-plugins,代码行数:18,代码来源:TgaImporterTest.cpp
示例6: file
void TgaImporterTest::file() {
TgaImporter importer;
const char data[] = {
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 8, 0,
1, 2,
3, 4,
5, 6
};
CORRADE_VERIFY(importer.openFile(Utility::Directory::join(TGAIMPORTER_TEST_DIR, "file.tga")));
std::optional<Trade::ImageData2D> image = importer.image2D(0);
CORRADE_VERIFY(image);
#ifndef MAGNUM_TARGET_GLES2
CORRADE_COMPARE(image->format(), ColorFormat::Red);
#else
CORRADE_COMPARE(image->format(), ColorFormat::Luminance);
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3}),
(std::string{data + 18, 2*3}));
}
开发者ID:msomeone,项目名称:magnum,代码行数:22,代码来源:TgaImporterTest.cpp
示例7:
void TgaImporterTest::grayscaleBits8() {
TgaImporter importer;
const char data[] = {
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 8, 0,
1, 2,
3, 4,
5, 6
};
CORRADE_VERIFY(importer.openData(data));
std::optional<Trade::ImageData2D> image = importer.image2D(0);
CORRADE_VERIFY(image);
#ifndef MAGNUM_TARGET_GLES2
CORRADE_COMPARE(image->format(), ColorFormat::Red);
#else
CORRADE_COMPARE(image->format(), ColorFormat::Luminance);
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3}),
(std::string{data + 18, 2*3}));
}
开发者ID:msomeone,项目名称:magnum,代码行数:22,代码来源:TgaImporterTest.cpp
注:本文中的TgaImporter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论