本文整理汇总了C++中ImageManager::getAtlasImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageManager::getAtlasImage方法的具体用法?C++ ImageManager::getAtlasImage怎么用?C++ ImageManager::getAtlasImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageManager
的用法示例。
在下文中一共展示了ImageManager::getAtlasImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imageA
TEST(ImageManager, Updates) {
ImageManager imageManager;
PremultipliedImage imageA({ 16, 12 });
imageA.fill(255);
imageManager.addImage(makeMutable<style::Image::Impl>("one", std::move(imageA), 1));
auto a = *imageManager.getPattern("one");
EXPECT_EQ(1, a.tl()[0]);
EXPECT_EQ(1, a.tl()[1]);
EXPECT_EQ(17, a.br()[0]);
EXPECT_EQ(13, a.br()[1]);
EXPECT_EQ(16, a.displaySize()[0]);
EXPECT_EQ(12, a.displaySize()[1]);
EXPECT_EQ(1.0f, a.pixelRatio);
test::checkImage("test/fixtures/image_manager/updates_before", imageManager.getAtlasImage());
PremultipliedImage imageB({ 5, 5 });
imageA.fill(200);
imageManager.updateImage(makeMutable<style::Image::Impl>("one", std::move(imageB), 1));
auto b = *imageManager.getPattern("one");
EXPECT_EQ(1, b.tl()[0]);
EXPECT_EQ(1, b.tl()[1]);
EXPECT_EQ(6, b.br()[0]);
EXPECT_EQ(6, b.br()[1]);
EXPECT_EQ(5, b.displaySize()[0]);
EXPECT_EQ(5, b.displaySize()[1]);
EXPECT_EQ(1.0f, b.pixelRatio);
test::checkImage("test/fixtures/image_manager/updates_after", imageManager.getAtlasImage());
}
示例2: parseSprite
TEST(ImageManager, Basic) {
FixtureLog log;
ImageManager imageManager;
auto images = parseSprite(util::read_file("test/fixtures/annotations/emerald.png"),
util::read_file("test/fixtures/annotations/emerald.json"));
for (auto& image : images) {
imageManager.addImage(image->baseImpl);
}
auto metro = *imageManager.getPattern("metro");
EXPECT_EQ(1, metro.tl()[0]);
EXPECT_EQ(1, metro.tl()[1]);
EXPECT_EQ(19, metro.br()[0]);
EXPECT_EQ(19, metro.br()[1]);
EXPECT_EQ(18, metro.displaySize()[0]);
EXPECT_EQ(18, metro.displaySize()[1]);
EXPECT_EQ(1.0f, metro.pixelRatio);
EXPECT_EQ(imageManager.getPixelSize(), imageManager.getAtlasImage().size);
test::checkImage("test/fixtures/image_manager/basic", imageManager.getAtlasImage());
}