canvas

How to save image of iframe underneath HTML5 canvas?

我只是一个虾纸丫 提交于 2020-01-14 02:41:14
问题 I am trying to call a webpage on my canvas on which I can draw or add notes. Now I want to take a screenshot where the drawing is saved with the webpage as background. I called a url in iframe behind the canvas (using z-index) I can save only the image which I draw on canvas and not the webpage which I called. Please help how I can get it to work. Is there any way I can call a url within my canvas? 回答1: This was already answered in this post: Capture HTML Canvas as gif/jpg/png/pdf? - You can

close window after file save in FileSaver.js

南笙酒味 提交于 2020-01-13 12:07:52
问题 I am using the FileSaver.js file to save my canvas to image. I have to close the window after download. Is there any way to achieve this? Here is my code what i have tried, canvas.toBlob(function (blob) { saveAs(blob, "RQGantt.png"); window.close(); }); It's works fine with small size of image. But my window closed before it's start downloading when i have a large size of image. Is there any way to do this in client side? 回答1: Here is response they have provided for https://github.com/eligrey

close window after file save in FileSaver.js

廉价感情. 提交于 2020-01-13 12:07:17
问题 I am using the FileSaver.js file to save my canvas to image. I have to close the window after download. Is there any way to achieve this? Here is my code what i have tried, canvas.toBlob(function (blob) { saveAs(blob, "RQGantt.png"); window.close(); }); It's works fine with small size of image. But my window closed before it's start downloading when i have a large size of image. Is there any way to do this in client side? 回答1: Here is response they have provided for https://github.com/eligrey

close window after file save in FileSaver.js

左心房为你撑大大i 提交于 2020-01-13 12:06:56
问题 I am using the FileSaver.js file to save my canvas to image. I have to close the window after download. Is there any way to achieve this? Here is my code what i have tried, canvas.toBlob(function (blob) { saveAs(blob, "RQGantt.png"); window.close(); }); It's works fine with small size of image. But my window closed before it's start downloading when i have a large size of image. Is there any way to do this in client side? 回答1: Here is response they have provided for https://github.com/eligrey

Get position on canvas AFTER rotating/translating and restoring

♀尐吖头ヾ 提交于 2020-01-13 11:11:54
问题 Okay, this is getting complicated... Given situation: I have a canvas with the dimensions of 800x600. My mouse is at canvas position 100x200 (for example). I save my canvas state. Now I rotate and translate the canvas, I draw a square. I restore my canvas state. Is there any way to determine if my mouse is over the square? I think I would have to translate/rotate my mouse position as well - in the opposite direction, but how would I do this? 回答1: You can get hold of an objects world position

Can't scale multiple paths in Raphael?

只谈情不闲聊 提交于 2020-01-13 10:10:25
问题 I've tried using the current top Question on SO : Scaling multiple paths with raphael ...without much luck. I'm building a map of the USA through Raphael and while the map is very nice, I need it to be probably 30% the size it is currently. I was able to change the attr on the initial Raphael canvas to ".5" but that only sized each individual path instead of the whole canvas. I have also tried using javascript to scale the div containing the canvas to no avail. Paths: Actual Page: http:/

Trouble loading Base64 string to canvas

↘锁芯ラ 提交于 2020-01-13 09:46:49
问题 I'm trying to load a Base64 string from my database to a canvas. I obtained this string from doing the reverse method: I saved it to my database after drawing on a canvas. So, now I want to load it back onto another canvas. I have tried this code which I picked up on the web and somewhere else here on StackOverflow but it doesn't seem to work. <script type="text/javascript"> $(document).ready(function(){ var canvas = document.getElementById("loading_canvas"); var ctx = canvas.getContext("2d")

Full screen responsive triangle pattern

爷,独闯天下 提交于 2020-01-13 08:42:29
问题 Recently I dug a bit more into mobile UX design and I found a interesting topic regarding 1 hand / thumb selection. The main idea is that you have 2 triangle areas that are clickable with your thumb. I did try to find a solution via CSS or jQuery to create 2 triangle areas that are click/touch-able with but I failed. I tried: - icon fonts - svgs (this did not work, since svgs are still rectangular) - divs with borders shaped into a triangle - canvas (did not work out so well) - ASCII fonts -

Mouse position on canvas painting

余生颓废 提交于 2020-01-13 08:29:14
问题 The code below paints correctly but it paints to wrong coordinates. It should paint the place where the mouse is. I was not able to discover my mistake. Thanks. JSFIDDLE container.mousedown(function(e) { var parentOffset = $(this).offset(); var x = e.pageX - parentOffset.left; var y = e.pageY - parentOffset.top; context_temp.beginPath(); context_temp.moveTo(x, y); started = true; }); container.mousemove(function(e) { var parentOffset = $(this).offset(); var x = e.pageX - parentOffset.left;

canvas.toDataURL() not working properly [duplicate]

风格不统一 提交于 2020-01-13 08:21:09
问题 This question already has answers here : How to return value from an asynchronous callback function? [duplicate] (3 answers) Closed 12 months ago . I am having a canvas in which I upload an image with the following code: function handleImage(e){ var reader = new FileReader(); reader.onload = function(event){ var img = new Image(); img.onload = function(){ canvas.width = img.width; canvas.height = img.height; ctx.drawImage(img,0,0); } img.src = event.target.result; } reader.readAsDataURL(e