Image* Atlas::RenderAtlasImage(const Image &image) const { assert(image.GetWidth() == mSrcWidth); assert(image.GetHeight() == mSrcHeight); Image *ret = new Image(mAtlasWidth,mAtlasHeight,image.GetNumComponents()); for(int i = 0;i < (int)mCharts.size();i++) { const Chart &chart = mCharts[i]; if(chart.mFlip) ret->CopySubImageTransposed(image,chart.mSrcX,chart.mSrcY,chart.mWidth,chart.mHeight,chart.mAtlasX,chart.mAtlasY); else ret->CopySubImage(image,chart.mSrcX,chart.mSrcY,chart.mWidth,chart.mHeight,chart.mAtlasX,chart.mAtlasY); } ret->AutoUnref(); return ret; }