draw

How to draw a Line in ImageView on Android?

你离开我真会死。 提交于 2019-11-27 21:34:29
I'd Like to know how to draw a Line on ImageView as user swipe their finger ? Could any body explain this ? Or perhaps any Link to get start on this. You must have your own ImageView and override onDraw function. Use something like this public class MyImageView extends ImageView{ public MyImageView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); canvas.drawLine(0, 0, 20, 20, p); } } and in your main class create object MyImageView ; and when you touch

How to draw rectangle on MouseDown/Move c#

≯℡__Kan透↙ 提交于 2019-11-27 20:51:08
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.CreateGraphics().DrawRectangle( Pens.Black , rec ); } } But the problems it that I dont want all the

Paint/Draw on top of docked widgets in QDodckWidget

一个人想着一个人 提交于 2019-11-27 18:43:13
问题 I have a class in Qt that inherits QDockWidget. And that class contains another widget. Is there any possibility to define a function in my QDockWidget inherited class that draws stuff on top of the contained widget? Like the painting to be independent of the contained widget but to be linked to the inherited class. Thank you 回答1: Sure it's possible. It is fairly simple to do, in fact. You need to place a child widget that sits on top of everything else in your QDockWidget . To do it so, it

Draw equidistant points on a spiral

谁说我不能喝 提交于 2019-11-27 18:23:30
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: (..., ...) ........ Point N (..., ...) The programming language isn't important and all help greatly appreciated! EDIT: I

How to draw a gradient line (fading in/out) with Core Graphics/iPhone?

和自甴很熟 提交于 2019-11-27 17:44:29
I know how to draw a simple line: CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); And I know how to do a gradient rectangle, i.g.: CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRGB(); size_t num_locations = 2; CGFloat locations[2] = { 1.0, 0.0 }; CGFloat components[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; CGGradientRef myGradient = CGGradientCreateWithColorComponents(myColorspace, components, locations, num_locations); CGPoint myStartPoint, myEndPoint;

Drawing rectangles on a JPanel

喜夏-厌秋 提交于 2019-11-27 16:22:25
I have a JScrollPane and on top of it I have a JPanel named 'panel1'. I want some rectangles to be drawn on this JPanel. I have a class named DrawRectPanel which extends JPanel and does all the drawing stuff. The problem is that, I tried to draw the rectangles on panel1 by writing the following code : panel1.add(new DrawRectPanel()); but nothing appeared on panel1 then I tried, just as a test to the class DrawRectPanel : JFrame frame = new JFrame(); frame.setSize(1000, 500); Container contentPane = frame.getContentPane(); contentPane.add(new DrawRectPanel()); frame.show(); This worked, and

Android: How to fill color to the specific part of the Image only? [duplicate]

不想你离开。 提交于 2019-11-27 15:15:55
问题 This question already has answers here : how to fill color in image in particular area? (4 answers) Closed 2 years ago . I have Image Like this: Now, i want to fill the color to the Specific part of that image. as like If i select color blue and if i touch on Cap then the cap should be fill with the color Blue. Same thing should be also happen with the other part like nose, Mouth, Eyes etc So, How it is possible using android ? Can any budy help me please. Updated I have try with the

Class is not abstract and does not override abstract method

夙愿已清 提交于 2019-11-27 13:38:54
So I've been working on a homework on abstraction for my programming class and fell into a problem. The goal for me right now is to be able to use abstraction, then later be able to draw with rectangles and ovals a simple city, like a rectangular building or a oval light on a light post. The error I am receiving when I compile is: MyTestApp.Rectangle is not abstract and does not override abstract method drawEllipse(java.awt.Graphics) in MyTestApp.Shape. This Error shows up on the line "class Rectangle extends Shape{" right below the class Shape. My question is what am I doing wrong with my

JavaFx 2.x : How to draw dashed or dotted lines?

北城余情 提交于 2019-11-27 13:03:34
问题 I would like to dynamically change the draw of a line from solid, dotted or dashed: it seems I have to use line.setStroke, is it the correct method? And, how to accomplish this? Thanks 回答1: No that is not the correct method, setStroke sets the color of the stroke. Correct method is getStrokeDashArray().add() : Line line1 = new Line(20, 40, 270, 40); line1.getStrokeDashArray().addAll(25d, 20d, 5d, 20d); Line line2 = new Line(20, 60, 270, 60); line2.getStrokeDashArray().addAll(50d, 40d); Line

Android: Drawing a canvas to an ImageView

拟墨画扇 提交于 2019-11-27 12:39:09
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 a trick to this? Or is my method fundamentally wrong? How would i go about drawing circles to the