canvas

Android Emulation Issue; Application working on ARM system image but not Intel Atom system image

青春壹個敷衍的年華 提交于 2020-01-15 12:24:25
问题 Being frustrated with the speed of the android emulator running on a ARM image, as soon as I discovered the intel atom image I used it right away. There was a immediate speed boost (boot going from 30 sec to 3 sec) but my application no longer works completely. All the XML portions of the app work, but as soon as I move to my activity which is all surfaceview and canvas work the screen goes black. It does not crash and there are no errors in logcat. The stranger thing is that I have a

Save canvas with external images to local file

守給你的承諾、 提交于 2020-01-15 10:55:07
问题 Is there a way to save to the local filesystem a canvas with loaded images from external websites into it? If I try with toDataUrl(), it just trhows a Security error. In Firefox I can just save to a file the canvas with the right click, but this is not possible in Chrome. 回答1: No, for security reasons you can't use toDataUrl() . For why this is happening you need to look into cors. Here's a bit on why it should be this way. It's a feature in Firefox that you can right-click save-as because

Android Canvas focus in selected area

北战南征 提交于 2020-01-15 10:54:23
问题 I'm trying to achieve this effect: The idea is that I want to cover an ImageView with a partial transparent layer, but not all of it. Somewhere there is an area (circle or rectangle), that should be completely transparent. I tried it using this lines of code: Paint paint = new Paint(); paint.setColor(Color.parseColor("#80000000")); canvas.drawRect(0, 0, bitmap.getWidth(), bitmap.getHeight(), paint); paint.setColor(Color.TRANSPARENT); canvas.drawCircle((int) x, (int) y, 50, paint); but it didn

Flip <canvas> (rotate 180deg) after being published on page

谁说我不能喝 提交于 2020-01-15 10:45:09
问题 I'm trying to rotate a canvas element AFTER it's been appended to the DOM. Canvas is 600x50 and this is the code at hand: var canvas = document.getElementsByTagName('canvas')[2]; var ctx = canvas.getContext('2d'); ctx.translate(300, 25); // rotate @ center ctx.rotate(angle * Math.PI/180); which isn't accomplishing the task. Am I missing something? Thanks 回答1: Dug around and found this working solution; context.scale(1,-1); //flip vertically context.translate(0,-height); //move beneath

Bitmap created from FrameLayout is black

纵然是瞬间 提交于 2020-01-15 10:36:09
问题 I am trying to create a bitmap for share intent.Bitmap is created( I hope because it is not null which it was when tried out buildDrawingCache() solution) but when it is shared it is null.I have looked at other SO answers also but none of them works. In my code you can see I have tried other solutions also but created bitmap is null there.Here at least the bitmap is created but it's black. My image is 500px X 500px image by the way if it matters. share_image.xml <?xml version="1.0" encoding=

MatrixTransform in combination with Width/Height of a Canvas

扶醉桌前 提交于 2020-01-15 10:34:28
问题 When zooming in on a drawing on a Canvas I have the requirement to show scrollbars. The Canvas is in a ScrollViewer and I increase the Width/Height of the Canvas so that that the scollbars appear (otherwise they don't). To zoom in with a factor of 1.1 I use this code: Matrix m = this.LayoutTransform.Value; if (e.Delta > 0) f = 1.1; else f = 1.0 / 1.1; m.Scale(f, f); this.LayoutTransform = new MatrixTransform(m); this.Height = this.ActualHeight * f; this.Width = this.ActualWidth * f; It turns

MatrixTransform in combination with Width/Height of a Canvas

拟墨画扇 提交于 2020-01-15 10:33:20
问题 When zooming in on a drawing on a Canvas I have the requirement to show scrollbars. The Canvas is in a ScrollViewer and I increase the Width/Height of the Canvas so that that the scollbars appear (otherwise they don't). To zoom in with a factor of 1.1 I use this code: Matrix m = this.LayoutTransform.Value; if (e.Delta > 0) f = 1.1; else f = 1.0 / 1.1; m.Scale(f, f); this.LayoutTransform = new MatrixTransform(m); this.Height = this.ActualHeight * f; this.Width = this.ActualWidth * f; It turns

Textbox on canvas in j2me

荒凉一梦 提交于 2020-01-15 09:23:06
问题 I am going to make application on j2me using canvas. I want to take textbox or textfield on my canvas. 回答1: You can draw a basic textbox and display a string , and when it receives focus, you can switch the view to that particular textbox ,something like this textBox = new TextBox(....); Midlet.display.setCurrent(textBox); This would create your data entry more robust and save you from the pain of implementing various keyboard issues yourselves 回答2: These items are only available for adding

How to clip canvas with CSS clip-path?

一世执手 提交于 2020-01-15 09:10:44
问题 I know that I can clip a canvas by creating a path with getContext('2d') and setting globalCompositeOperation . I've noticed that sometimes I'm able to clip a canvas with -webkit-clip-path , or clip-path on other browsers (I'm on Chrome), and sometimes I'm not able to: Using this HTML: <canvas width="300" height="60"></canvas> and CSS: canvas { -webkit-clip-path: polygon(50% 33%, 75% 10%, 80% 80%, 60% 75%, 40% 60%, 20% 10%, 40% 20%, 50% 33%); } produces this: Which appears to be correct.

小程序中快速生成二维码

筅森魡賤 提交于 2020-01-15 08:13:40
1、wxml中 < canvas style= "width: 200px; height: 200px; " canvas-id= "myQrcode " > </ canvas > 2、js 若是项目使用了wepy npm install weapp-qrcode --save import drawQrcode from 'weapp-qrcode' drawQrcode ( { width : 200 , height : 200 , canvasId : 'myQrcode ' , // ctx: wx.createCanvasContext('myQrcode'), text : ' https://github.com/yingye ' , // v1.0.0+版本支持在二维码上绘制图片 image : { imageResource : '../../images/icon.png ' , dx : 70 , dy : 70 , dWidth : 60 , dHeight : 60 } } ) 来源: https://www.cnblogs.com/lingshan168/p/10412023.html