drawing

Combining Intersecting CGPaths on iOS

冷暖自知 提交于 2019-12-21 05:09:06
问题 I have a problem in an app I'm working on. Say I have two CGPaths that are fairly complex and I add them both to a CGMutablePath (thus combining them). Well, where the two paths intersect there will be points inside of each other. I want to eliminate those inside points and essentially draw the outside or outline of the path. I am having difficulty figuring out how I would go about this. Edit: Here's an example of what I am talking about. The blue and red boxes represent points along the

Drawing a triangle in a coordinate plane given its three sides

拈花ヽ惹草 提交于 2019-12-21 05:07:14
问题 The length of three sides of the triangle, a, b and c will be given, and I need to find the coordinates of the vertices. The center (probably the circumcenter) can either be the origin or (x,y). Can anyone point me in the right direction? 回答1: I've read brainjam's answer and checked whether his answer is true and he is right. Calculation: O(0;0), A(a;0) and B(x;y) are the three points of the triangle. C1 is the circle around A and r1 = c; C2 is the circle around O and r2 = b. B(X;Y) is the

WPF Canvas - Single Pixel Grid

巧了我就是萌 提交于 2019-12-21 04:52:13
问题 I have a custom WPF Canvas, upon which I would like to show a grid. I do so by overriding the OnRender method on Canvas, and using the DrawingContext drawing functions. IsGridVisible, GridWidth, GridHeight are the number of pixels between each grid line horizontally and vertically respectively. I also use a ScaleTransform on the Canvas.LayoutTransform property to zoom the Canvas items and as one expects, the grid line thicknesses are multiplied by the ScaleTransform scaling factors as shown

Emboss edges of a image shape showing the depth in android

限于喜欢 提交于 2019-12-21 04:41:04
问题 I want to show 3D embossed look and feel as shown in following image. I used EmbossMaskFilter but cannot get it to show the effect (see code below). Is there a different way to do this? or how can I use the EmbossMaskFilter for this. Required output My output Path path2 = new Path(); public Paint fillPaint = null; // called in constructor public void createPath() { //path 2 Big one araay = new Point[]{new Point(144,320),new Point(109,200), new Point(171,308),new Point(178,240),new Point(171

Bezier Path with dynamic change of width

戏子无情 提交于 2019-12-21 04:37:19
问题 I want to create bezier path with dynamically changing line's width. I need spending the same amount of color on each part of line. So, longer line should be thinner. And shorter line should be bold. Or, at least, line should change it's width from beginning to the end. Any ideas how to achieve it? Thank you. 回答1: the only way to achieve this is with multiple UIBezierPath s of different thickness and colour. 来源: https://stackoverflow.com/questions/7345251/bezier-path-with-dynamic-change-of

Bezier curve through three points

社会主义新天地 提交于 2019-12-21 03:16:06
问题 I have read similar topics in order to find solution, but with no success. What I'm trying to do is make the tool same as can be found in CorelDraw, named "Pen Tool". I did it by connecting Bezier cubic curves, but still missing one feature, which is dragging curve (not control point) in order to edit its shape. I can successfully determine the "t" parameter on the curve where dragging should begin, but don't know how to recalculate control points of that curve. Here I want to higlight some

How to create UIBezierPath gradient fill?

旧城冷巷雨未停 提交于 2019-12-21 02:42:26
问题 I would like to create a UIBezierPath with 10px rounded corners and with gradient fill. How can I acheive this effect? Here's an image of what I want to do: As you can see, this square has: 2px black border 10px rounded corners red to green linear gradient fill How can I do this programatically without using pattern image color ? Here's how I create the path: UIBezierPath *border = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10.0f]; [border setLineWidth:2]; [[UIColor

Android custom brush pattern/image

早过忘川 提交于 2019-12-21 02:25:10
问题 I have an 8x8 Image. (bitmap - can be changed) What I want to do is be able to draw a shape, given a Path and Paint object onto my SurfaceView . At the moment all I can do is fill the shape with solid colour. How can I draw it with a pattern. In the image you can see the brush pattern (The cross). It can be anything from a cross to a donut or an elf. How would I go about drawing this pattern background. I also eventually want to apply colours to it. So far, my theory is to create a clip area

Drawing arrow with XAML

☆樱花仙子☆ 提交于 2019-12-20 20:02:46
问题 I don't know how can I draw an arrow with XAML. I haven't any code at the moment. Someone can help me to make this draw with XAML code ? Thank you for your help. 回答1: You can use TextBlock (http://xahlee.info/comp/unicode_arrows.html) <TextBlock Text="➔" /> Or Path (https://msdn.microsoft.com/en-us/library/system.windows.shapes.path%28v=vs.110%29.aspx) <Path Stroke="Black" Data="M 0 4 L 16 4 L 10 0 M 16 4 L 10 8" /> 回答2: I just draw one through setting point by hand and adjust the point by

How to Draw something with your finger in an Android App… And save it to the web

可紊 提交于 2019-12-20 14:19:24
问题 **THIS QUESTION WAS SUCCESSFULLY ANSWERED AND HAS BECOME A BLOG POST <- click ** Hi I am a PHP developer I want to do a simple thing - I want to draw something drawn on a blank page on an Android Phone (with a finger with a largeish "emulated pen nib") and store the bitmap as a jpeg on a server by http post. Here is what I have so far but this is taken from a tutorial that is involved with writing sprites for a game.. And I cant' adapt it package com.my.example; import android.app.Activity;