graphics

Extra line when drawing an arc in swift

浪尽此生 提交于 2019-12-13 12:22:47
问题 I have this kind of code in a swift app and I get an extra greyed line reaching the starting point of the arc. The arc itself is drawn as expected, but it seems like CGContextMoveToPoint is leaving some trace behind before reaching the starting point. override func drawRect(rect: CGRect) { var context:CGContextRef = UIGraphicsGetCurrentContext(); var centerX,centerY,startAngle,endAngle,radius:CGFloat startAngle = CGFloat(M_PI_4) endAngle = -startAngle radius = (rect.height/2) / sin(startAngle

Finding the line number of a function in Haskell

天涯浪子 提交于 2019-12-13 12:09:43
问题 I am trying to create a Haskell program which draws some simple 2d shapes to screen, but when you hover over each shape, it prints the line of source code where the shape was created. In order to do this I would like to be able to create shapes with parameters for their dimensions and a final parameter which indicates the line number. Something like this: rect1 = Shape(Rectangle 2 2 lineNumber) This would create a rectangle of width 2 pixels, height 2 pixels, and use a function lineNumber to

Affine transformation matrix offset

[亡魂溺海] 提交于 2019-12-13 12:05:09
问题 This has been killing me the last few days. Not even kidding, but I've been really stressing over this trying to solve it. I am currently trying to use affine transformation matrices to create an isometric projection in HTML5. I receive a tile which is a square that is rotated 45 degrees (essentially a square diamond on a square canvas). I then scale one of the axis' depending on if the there is a delta in the x or y direction. I then skew the axis by a factor to fit. Then, I negate the

Find a line intersecting a known line at right angle, given a point

。_饼干妹妹 提交于 2019-12-13 11:36:15
问题 This is basic graphics geometry and/or trig, and I feel dumb for asking it, but I can't remember how this goes. So: I have a line defined by two points (x1, y1) and (x2, y2). I have a third point (xp, yp) which lies somewhere else. I want to compute the point (x', y') that lies somewhere along the line in #1, such that, when joined with the point from #2, creates a new perpendicular line to the first line. Thanks. 回答1: To all those poor souls looking for a concrete example using vectors...

Getting SVG d after transform

谁都会走 提交于 2019-12-13 09:58:40
问题 I Have a square SVG that I want to create into a diamond, rotating it 45 degrees gives me the effect I want but I am limited to only using the d value of an SVG for my image. How can I get the newly transform d value from https://jsfiddle.net/x2v3tmdp/ In other words here is my d: M13,14H2c-0.5523,0-1-0.4477-1-1V2c0-0.5523,0.4477-1,1-1h11c0.5523,0,1,0.4477,1,1v11C14,13.5523,13.5523,14,13,14z now I need to rotate that 45 degrees and get the new d value. 回答1: If you want to process an SVG file

Program not Painting [closed]

一曲冷凌霜 提交于 2019-12-13 09:49:41
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I intended for this to paint a square on my JPanel, however, it does not show up. What am I doing wrong? class GUI extends JPanel { private static Game game = new Game(); ... public GUI () { SwingUtilities.invokeLater(new Runnable() { public void run() { setAttributes(); makeMenu(); } }); } ...

How do I do graphics easily in a modern linux? [closed]

你离开我真会死。 提交于 2019-12-13 09:48:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Here is an example of the sort of C program one could write in the old days: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> void main() { int gd=DETECT, gm; initgraph(&gd, &gm, "c:\\turboc\\bgi"); circle(200,100,150); getch(); closegraph(); } I

The graph of panel will go after the form is minimized, C#

倖福魔咒の 提交于 2019-12-13 09:04:22
问题 I have a panel in my form named Pan_Paint and I have the code below: Graphics graph = Pan_Paint.CreateGraphics(); graph.FillEllipse(new SolidBrush(Blue), 10, 10, 100, 100); When I minize the form, and the when I restore it, the line will disappear. Or when I press Tab Button, the same thing will happen. What can I do to fix that? Thank you. 回答1: This is basic. You either need to cache all drawing in some data structures and have them drawn in the Paint event. Again and again, whenever windows

how i can work programaticly with spell effect in game [closed]

血红的双手。 提交于 2019-12-13 08:47:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . how i can work programaticly with spell effect in game i have a effect look like this spell effect i want to know how i can change the cale of the spell . like change color in distance or when u run some this effect goes to transparent and after 10 sec go to fade or look at this

For loops are disturbing rendering

微笑、不失礼 提交于 2019-12-13 08:20:07
问题 I have some pretty simple 3D objects (basically THREE.Sphere which is a parent of 1-30 other THREE.Sphere s, with RGB color and no texture) to display in somewhat real time animation. The rendering is done in no time indeed, but I have some simple iterative calculation ( for-loops ) that are disturbing my display capabilities. The rendering itself is not the problem, but the computation for the next frame vertices is what causing the pain Meaning, when I just run the script, I can see that