draw

Android: How to do this framing paint?

百般思念 提交于 2019-11-27 12:31:36
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 fill color on it. So Usinf FloodFill i got the result like below image, If i press on the hand, then

How to create MS Paint clone with Python and pygame

与世无争的帅哥 提交于 2019-11-27 11:34:21
问题 As I see it, there are two ways to handle mouse events to draw a picture. The first is to detect when the mouse moves and draw a line to where the mouse is, shown here. However, the problem with this is that with a large brush size, many gaps appear between each "line" that is not straight since it is using the line's stroke size to create thick lines. The other way is to draw circles when the mouse moves as is shown here. The problem with this is that gaps appear between each circle if the

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

和自甴很熟 提交于 2019-11-27 10:37:34
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 stroke (set with the CGContextSetRGBStrokeColor function) but it didn't work out...because I discovered

Draw line animated

纵饮孤独 提交于 2019-11-27 09:42:32
问题 I want to have a line in the center of the screen and animate it like a snake This is step by step animation I want to make How can I do this? 回答1: You can animate the end of the stroke of a path on a CAShapeLayer , e.g., weak var shapeLayer: CAShapeLayer? @IBAction func didTapButton(_ sender: Any) { // remove old shape layer if any self.shapeLayer?.removeFromSuperlayer() // create whatever path you want let path = UIBezierPath() path.move(to: CGPoint(x: 10, y: 50)) path.addLine(to: CGPoint(x

Measuring text width to be drawn on Canvas ( Android )

若如初见. 提交于 2019-11-27 09:38:37
问题 Is there a method which returns the width ( in pixels ) of a text to be drawn on an Android canvas using the drawText() method according to the Paint used to draw it? 回答1: Have you looked at android.graphics.Paint.measureText(String txt)? 回答2: Paint paint = new Paint(); Rect bounds = new Rect(); int text_height = 0; int text_width = 0; paint.setTypeface(Typeface.DEFAULT);// your preference here paint.setTextSize(25);// have this the same as your text size String text = "Some random text";

How to draw a rectangle around multiline text

一曲冷凌霜 提交于 2019-11-27 08:47:28
问题 I am trying to draw a rectangle around multiline text in iText. The user will be able to enter some lines of text. The font size of the text might be different and it can be formatted (bold, underlined...). I use this code to draw the text: ColumnText ct = new ColumnText(cb); Phrase phrase = new Phrase("Some String\nOther string etc...\n test"); ct.setSimpleColumn(myText......); ct.addElement(phrase); ct.go(); I know how to draw a rectangle, but I am not able to draw a rectangle outlining

Draw a semi ring - JavaFX

爱⌒轻易说出口 提交于 2019-11-27 07:52:57
问题 I would like to know how to draw a semi circle in JavaFX. I tried to use Shape and QuadCurve but I couldn't make a perfect semicircle. Here is a picture of what I'm trying to draw : 回答1: The picture you linked is actually a semi-ring. You can get it in JavaFX by drawing nested 2 arcs and some lines. But my preferred way is to use the Path . public class SemiDemo extends Application { @Override public void start(Stage primaryStage) { Group root = new Group(); root.getChildren().add

HTML / Java Script Canvas - how to draw an image between source and destination points?

放肆的年华 提交于 2019-11-27 06:29:12
问题 I've tried to use the drawImage function of the canvas. In the documentation (http://msdn.microsoft.com/en-us/library/ie/ff975414(v=vs.85).aspx) I thought the last two parameters are the destination point, but I guess it's not because it's not working. Is there a way to draw image between two points without rotate it or something like this? Thanks! 回答1: context.drawImage( sourceImage, sourceX, sourceY, sourceWidthToClip, sourceHeightToClip, canvasX, canvasY, scaledWidth, scaledHeight ); In

How to outline a TextView?

泪湿孤枕 提交于 2019-11-27 06:18:16
问题 What I want to do? (blue will be changed as white) What I did? I have found a class which extends TextView that able to outline textview very close to what I want. The problem is that I could not change stroke color to any color, it draws always as black. How to set border color as white? What is my output: Where are my codes? public class TypeFaceTextView extends TextView { private static Paint getWhiteBorderPaint(){ Paint p = new Paint(Color.WHITE); return p; } private static final Paint

Any alternative to calling getGraphics() which is returning null

泪湿孤枕 提交于 2019-11-27 05:11:42
Frequently when I call getGraphics() it returns null, even if I set the xxx.getGraphics(); xxx to be visible (as a Google search shows...) But this doesn't work, and this frustrates me as it is easy and simple to do in C-Sharp. Does anyone know of a better way of doing this instead of using getGraphics()?? You usually don't want to use getGraphics on a Java Swing component since this will be null if the component has not been rendered yet, and even if the component has been rendered and the Graphics object returned is not null, it will usually be a short-lived object and will not work properly