canvas

convert canvas to imageURI

徘徊边缘 提交于 2020-01-06 12:51:51
问题 I develop application using Phonegap ( Cordova ) and I have a problem trying to convert canvas to imageURI and to save it into sdcard. Here is my code: function saveCanvasAsImage(imageURI) { var gotFileEntry = function(fileEntry) { var gotFileSystem = function(fileSystem) { var d = new Date(); var n = d.getTime(); // copy the file fileEntry.moveTo(fileSystem.root.feelathome, n + ".jpg", null, null); }; // get file system to copy or move image file to window.requestFileSystem(LocalFileSystem

Document height grows on resize when setting canvas dimensions dynamically

好久不见. 提交于 2020-01-06 11:56:06
问题 I'm trying to get a canvas element to take up the entirety of the document height and window width, so that when I resize the window, the canvas element stretches with it, in effect, giving me a full screen canvas. What is actually happening, though, is the document height(and consequently, the canvas height) increases no matter how the window is resized. I'm using this code: $(document).ready(function () { $("#wrapper").before("<div id='background'><canvas id='depth' width='"+$(window).width

Drawing on mouse move with Canvas, HMTL5?

99封情书 提交于 2020-01-06 08:42:54
问题 What I am trying to achieve is a simple functionality to draw lines on a canvas when the mouse is clicked. I have looked at code online and am trying to implement it myself but it won't work. So far: <html> <canvas id="myCanvas" width="400" height="500"> </canvas> </html> <script type="text/javascript"> var el = document.getElementById('myCanvas'); var ctx = el.getContext('2d'); var isDrawing; el.onmousedown = function(e) { isDrawing = true; ctx.moveTo(e.clientX, e.clientY); }; el.onmousemove

TranslatePoint within a Canvas

戏子无情 提交于 2020-01-06 08:39:55
问题 I have a scroll viewer in my application that contains a canvas, in which I have a tree custom-drawn tree structure. I'm trying to get the position of a particular node element in the canvas relative to the scroll viewer (so I can scroll to it), but my attempts aren't working. I've tried using marker.TranslatePoint(new Point(0, 0), scrollViewer) (where marker is the element in the canvas), but this is just returning the position of the canvas, rather than the marker. Similarly, if I try

Pinch and Zoom UWP default position and size

家住魔仙堡 提交于 2020-01-06 08:07:23
问题 I drawn some arc and lines in a canvas using WIN2D.To implements pan and pinch in the canvas image I was used the code below... XAML </Canvas>--> <ScrollViewer x:Name="scrollViewer" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="-0,0,0,0" Height="806" ZoomMode="Enabled" MinZoomFactor="0.5" MaxZoomFactor="8000" ViewChanged="scrollViewer_ViewChanged"> <Grid Margin="-10,0,0,0"> <canvas:CanvasControl x:Name="ManipulateMe" Draw="Preview_Draw" Margin="-11,1,0,0"

Pinch and Zoom UWP default position and size

喜你入骨 提交于 2020-01-06 08:07:10
问题 I drawn some arc and lines in a canvas using WIN2D.To implements pan and pinch in the canvas image I was used the code below... XAML </Canvas>--> <ScrollViewer x:Name="scrollViewer" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="-0,0,0,0" Height="806" ZoomMode="Enabled" MinZoomFactor="0.5" MaxZoomFactor="8000" ViewChanged="scrollViewer_ViewChanged"> <Grid Margin="-10,0,0,0"> <canvas:CanvasControl x:Name="ManipulateMe" Draw="Preview_Draw" Margin="-11,1,0,0"

Tee chart scroller implementation

房东的猫 提交于 2020-01-06 07:59:09
问题 Hi I am trying to implement scroller from Teechart libraries. I have encountered an issue while implementing the scroller. Loading data to the scroller might have gone wrong in my case. But same data loading works well with a slider implementation. I have attached my code for data loading as well as scroller here. I can see data loading after performing fast forward or play of signal, which is a different function for data loading. However, the scroller does not move freely on the canvas. It

android drawing app: line cannot be drawn on a bitmap loaded from gallery

爱⌒轻易说出口 提交于 2020-01-06 07:02:45
问题 I am working on a drawing app, but i do not know why when the picture is loaded from gallery, when further draw on it, the line just drawn will appear on Touch but will disappear when the finger is off the screen, i.e. the line drawn cannot be fixed onto the Bitmap. Would there be anyone that know how to modify it? Many thanks!!! coding: public class DrawView extends View // the main screen that is painted { private static final float TOUCH_TOLERANCE = 10; private Bitmap bitmap; // drawing

android drawing app: line cannot be drawn on a bitmap loaded from gallery

我是研究僧i 提交于 2020-01-06 07:02:44
问题 I am working on a drawing app, but i do not know why when the picture is loaded from gallery, when further draw on it, the line just drawn will appear on Touch but will disappear when the finger is off the screen, i.e. the line drawn cannot be fixed onto the Bitmap. Would there be anyone that know how to modify it? Many thanks!!! coding: public class DrawView extends View // the main screen that is painted { private static final float TOUCH_TOLERANCE = 10; private Bitmap bitmap; // drawing

CanvasRenderingContext2D putImageData oddity

ε祈祈猫儿з 提交于 2020-01-06 06:43:14
问题 So i'm adding some image manipulation functions to one of our company projects. Part of the feature is an image cropper with the desire to 'auto-detect' the cropped image to some degree. If our guess is bad they can just drag & drop the cropper points, but most images people should be able to be auto-cropped. My issue is when i'm putting the data back into the canvas indexes that work don't seem make any sense to me based on the documentation. I'm trying to take the rect I find and convert he