draw

JFreechart draw arc on chart

左心房为你撑大大i 提交于 2019-11-26 21:07:39
I have 2 questions 1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code? Arc2D.Double arc = new Arc2D.Double(3.0, 16.9, 44.0, 17.04, 180.0, 180.0, Arc2D.OPEN ); plot.addAnnotation(new XYShapeAnnotation(arc, new BasicStroke(2.0f),

draw polar graph in java

邮差的信 提交于 2019-11-26 21:02:28
Does anyone know how I can get started to draw a polar graph in java and plot some points on this graph? I mean the circles and lines, I wish to do this with something like swing, and not use any library like Jfreechart Thanks You might like to look at Lissajous curves ; an example of a = 5, b = 4 (5:4) is shown below. Addendum: Once you see how to plot points in xy coordinates, then you should look at converting between polar and Cartesian coordinates . public class LissajousPanel extends JPanel { private static final int SIZE = 400; private GeneralPath path = new GeneralPath(); @Override

How to speed up python's 'turtle' function and stop it freezing at the end

岁酱吖の 提交于 2019-11-26 20:35:44
问题 I have written a turtle program in python, but there are two problems. It goes way too slow for larger numbers, I was wonder how I can speed up turtle. It freezes after it finishes and when clicked on, says 'not responding' This is my code so far: import turtle #Takes user input to decide how many squares are needed f=int(input("How many squares do you want?")) c=int(input("What colour would you like? red = 1, blue = 2 and green =3")) n=int(input("What background colour would you like? red =

How to draw rectangle on MouseDown/Move c#

て烟熏妆下的殇ゞ 提交于 2019-11-26 20:28:29
问题 I am not quite sure how to draw a Rectangle (not filled) when I drag my mousedown while left clicking the mouse. I have this so far private void canevas_MouseDown( object sender , MouseEventArgs e ) { if( e.Button == MouseButtons.Left ) { _topLeft = new Point( e.X , e.Y ); _drawing = true; } } private void canevas_MouseMove( object sender , MouseEventArgs e ) { if( _drawing ) { Rectangle rec = new Rectangle( _topLeft.X , _topLeft.Y , ( e.X - _topLeft.X ) , ( e.Y - _topLeft.Y ) ); canevas

Draw equidistant points on a spiral

梦想与她 提交于 2019-11-26 19:24:40
问题 I need an algorithm to calculate the distribution of points on a spiral path. The input parameters of this algorithm should be: Width of the loop (distance from the innermost loop) Fixed distance between the points The number of points to draw The spiral to draw is an archimedean spiral and the points obtained must be equidistant from each other. The algorithm should print out the sequence of the Cartesian coordinates of single points, for example: Point 1: (0.0) Point 2: (..., ...) ........

Android: Drawing a canvas to an ImageView

て烟熏妆下的殇ゞ 提交于 2019-11-26 18:12:59
问题 I'm new to android programming and what I'm trying to figure out is this; In my layout i have a TextView, ImageView, and Button, all on a vertically oriented LinearLayout. I want to be able to dynamically draw circles in the ImageView, without disturbing the rest of my layout(textview/button). I'm trying to create a canvas, and use the drawcircle function within canvas to set the location of the circle. And then draw that canvas to my imageview in some way. I cannot get this to work, is there

Pygame how to fix 'trailing pixels'?

为君一笑 提交于 2019-11-26 18:01:09
In the image the red trail is a trail that pygame is creating when I have a bounding rectangle added around sprites. The sprite also does it and the simplest solution was to just clear the surface to black after each redraw. However attempting to do so on the entire main surface is not such a good idea. How can I fix this? ninMonkey Normally you will do: def draw(): # fill screen with solid color. # draw, and flip/update screen. But, you can update just dirty portions of the screen. See pygame.display.update() : pygame.display.update() Update portions of the screen for software displays update

Android: How to do this framing paint?

时间秒杀一切 提交于 2019-11-26 16:03:47
问题 I Have Some static images like below: Now, I want is, when i touch on the face or hand, then the selected color should be fill on that skin portion. See below image of result: So how to get the result like above ?? Redo and Undo Functionality Should be also there. I have try with the FloodFill color but doing that i can only able to do color in to the perticular portion. as FloodFill only fill the color till the same pixwl color comes. If the touch place pixel color get change the it will not

How to draw a line on an image in matlab?

ε祈祈猫儿з 提交于 2019-11-26 16:03:11
问题 I have two points lets say: P(x,y) [point lies at the top of image] P'(x',y') [point lies at bottom of image] Now i want to draw a line betwen these two points....and the line should appear on image means should be visible. how to do this???? 回答1: The simplest way to draw a line onto an image is to use PLOT. %# read and display image img = imread('autumn.tif'); figure,imshow(img) %# make sure the image doesn't disappear if we plot something else hold on %# define points (in matrix coordinates

How to draw a transparent stroke (or anyway clear part of an image) on the iPhone

时光毁灭记忆、已成空白 提交于 2019-11-26 15:14:50
问题 I have a small app that allows the user to draw on the screen with the finger. I have a UIImageView where the user draws, by creating a CGContextRef and the various CG draw functions. I primarily draw strokes/lines with the function CGContextAddLineToPoint Now my issue is this: The user can draw lines of various colors. I want to give him the ability to use a "rubber" tool to delete some part of the image drawn so far, with the finger. I initially did this by using a white color for the