/** Returns the supplied length scaled by our scale factor and rounded up. */ public int scaledCeil(float length) { return MathUtil.iceil(scaled(length)); }
/** Returns the supplied length scaled by our scale factor and rounded down. */ public int scaledFloor(float length) { return MathUtil.ifloor(scaled(length)); }
/** Returns the supplied length scaled by our scale factor and rounded down. */ public int scaledFloor(float length) { return MathUtil.ifloor(scaled(length)); }
/** Returns the supplied length scaled by our scale factor and rounded up. */ public int scaledCeil(float length) { return MathUtil.iceil(scaled(length)); }
public RoboCanvas(Graphics gfx, RoboCanvasImage image) { super(gfx, image); // if our size is invalid, we'll fail below at CGBitmapContext, so fail here more usefully if (width <= 0 || height <= 0) throw new IllegalArgumentException( "Invalid size " + width + "x" + height); states.addFirst(new RoboCanvasState()); bctx = image.bctx; // clear the canvas before we scale our bitmap context to avoid artifacts bctx.clearRect(new CGRect(0, 0, texWidth(), texHeight())); // CG coordinate system is OpenGL-style (0,0 in lower left); so we flip it Scale scale = image.scale(); bctx.translateCTM(0, scale.scaled(height)); bctx.scaleCTM(scale.factor, -scale.factor); }