canvas

Drag & Drop Multiple Images from Toolbar onto Canvas

梦想的初衷 提交于 2020-01-16 04:46:29
问题 I am making an application in which user can drag & drop multiple objects from a toolbar onto a canvas.After dragging and dropping that particular object onto the canvas the user can move that object around in the canvas.Double Clicking on that object will make it disappear.I have been able to implement this for one object in the toolbar as shown in the link below.. http://jsfiddle.net/gkefk/26/ To drag & drop multiple objects from the toolbar I made the following additions in the function

How to tint an image in HTML5

北城以北 提交于 2020-01-16 00:41:12
问题 I want to tint an Image but instead of subtracting colors from the origin, I want to add them. Is there a quick way to do this in HTML5 with javascript? 回答1: Yes there are two simple ways you can use. Method 1 - Composite mode The composite mode lighter is in reality an additive mode. You can activate it with a single line of code ( online demo here ): ctx.globalCompositeOperation = 'lighter'; The next thing drawn will add to what is in the background which gives you this result if you

Android canvas draw line on camera

ⅰ亾dé卋堺 提交于 2020-01-16 00:38:15
问题 I'm working with augmented reality app and I want to draw a line that connects two movable objects on top of the camera. However I get this exception Process: test.job.reality.augument.job.com.augumentrealitytest, PID: 15056 java.lang.IllegalArgumentException at android.view.Surface.nativeLockCanvas(Native Method) at android.view.Surface.lockCanvas(Surface.java:266) at custom.MyCameraView$MyThread.run(MyCameraView.java:447) Here's my code as you can see I start my thread in surfaceCreted

Completely reloading a canvas element with data-processing-sources

久未见 提交于 2020-01-15 23:39:36
问题 <div class="Container"><div class="SubContainer"> <canvas id="gamecanvas" data-processing-sources="canvas.pde"> ERROR - No canvas support on browser </canvas> </div></div> <div class="Container"><div class="SubContainer"> <canvas id="hudcanvas" data-processing-sources="hud.pde"> ERROR - No canvas support on browser </canvas> </div></div> I have these two canvas's using processing.js and WebGL 3D, and basically I need them to reload in order to adjust their size. I tried using jQuery to clone

memory leak while drawing many new images to canvas

為{幸葍}努か 提交于 2020-01-15 23:06:33
问题 I have written a "slide show" that displays images sequentially and quickly, much like a stop-frame movie. Once an image is displayed, I have no further use for it and would like to clear it from memory to free space for new images. However, while monitoring Google Chrome Helper in Activity Monitor, I see that the memory continues to increase steadily until the browser crashes. I noticed a chrome garbage collection issue that was submitted as a bug and I'm wondering if maybe I'm experiencing

HTML5-用canvas画布rotate字体旋转(中国象棋棋谱)。

我与影子孤独终老i 提交于 2020-01-15 21:41:03
一开始我们老师安排我做这个作业,在这个作业我遇到了一个很重大的问题就是,文字旋转这么旋转,我查了很多资料。     1发现绘画正方形,使他正方形中心原点旋转非常容易理解。(我相信这个很多人看一下都会懂,)                 1.translate(x,y):平移,将画布的坐标原点向左右方向移动x,向上下方向移动y.canvas的默认位置是在(0,0).             例子:画布原点假如落在(1,1),那么translate(10,10)就是在原点(1,1)基础上分别在x轴、y轴移动10,则原点变为(11,11)。                        2.我来说说怎么转移到中心点,假如,fillRect(50,50,100,100)的正方形(矩形也是一样的),坐标在(50,50)建立了一个长,宽各100的正方形,但是呢正方形的中点究竟在那里呢,公式是:cvContent.translate(x+width/2,y+height/2);就能找到中心点了, 也就是说cvContent.translate(125,125)才是正方行的中心点,如图下,找到中心点后直接旋转就行了。      注意了:正方形之所以能旋转,有一下这两个       cvContext.translate();   //        cvContext.rotate(45 *

小程序canvas生成图片并保存在本地

纵饮孤独 提交于 2020-01-15 18:11:54
小程序canvas生成图片并保存在本地,舍己图片的绘制,和权限申请和图片的保存。 官网文档 微信小程序官方文档 用到的相关api api 描述 示例 wx.getSystemInfo 获取手机的屏幕信息(宽、高等) wx.getSystemInfo({}) wx.createCanvasContext 创建canvas上下文对象 const ctx = wx.createCanvasContext(“my-canvas”, this); ctx.setFillStyle 设置画笔颜色 ctx.setFillStyle("#ccc"); ctx.fillRect(0, 0, sWidth, 350) 填充一个矩形 ctx.fillRect(0, 0, sWidth, 350); ctx.drawImage 将一张图片填充进画布 ctx.drawImage("/test.jpg", 0, 0, 1440, 900, 20, 20, sWidth - 40, 210) ctx.setFontSize 设置字体颜色 ctx.setFontSize(16); ctx.draw 将缓存重的图像画出来(将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中) ctx.draw(); wx.getSetting 获取用户的授权设置 wx.getSetting({}) wx

Javascript canvas.getImageData IE vs Chrome

丶灬走出姿态 提交于 2020-01-15 16:44:51
问题 I have a canvas object from which i want to get the color of a position with canvas.getImageData. When i paint a gradient on it and try to get the color from point (0,0) chrome behaves as expected and returns the color value 255,255,255 whereas IE returns 254,253,253. I have here a plunker which shows what i mean : http://plnkr.co/edit/BWSn2J2N2A6poaH4WR6a?p=preview You can just execute this in IE and in Chrome and you'll see the difference. I use the IE v11 and the Chrome v40. Maybe the

Javascript canvas.getImageData IE vs Chrome

那年仲夏 提交于 2020-01-15 16:43:46
问题 I have a canvas object from which i want to get the color of a position with canvas.getImageData. When i paint a gradient on it and try to get the color from point (0,0) chrome behaves as expected and returns the color value 255,255,255 whereas IE returns 254,253,253. I have here a plunker which shows what i mean : http://plnkr.co/edit/BWSn2J2N2A6poaH4WR6a?p=preview You can just execute this in IE and in Chrome and you'll see the difference. I use the IE v11 and the Chrome v40. Maybe the

Change Dragged Target in KineticJS

≯℡__Kan透↙ 提交于 2020-01-15 13:10:48
问题 Is it possible to switch the object being dragged to another object on clicking the first object? Problem: In the jsfiddle below, when the red circle is dragged, it changes into a blue rectangle but does not respond to the initial drag. A 2nd drag has to be made on the blue rectangle to drag it. Desired: It should change from red circle to blue rectangle and the blue rectangle should immediately follow the dragging motion smoothly. Attempt: I tried to .simulate() the events but it does not