本文整理汇总了C++中Frame::GetImage方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::GetImage方法的具体用法?C++ Frame::GetImage怎么用?C++ Frame::GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::GetImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compile
void WiiPlatform::Compile(Sprite *obj)
{
bfs::create_directories(obj->GetOutputPath().parent_path());
std::ostringstream files;
std::ostringstream alphas;
std::map<const char*, int, LowerThanStringComparator> frames;
int id = 0;
int as = obj->GetSize();
for (int a = 0; a < as; a++)
{
Animation *anim = obj->GetAnimation(a);
int fs = anim->GetSize();
for (int f = 0; f < fs; f++)
{
const Frame *frame = anim->GetFrame(f);
if (frames.find(frame->GetFilename()) == frames.end())
{
frames[frame->GetFilename()] = 1;
files << "file " << id << " = " << frame->GetFilename() << ".tga\n";
if (!frame->HasAlpha())
alphas << "image " << id << " = " << id << ", x, RGBA8\n";
else
alphas << "image " << id << " = " << id << ", " << id << ", RGBA8\n";
id++;
}
}
}
for (int i = 0; i < id; i++)
{
char tex[32];
snprintf(tex, 32, "texture %d = %d, x\n", id, id);
}
std::ostringstream fileTmp;
fileTmp << "tmp" << PLATFORM_PATH_SEPARATOR_STR << "tmp.tcs";
FILE *fp = fopen(fileTmp.str().c_str(), "w+");
fprintf(fp, "path = %s\\\n", e->GetInputPath(RESOURCE_IMAGE).string().c_str());
fprintf(fp, "%s", files.str().c_str());
fprintf(fp, "%s", alphas.str().c_str());
for (int i = 0; i < id; i++)
fprintf(fp, "texture %d = %d, x\n", i, i);
fclose(fp);
// xunxo mode on
/*std::ostringstream tplOut;
tplOut << e->GetOutputPath() << PLATFORM_PATH_SEPARATOR_STR << obj->GetName() << PLATFORM_WII_OUTPUT_IMG_EXT;
pCache->AddFilename(tplOut.str().c_str());*/
std::ostringstream cmd;
cmd << this->GetName() << PLATFORM_PATH_SEPARATOR_STR << "texconv tmp" << PLATFORM_PATH_SEPARATOR_STR << "tmp.tcs ";
cmd << e->GetOutputPath() << PLATFORM_PATH_SEPARATOR_STR << obj->GetName() << PLATFORM_WII_OUTPUT_IMG_EXT;
BOOL valid = TRUE;
for (u32 i = 0; i < obj->GetSize(); i++)
{
Animation *anim = obj->GetAnimation(i);
if (!anim)
continue;
for (u32 j = 0; j < anim->GetSize(); j++)
{
Frame *frame = const_cast<Frame*>(anim->GetFrame(j));
if (!frame)
continue;
// a regular 1024x1024x32 TGA texture has a size of 4MB
const Image *img = frame->GetImage();
if (bfs::file_size(img->GetInputPath()) / (1024 * 1024) >= 4)
{
valid = FALSE;
break;
}
}
if (!valid)
break;
}
if (valid)
{
std::ostringstream tplOut;
tplOut << e->GetOutputPath() << PLATFORM_PATH_SEPARATOR_STR << obj->GetName() << PLATFORM_WII_OUTPUT_IMG_EXT;
pCache->AddFilename(tplOut.str().c_str());
RUN_COMMAND(cmd);
}
// xm off
if (e->IsCompressionEnabled() && valid)
{
bfs::path wiiToolsPath(this->GetName());
//.........这里部分代码省略.........