canvas

Magnifying glass that follows cursor for canvas

99封情书 提交于 2021-02-07 14:23:56
问题 I'm working on a t-shirt designer for a client of mine and I made it using html5 canvas. The shirt designer is now finished but he requested I add a magnifying glass (something like this: http://mlens.musings.it/). I've found a lot of similar scripts out there, however, they all seem to have one thing in common they use a small and a large image. Using canvas, however, I have a different scenario and have been stumped on how I can add a magnifying glass to magnify where ever the cursor is on

Draw to canvas only after Google Web Font is loaded

柔情痞子 提交于 2021-02-07 14:23:25
问题 I am using .fillText() on a canvas, the text of which I want to be in a Google Web Font (Oswald, in my case). When the page loads, the text is drawn to canvas before the font has loaded, but obviously once the font loads the text on the canvas doesn't update, because it has already been drawn as a bitmap. How can I delay this text drawing until after the Web Font has loaded? A rectangle is also drawn to the canvas which I would still like to draw immediately on $(document).ready() . I should

Mouse position within HTML 5 responsive Canvas

随声附和 提交于 2021-02-07 13:47:01
问题 I've searched through other questions but none of them fit my case. I have a canvas element: <canvas id="linear-synoptic-map" width="1053px" height="1000px" ng-click="linearSynopticCtrl.canvasClicked($event)" ng-mousemove="linearSynopticCtrl.mouseMovedOverCanvas($event)"> </canvas> And I'm getting the position with this function: linearSynopticCtrl.getPositionFromEvent = function (event) { var rect = linearSynopticCtrl.canvas.getBoundingClientRect(); var x = event.x - rect.left; var y = event

Mouse position within HTML 5 responsive Canvas

懵懂的女人 提交于 2021-02-07 13:45:02
问题 I've searched through other questions but none of them fit my case. I have a canvas element: <canvas id="linear-synoptic-map" width="1053px" height="1000px" ng-click="linearSynopticCtrl.canvasClicked($event)" ng-mousemove="linearSynopticCtrl.mouseMovedOverCanvas($event)"> </canvas> And I'm getting the position with this function: linearSynopticCtrl.getPositionFromEvent = function (event) { var rect = linearSynopticCtrl.canvas.getBoundingClientRect(); var x = event.x - rect.left; var y = event

Canvas drag on mouse movement

走远了吗. 提交于 2021-02-07 13:43:30
问题 I'm trying to build a canvas that i can drag using mouse movement. And I'm doing something wrong that i cannot understand cause seems to work at first and then there is like an incremental error that make the canvas move too fast. Considering the following code, window.onload = function() { var canvas = document.getElementById("canvas"); var context = canvas.getContext('2d'); function draw() { context.fillRect(25, 25, 100, 100); } function clear() { context.clearRect(0, 0, canvas.width,

Wallpaper crashes with error - queueBuffer: error queuing buffer to SurfaceTexture

落爺英雄遲暮 提交于 2021-02-07 11:52:32
问题 Live Wallpaper crashes, code below public void render(){ Canvas canvas = null; try{ canvas = this._surfaceHolder.lockCanvas(null); synchronized (this._surfaceHolder) { this.onDraw(canvas); } }catch(Exception e){ Log.w("Surface holder ", e.toString());} finally{ if(canvas != null){ this._surfaceHolder.unlockCanvasAndPost(canvas); } } } protected void onDraw(Canvas canvas) { this.renderBackGround(canvas); for (Renderable renderable : this._fishes) { renderable.render(canvas); } }; Crashes with

Draw Curved Text on Canvas with different length of Text in android

感情迁移 提交于 2021-02-07 10:54:01
问题 I need to implement curved text which draw text on circular path on canvas. It does draw circular path using canvas.drawTextOnPath(QUOTE, circle, 485, 20, tPaint); but it is not working for different length of the text. Following is my Class to draw circular text on the canavs. public class CircularTextVie extends View { private String QUOTE = ""; private Path circle; private Paint cPaint; private Paint tPaint; public CircularTextVie(Context context) { super(context); circle = new Path();

Draw Curved Text on Canvas with different length of Text in android

别等时光非礼了梦想. 提交于 2021-02-07 10:53:30
问题 I need to implement curved text which draw text on circular path on canvas. It does draw circular path using canvas.drawTextOnPath(QUOTE, circle, 485, 20, tPaint); but it is not working for different length of the text. Following is my Class to draw circular text on the canavs. public class CircularTextVie extends View { private String QUOTE = ""; private Path circle; private Paint cPaint; private Paint tPaint; public CircularTextVie(Context context) { super(context); circle = new Path();

How can I bring up the keyboard on mobile devices to catch the input for drawing on an HTML5 canvas?

北战南征 提交于 2021-02-07 07:27:33
问题 I'm trying to make a crossword puzzle in javascript / html5 canvas which works on a mobile website. I found this library (modit): https://mod.it/8UmnmJ11 which seems to work well and look good on the desktop, but the mobile version doesn't bring up the keyboard. How can I bring up the keyboard on mobile devices to catch the input for drawing on an HTML5 canvas? The library makes use of HTML5 canvas, which gives the puzzle a nice look and feel. I know I can make such a crossword puzzle with

How can I bring up the keyboard on mobile devices to catch the input for drawing on an HTML5 canvas?

China☆狼群 提交于 2021-02-07 07:27:22
问题 I'm trying to make a crossword puzzle in javascript / html5 canvas which works on a mobile website. I found this library (modit): https://mod.it/8UmnmJ11 which seems to work well and look good on the desktop, but the mobile version doesn't bring up the keyboard. How can I bring up the keyboard on mobile devices to catch the input for drawing on an HTML5 canvas? The library makes use of HTML5 canvas, which gives the puzzle a nice look and feel. I know I can make such a crossword puzzle with