@Override public Canvas fillRect(float x, float y, float w, float h) { ctx.fillRect(x, y, w, h); isDirty = true; return this; }
@Override public Canvas fillRect(float x, float y, float w, float h) { ctx.fillRect(x, y, w, h); isDirty = true; return this; }
@Override public Canvas fillRect(float x, float y, float w, float h) { ctx.fillRect(x, y, w, h); isDirty = true; return this; }
context.beginPath(); context.setStrokeStyle(BLACK); context.fillRect(0, 0, centerX * 2, centerY * 2); context.setStrokeStyle(WHITE); super.onStart();
@UiHandler("slPicker") void onChangeColor(final ColorChangedEvent event) { if (canvasSupported) { final Context2d ctx = color.getContext2d(); ctx.setFillStyle(event.getColor()); ctx.fillRect(0, 0, color.getCoordinateSpaceWidth(), color.getCoordinateSpaceHeight()); } else { textColor.setValue(event.getColor()); } }
public void setColor(final String color) { if (canvasSupported) { final Context2d ctx = this.color.getContext2d(); ctx.setFillStyle(color); ctx.fillRect(0, 0, this.color.getCoordinateSpaceWidth(), this.color.getCoordinateSpaceHeight()); final Rgb rgb = Colors.html2rgb(color); final Hsl hsl = Colors.rgb2hsl(rgb); huePicker.setHue(hsl.getH()); slPicker.setColor(color); } else { textColor.setValue(color); } }
/** * Actually repaint the content (repaint() is ignored in Web * implementation). */ public void repaintWeb() { if (lastIcon == null) { return; } if (!active(wrap.getElement()) && this.enabled) { wrap.getElement().focus(); } final double height = computeHeight(lastIcon); final double width = roundUp(lastIcon.getIconWidth() + 30); ctx.getCanvas().setHeight(((int) Math.ceil(height * ratio))); ctx.getCanvas().setWidth((int) Math.ceil(width * ratio)); ctx.setFillStyle("rgb(255,255,255)"); ctx.fillRect(0, 0, ctx.getCanvas().getWidth(), height); JlmLib.draw(lastIcon, ctx, 0, getMargin(lastIcon), new ColorW(0, 0, 0), "#FFFFFF", null, ratio); }
private void drawGradient() { final Context2d ctx = canvas.getContext2d(); // draw gradient ctx.setFillStyle("#ffffff"); //$NON-NLS-1$ ctx.fillRect(0, 0, 26, 180); final Hsl hsl = new Hsl(0, 100, 50); for (int y = 0; y <= 179; y++) { hsl.setH(y * 2); ctx.setFillStyle(Colors.hsl2html(hsl)); ctx.fillRect(3, y, 20, 1); } // draw handle if (handleY >= 0) { ctx.setFillStyle("#000000"); //$NON-NLS-1$ ctx.beginPath(); ctx.moveTo(3, handleY); ctx.lineTo(0, handleY - 3); ctx.lineTo(0, handleY + 3); ctx.closePath(); ctx.fill(); ctx.moveTo(23, handleY); ctx.lineTo(26, handleY - 3); ctx.lineTo(26, handleY + 3); ctx.closePath(); ctx.fill(); } }
context.fillRect( blockX, blockY, BLOCK_SIZE, BLOCK_SIZE );
private void drawGradient(final boolean drawHandle) { final Context2d ctx = canvas.getContext2d(); // draw gradient final Hsl hsl = new Hsl(hue, 0, 50); for (int x = 0; x <= 179; x++) { hsl.setS(Math.round(x * 100 / 179)); final CanvasGradient grad = ctx.createLinearGradient(x, 0, x, 179); grad.addColorStop(0, "#000000"); //$NON-NLS-1$ grad.addColorStop(0.5, Colors.hsl2html(hsl)); grad.addColorStop(1, "#ffffff"); //$NON-NLS-1$ ctx.setFillStyle(grad); ctx.fillRect(x, 0, 1, 180); } // draw handle if (drawHandle) { ctx.beginPath(); ctx.arc(handleX, handleY, 4, 0, Math.PI * 2, false); ctx.closePath(); ctx.setFillStyle("#ffffff"); //$NON-NLS-1$ ctx.fill(); ctx.beginPath(); ctx.arc(handleX, handleY, 3, 0, Math.PI * 2, false); ctx.closePath(); ctx.setFillStyle("#000000"); //$NON-NLS-1$ ctx.fill(); } }
@Override public void paint(Canvas canvas, Matrix matrix) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().fillRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().strokeRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().restore(); }
@Override public void paint(Canvas canvas, Matrix matrix) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().fillRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().strokeRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().restore(); }
if (mouseDown) { backContext.setFillStyle("white"); backContext.fillRect(-5, -5, width + 5, height + 5); backContext.setFillStyle("black"); double xPos = event.getRelativeX(image.getElement());
if (sprite.getFill() != null && sprite.getFill() != Color.NONE) { ctx.setGlobalAlpha(Double.isNaN(sprite.getFillOpacity()) ? opacity : opacity * sprite.getFillOpacity()); ctx.fillRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());