drawing

Smoother freehand drawing experience (iOS)

谁说胖子不能爱 提交于 2019-12-09 23:00:41
问题 I am making a math related activity in which the user can draw with their fingers for scratch work as they try to solve the math question. However, I notice that when I move my finger quickly, the line lags behind my finger somewhat noticeably. I was wondering if there was some area I had overlooked for performance or if touchesMoved simply just doesn't come enough (it is perfectly smooth and wonderful if you don't move fast). I am using UIBezierPath . First I create it in my init method like

Cutting irregular shape on image

∥☆過路亽.° 提交于 2019-12-09 21:03:24
问题 I am trying to cut an image into a particular shape using the canvas clip() method. I have followed the following steps to do so: Draw a rectangle. Draw semi circles on each side. The right and bottom semi circles protrude outwards and the left and top semi circles are inwards. The code snippet is provided below: var canvasNode = this.hasNode(); var ctx = canvasNode && canvasNode.getContext('2d'); var image = new Image(); image.onload = function() { ctx.drawImage(image, 0, 0, 512, 384); };

Using and moving Widgets/Buttons in Kivy

孤者浪人 提交于 2019-12-09 19:57:34
问题 I'm just starting off with Kivy and it's different to what I'm used to, apologies if I'm making stupid mistakes! Right now I'm trying to create an app that does the following: Allows creation of Nodes (ellipses for now). Allows the user to position the nodes by dragging. Allows the user to connect the nodes with a line. So far I've achieved the first, and the second somewhat. Right now my dragging is not working too well. If I move the mouse too quickly it cancels the move method (as it is no

How to draw circle with specific color in XNA?

我的未来我决定 提交于 2019-12-09 15:52:08
问题 XNA doesn't have any methods which support circle drawing. Normally when I had to draw circle, always with the same color, I just made image with that circle and then I could display it as a sprite. But now the color of the circle is specified during runtime, any ideas how to deal with that? 回答1: You can simply make an image of a circle with a Transparent background and the coloured part of the circle as White . Then, when it comes to drawing the circles in the Draw() method, select the tint

OpenGL ES Simple Undo Last Drawing

只愿长相守 提交于 2019-12-09 14:07:27
问题 I am trying to figure out how to implement a simple "undo" of last drawing action on the iPhone screen. I draw by first preparing the frame buffer: [EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); I then prepare the vertex array and draw this way: glVertexPointer(2, GL_FLOAT, 0, vertexBuffer); glDrawArrays(GL_POINTS, 0, vertexCount); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context presentRenderbuffer:GL_RENDERBUFFER_OES

Animated line drawing with jQuery

别来无恙 提交于 2019-12-09 11:25:09
问题 I want to use jQuery to create an effect of a line drawing being drawn as if with an invisible pen. Sort of like this: http://d2fhka9tf2vaj2.cloudfront.net/tuts/152_QTiPad/Milestones/JavaScriptWebsite.html I made this mock-up with some other library, but I wonder if there's an easier way to do that with jQuery. And I also want to be able to animate curved and irregular lines. I would like to animate a drawing like this, for example: http://commons.wikimedia.org/wiki/File:Mouse_line_drawing

Canvas.drawLines displaying disjointed segments [duplicate]

不问归期 提交于 2019-12-09 10:43:41
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Android How to draw a smooth line following your finger I'm new to Android and java programming and have been playing around a bit with mobile app development. I recently created a View which simply keeps draws lines in step with the user's finger movements. However, I've been having some trouble with the Canvas.drawLines method. Instead of getting a continuous set of lines between all points I am getting more

Draw rectangles, circles or arbitrary polygons in a m x n matrix

断了今生、忘了曾经 提交于 2019-12-09 08:49:08
问题 I want to simulate the flow around objects in two dimensions. Therefore I wrote a program in C which uses the Navier-Stokes equations to describe the motion of fluids. Now I came to the point where I actually want more than just placing a rectangle in the simulation domain. To draw such a rectangle I just do something like: for(int i=start_x; i<end_x; i++) for(int j=start_y; j<end_y; j++) M[i][j] = 1; // barrier cell = 1 Doing this I get a nice rectangle. No surprise. But what would be an

Algorithm for drawing an anti-aliased circle?

こ雲淡風輕ζ 提交于 2019-12-09 08:25:32
问题 What's a good algorithm for drawing anti-aliased circles? (Filled and not filled.) 回答1: Bresenham (of the line algorithm fame) also had a circle algorithm. Xiaolin Wu adapted the line algorithm for anti-aliasing, and likewise did the same to the circle algorithm. http://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm You can find the circle algorithm with this search: http://www.google.com/search?q=Xiaolin%20Wu%20circle -Adam 回答2: If you want an easy one, make a soft blur from pixel

Canvas' drawLine and drawRect not including end position?

天大地大妈咪最大 提交于 2019-12-09 08:21:59
问题 To my surprise I've just discovered that drawLine and drawRect don't include the ending position, i.e.: canvas.drawLine(100, 100, 100, 100, paint); or RectF rect = new RectF(100, 100, 100, 100); canvas.drawRect(rect, paint); won't draw anything. My paint is defined as follows: Paint paint = new Paint(); paint.setAntiAlias(false); paint.setStyle(Paint.Style.FILL); return paint; I've tried defining my paint as FILL_AND_STROKE, but it wouldn't help. Android's drawPaint() javadoc don't even list