canvas

Paste clipboard image to canvas

 ̄綄美尐妖づ 提交于 2020-01-01 00:43:40
问题 I have a canvas that i need the users to be able to paste an image onto. I would like this to be cross browser. I would like only to use html/javascript. I would also be willing to use a flash object. 回答1: This works fine in Chrome, though as of yet I haven't been able to figure out how to get it to work in Firefox. You can use this jQuery plugin to detect clipboard pastes. I'll assume you know how to draw the image once you have the data from the clipboard. # jquery.paste_image_reader.coffee

HTML5 canvas translate back after scale and rotation

懵懂的女人 提交于 2020-01-01 00:43:34
问题 I'm trying to do a few thing with canvas. First I have a user upload an image, if the image is larger than I want I need to scale it down. That part is working just fine. Recently we ran into an issue with iPhone users uploading images. These have orientation issues. I've figured out how to get the orientation extracted, my issue is what happens when I manipulate the image in the canvas. This is what I need to do: Get the image, translate(), scale(), rotate(), translate() <- get it back to

彻底解决 Canvas 引起的 java.lang.unsupported operation exception, android.view.GLES20Canvas.clipPath(GLES20Canvas异常

泄露秘密 提交于 2019-12-31 23:52:33
======= 7 Failure [INSTALL_FAILED_INVALID_APK] 执行 adb install - r test . apk。 时出现错误 Failure [ INSTALL_FAILED_INVALID_APK ] 可能是apk的签名出现问题,这个在之前遇到过,需要给apk签名 今天安装多个apk都是出现这个错误,遂关闭系统对签名的检测 方法:修改 /system/build.prop 文件。 将 ro . install . 3rd _cert = true 修改为 ro . install . 3rd _cert = false 重启设备就可以安装apk了 =========6   安装失败:INSTALL_FAILED_VERIFICATION_FAILURE? Install_failed_verifcation_failure?     你必须允许未签名的应用。安装被Android。允许设置非市场的应用程序安装。 =========5    关于魅族MX3无法弹出Toast的问题     设置->应用->你的应用,里面有一个显示通知的选项,打上勾,应该就可以了,你试一下 ========== 4.3 Segmentation fault 问题浅谈 今天调试程序时遇到了一个问题,当我用GDB调试程序时出现了Segmentation fault

canvas函数封装(画圆形图片、文字换行)

和自甴很熟 提交于 2019-12-31 13:41:36
1、画圆形图片 /** * 画圆形图片 * @param {object} ctx canvas * @param {number} width 图像宽度 * @param {number} height 图像高度 * @param {number} x 开始位置 * @param {number} y 结束位置 * @param {string} url 图片地址 */ function drawCircular(ctx,width,height,x,y,url) { var img_w = width; var img_h = height; var img_x = x; var img_y = y; ctx.save(); ctx.beginPath(); ctx.arc(img_w / 2 + img_x, img_h / 2 + img_y, img_w / 2, 0, Math.PI * 2, false); ctx.clip(); ctx.drawImage(url, img_x, img_y, img_w, img_h); ctx.restore(); } 2、根据每行字符长度换行,或者用\n换行 /** * 文字换行,特例可用\n * @param {Object} ctx 画布对象 * @param {String} text 文字 * @param

How to render audio waveform on HTML5 canvas? [closed]

不羁岁月 提交于 2019-12-31 10:37:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I want to render a waveform for an audio file (ogg and/or mp3) to a canvas element. I was wondering if there were any libraries that would make this simple? I am looking for a result along these lines: http://plucked.de/ 回答1: https://github.com/katspaugh/wavesurfer.js may be what you're looking for. 回答2: If you

CORS policy on cached Image

早过忘川 提交于 2019-12-31 08:42:27
问题 In chrome 22 & safari 6. Loading images from s3 for usage in a canvas (with extraction as a primary intent) using a CORS enabled S3 bucket, with the following code: <!-- In the html --> <img src="http://s3....../bob.jpg" /> // In the javascript, executed after the dom is rendered this.img = new Image(); this.img.crossOrigin = 'anonymous'; this.img.src = "http://s3....../bob.jpg"; I have observed the following: Disable caches Everything works fine, both images load Then trying it with caches

html2canvas Uncaught (in promise) undefined

烂漫一生 提交于 2019-12-31 07:29:08
问题 I have a html tag canvas. <canvas id="myCanvas"></canvas> I can draw on it successfully, and it looks really good, as i wanted to be. The problem is on the conversion to png.I use html2canvas for that with Canvas2Image. The html2canvas consoles logs an error: Uncaught (in promise) undefined. Canvas2Image console logs Uncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0. I can

can you animate an image on a canvas

主宰稳场 提交于 2019-12-31 07:25:27
问题 since I'm learning new to html and javascript, I was wondering if you can place an moving image side to side on a canvas? If so how can this be done please??? Here's what I've to do so far. <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="ann.css" /> <script> window.onload = animate; var canvas=document.getElementById('mycanvas'); var ctx=canvas.getContext('2d'); function animate() { window.setInterval(slide,1000); } function slide() { var obj = document

creating a random circle that can be clicked on like a button

坚强是说给别人听的谎言 提交于 2019-12-31 06:42:05
问题 so here is my predicament i cannot seem to find this anywhere on the internet. My question is simple. I am creating a game app for android. The game will generate random circles on the screen that a user can click on then once the user does click on one of these random circles an action will occur. This is just like the function of the button, but different because the whole circle will be able to be clicked. i will post the random number generator that generates the circles this is not the

Drawing Canvas on JFrame

血红的双手。 提交于 2019-12-31 06:18:50
问题 I'm trying to draw simple shapes with Canvas, in this class I've set the painting public class Game extends Canvas{ //FIELDS public int WIDTH = 1024; public int HEIGHT = WIDTH / 16 * 9; //METHODS public void start(){ Dimension size = new Dimension (WIDTH, HEIGHT); setPreferredSize(size); paint(null); } public void paint(Graphics g){ g.setColor(Color.GREEN); g.fillRect(0, 0, WIDTH, HEIGHT); g.setColor(Color.BLACK); g.fillOval(100, 100, 30, 30); } } And in this the Window public class MainW {