html5-canvas

How can I prevent both vertical and horizontal stretching of contained text while resizing text-based objects in Fabric.js?

为君一笑 提交于 2021-02-20 00:42:40
问题 I want to be able to scale text-based objects (for example with classes and subclasses of IText, Textbox) without stretching the text inside of the object. The interaction of scaling and moving is on user-side (UI), not programmatically (I am working on a drawing editor). The behaviour I am looking for is similar to the one in the sticky notes apps: You can scale the paper but this action does not scale your text too. I have already checked this, but this is only for horizontal prevention:

How to get image color mode (CMYK, RGB …) in Javascript

て烟熏妆下的殇ゞ 提交于 2021-02-19 08:12:49
问题 can the JavaScript check the color mode of a image? I did a lot of search about this but the only thing I saw was color mode convert (but the convert wants you to set the original color mode) I add this: --allow-file-access-from-files to have a full control of img in canvas beacause I am using GoogleChrome Html <canvas id="canvas" width=6000 height=7919></canvas> Js var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); var img = new Image(); img.crossOrigin =

Why I cannot use Konva.Image() in Konva.Shape.fillPatternImage(imageObj)?

梦想与她 提交于 2021-02-18 18:11:04
问题 The following is an example from Konvajs library to load an image: var imageObj = new Image(); imageObj.onload = function() { var yoda = new Konva.Image({ x: 50, y: 50, image: imageObj, width: 106, height: 118 }); And here is my code var annotation = new Konva.Line({ points: this.contour, stroke: color, closed: true, strokeWidth: 1 }); var nativeImageObject = new Image(); nativeImageObject.onload = function() { var konvaImage = new Konva.Image({ image: nativeImageObject }); annotation

Why I cannot use Konva.Image() in Konva.Shape.fillPatternImage(imageObj)?

大憨熊 提交于 2021-02-18 18:04:09
问题 The following is an example from Konvajs library to load an image: var imageObj = new Image(); imageObj.onload = function() { var yoda = new Konva.Image({ x: 50, y: 50, image: imageObj, width: 106, height: 118 }); And here is my code var annotation = new Konva.Line({ points: this.contour, stroke: color, closed: true, strokeWidth: 1 }); var nativeImageObject = new Image(); nativeImageObject.onload = function() { var konvaImage = new Konva.Image({ image: nativeImageObject }); annotation

'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported

那年仲夏 提交于 2021-02-18 17:55:34
问题 In Chrome I get the following error on jsfiddle when trying to test canvas drawing images from a remote url. Error: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. On S3 bucket I have the following CORS policy, which allows for cross resource sharing: <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> </CORSRule> <

How to select covered objects via mouse in fabricJS?

时光总嘲笑我的痴心妄想 提交于 2021-02-18 08:24:15
问题 I'm trying to develop a way to select objects that are layered below and (totally) covered by other objects. One idea is to select the top object and then via doubleclick walk downwards through the layers. This is what I got at the moment: var canvas = new fabric.Canvas("c"); fabric.util.addListener(canvas.upperCanvasEl, "dblclick", function (e) { var _canvas = canvas; var _mouse = _canvas.getPointer(e); var _active = _canvas.getActiveObject(); if (e.target) { var _targets = _canvas

How to select covered objects via mouse in fabricJS?

你离开我真会死。 提交于 2021-02-18 08:23:47
问题 I'm trying to develop a way to select objects that are layered below and (totally) covered by other objects. One idea is to select the top object and then via doubleclick walk downwards through the layers. This is what I got at the moment: var canvas = new fabric.Canvas("c"); fabric.util.addListener(canvas.upperCanvasEl, "dblclick", function (e) { var _canvas = canvas; var _mouse = _canvas.getPointer(e); var _active = _canvas.getActiveObject(); if (e.target) { var _targets = _canvas

Combine audio and video streams into one file with MediaRecorder [duplicate]

和自甴很熟 提交于 2021-02-18 06:24:47
问题 This question already has answers here : MediaStream Capture Canvas and Audio Simultaneously (2 answers) Closed 2 years ago . I am making a small interactive animation/game (on canvas with PixiJS) and wish to give users an option to save the rendered animation. After doing my research, MediaRecorder appears to be the API that I should use to record and render the video. However the MediaRecorder constructor only allows one stream to be used as source. How can I merge additional streams (audio

Canvas image drawing order

雨燕双飞 提交于 2021-02-17 03:13:32
问题 I'm making a simple engine for isometric games to use in the future. The thing is i'm having trouble drawing on the canvas. Take for instance this code: function pre_load() { var imgs = ['1', '1000','1010','1011','1012','1013']; var preload_image_object = new Image(); $.each(imgs,function(i,c){ preload_image_object.src='img/sprites/'+c.logo+'.png'; }) } function GameWorld() { //[...] this.render = function() { this.draw(1000, this.center); this.draw(1013, this.center); this.draw(1010, this

Canvas image drawing order

偶尔善良 提交于 2021-02-17 03:13:16
问题 I'm making a simple engine for isometric games to use in the future. The thing is i'm having trouble drawing on the canvas. Take for instance this code: function pre_load() { var imgs = ['1', '1000','1010','1011','1012','1013']; var preload_image_object = new Image(); $.each(imgs,function(i,c){ preload_image_object.src='img/sprites/'+c.logo+'.png'; }) } function GameWorld() { //[...] this.render = function() { this.draw(1000, this.center); this.draw(1013, this.center); this.draw(1010, this