public static Frame FlattenFromChexelProvider(ChexelProvider top, Frame bottom) { int xMax = bottom.width + bottom.xOffset; int yMax = bottom.height + bottom.yOffset; Frame toReturn = new Frame(xMax, yMax, 0, 0); for (int x = 0; x < xMax; x++) { for (int y = 0; y < yMax; y++) { Chexel toSet = new Chexel(); if (top.hasChexel(x, y)) { toSet = top.getChexel(x, y); } else if (bottom.hasChexel(x, y)) { toSet = bottom.getChexel(x, y); } toReturn.setChexel(x, y, toSet); } } return(toReturn); }
public bool hasChexel(int x, int y) { if (hasShader) { if (useOffset) { return(shader.hasChexel(x + xOffset, y + yOffset)); } else { return(shader.hasChexel(x, y)); } } if (useOffset) { return((x >= xOffset && x < width + xOffset) && (y >= yOffset && y < height + yOffset)); } else { return((x >= 0 && x < width) && (y >= 0 && y < height)); } }