canvas

Copy multiple HTML5 layered canvases to one image in JavaScript

十年热恋 提交于 2021-01-29 07:40:30
问题 I have multiple HTML5 canvases which are placed on top of one another. The order is important. Canvas 2 will be placed on Canvas 1 and so forth. a) Is there a way I can create a single image (using toDataURL()) of all of these canvases keeping the same order? b) And, then how can I copy this image to a clipboard so that it can be pasted in other applications? 回答1: Steps: Create a new Canvas (maybe hidden) Copy both canvas to the new canvas Copy to image using canvas.toDataURL() See this

Merge multiple canvas in one (to export it) using vanilla Javascript

China☆狼群 提交于 2021-01-29 07:23:23
问题 I'm in a situation where I generate multiple canvas (~200) where I draw an image snapped from the user webcam (experimentation of the "photo finish" technique). I have to export those canvas as a simple jpeg as shown in the following image. You can also see how it should visually look like (multiple stripe as multiple canvas, those I have to export as one and only Jpg). Any idea or direction of how proceed? Thanks in advance! AW. 回答1: Simply use drawImage(). It accepts an other canvas as

THREE.CanvasTexture needsUpdate no helps

可紊 提交于 2021-01-29 07:17:04
问题 I have video tag and he plays simple video. [works] I have canvas2d with playing same video [works] opencvjs video processing (canvas is output , video is input)- also works I have three.js with plane mesh texture = new THREE.CanvasTexture(this.$refs.testcanvas) texture.needsUpdate = true; materialLocal = new THREE.MeshBasicMaterial({ map: texture }) materialLocal.needsUpdate = true; materialLocal.map.needsUpdate = true; this.mainVideoMesh.material = materialLocal this.mainVideoMesh.material

Adding img.crossOrigin = “*” interferes with img.complete

假装没事ソ 提交于 2021-01-29 05:20:05
问题 I have a function that reads map tile images. I want to keep track of whether or not a certain image has already been cached. I'm using this function from this thread: function is_cached(src) { var image = new Image(); image.src = src; return image.complete; } This was working great. But then I needed to do some image processing. In order to copy the image data to a canvas and process it pixel by pixel, I need to use CanvasRenderingContext2D.drawImage(image, 0, 0) . But it bugs me with a

Setting the canvas width and height with css shifts the pen

允我心安 提交于 2021-01-29 05:04:26
问题 When i'm setting the canvas width and height with css, the pen is beeing shifted. After zooming in/out in the browser (chromium), the pen isn't shifted anymore. I'm using the literally canvas widget and want to fit the canvas to its parent div. After initializing the canvas, i'm setting the width/height of the canvas with the jquery css function. But my pen isn't at the same coordinates. After scrolling in or out in my current browser, the pen is at the coordinates where my mouse pointer is.

Draw a Filled Polygon using Scanline Loop

送分小仙女□ 提交于 2021-01-29 05:01:21
问题 I'm trying to draw a filled polygon using individual pixels in a scanline loop (so no lineTo or fill Canvas methods). I was able to achieve a triangle in this method (example below), but I'm not sure where to begin with a more complex polygon (such as a star shape ★). Can anyone give any advice on how to approach this or existing shape algorithm examples for Javascript & Canvas? I have researched Bresenham’s Algorithm but was unsuccessful implementing it for polygons because of my limited

How to bluring and debluring bitmap on seekbar change

核能气质少年 提交于 2021-01-29 03:31:26
问题 i am developing image processing and i want to apply blur effect using seekbar. i am using code below to blur bitmap and it works but now i want to deblur bitmap which i can not achieve...plz help me out to this problem private Bitmap blurfast(Bitmap bmp, int radius) { int w = bmp.getWidth(); int h = bmp.getHeight(); int[] pix = new int[w * h]; bmp.getPixels(pix, 0, w, 0, 0, w, h); for(int r = radius; r >= 1; r /= 2) { for(int i = r; i < h - r; i++) { for(int j = r; j < w - r; j++) { int tl =

How to bluring and debluring bitmap on seekbar change

社会主义新天地 提交于 2021-01-29 03:20:27
问题 i am developing image processing and i want to apply blur effect using seekbar. i am using code below to blur bitmap and it works but now i want to deblur bitmap which i can not achieve...plz help me out to this problem private Bitmap blurfast(Bitmap bmp, int radius) { int w = bmp.getWidth(); int h = bmp.getHeight(); int[] pix = new int[w * h]; bmp.getPixels(pix, 0, w, 0, 0, w, h); for(int r = radius; r >= 1; r /= 2) { for(int i = r; i < h - r; i++) { for(int j = r; j < w - r; j++) { int tl =

Canvas javascript drawImage method

倖福魔咒の 提交于 2021-01-29 02:02:34
问题 Result : It doesn't load the image to the canvas. I'm getting white rectangle, any idea why? I thought I could just call the draw method directly from the variable , like e.g : bg.draw, or does that mean that I need to re-draw the Image again on the canvas and re-run the bg.draw? const cvs = document.getElementById("firstplatform"); const ctx = cvs.getContext("2d"); // GAME VARS AND CONSTS let frames = 0; // LOAD IMAGE const sprite = new Image(); sprite.src = "img/sprite.png"; //BACKGROUND

Canvas javascript drawImage method

别等时光非礼了梦想. 提交于 2021-01-29 02:00:41
问题 Result : It doesn't load the image to the canvas. I'm getting white rectangle, any idea why? I thought I could just call the draw method directly from the variable , like e.g : bg.draw, or does that mean that I need to re-draw the Image again on the canvas and re-run the bg.draw? const cvs = document.getElementById("firstplatform"); const ctx = cvs.getContext("2d"); // GAME VARS AND CONSTS let frames = 0; // LOAD IMAGE const sprite = new Image(); sprite.src = "img/sprite.png"; //BACKGROUND