public override bool DrawToAtlas(TextureAtlas atlas, AtlasLocation location) { // Only ever called with a static image: Color32[] pixelBlock = Image.GetPixels32(); int index = 0; int atlasIndex = location.BottomLeftPixel(); // How many pixels must we add on to the end of the row to get to // the start of the row above? This is RowPixelDelta: int rowDelta = location.RowPixelDelta(); int height = Image.height; int width = Image.width; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { atlas.Pixels[atlasIndex++] = pixelBlock[index++]; } atlasIndex += rowDelta; } return(true); }
public bool DrawToAtlas(TextureAtlas atlas, AtlasLocation location) { // Only ever called with a static image: Color32[] pixelBlock = Image.GetPixels32(); int index = 0; int atlasIndex = location.BottomLeftPixel(); int height = Image.height; int width = Image.width; // How many pixels must we add on to the end of the row to get to // the start of the row above? This is simply the dimension of the atlas: int rowDelta = atlas.Dimension; for (int h = 0; h < height; h++) { Array.Copy(pixelBlock, index, atlas.Pixels, atlasIndex, width); index += width; atlasIndex += rowDelta; } return(true); }
public bool DrawToAtlas(TextureAtlas atlas, AtlasLocation location) { // Draw now: return(Rasterise(atlas.Pixels, atlas.Dimension, location.BottomLeftPixel(), true)); }