drawing

How to know if a GraphicsPath contains a point in C#

泪湿孤枕 提交于 2019-12-19 05:54:33
问题 I'm using .NET to draw a diagram, and I want to highlight objects when the user performs a click on them. It is easy when a figure is fully contained in a rectangle: if (figure.Bounds.Contains(p)) // bounds is a rectangle But I don't know how to manage it if the figure is a complex GraphicsPath . I have defined the following GraphicsPath for the figure (the green circle). I want to highlight the figure when the user click on it. I would like to know if a Point is contained in that

Drawing a squircle shape on canvas (Android)

对着背影说爱祢 提交于 2019-12-19 04:08:46
问题 Here is what I'm using to draw a circle shape on to the canvas (and then an icon bitmap on it): private static Bitmap makeIcon(int radius, int color, Bitmap icon) { final Bitmap output = Bitmap.createBitmap(radius, radius, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(output); final Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(color); canvas.drawARGB(0, 0, 0, 0); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) canvas.drawCircle(radius / 2, radius /

filling a canvas shape with text

那年仲夏 提交于 2019-12-19 03:59:32
问题 i am trying to figure out how to add a text to a canvas shape for example here is my Code : var text ="5"; // text to display over the circle context.fillStyle = "red"; context.beginPath(); context.arc(50,70, 10, 0, Math.PI * 2); context.closePath(); context.fill(); i would very much appriciate it if someone would help me adding the text to the shape thanks in advance. EDIT i figure out that i need to write again on the canvas so this is what i got so far ... but the text doesnt allign to the

How to draw good looking arrows in Matlab?

扶醉桌前 提交于 2019-12-19 02:58:41
问题 I have been trying to draw arrows in Matlab in my figure but they all look terrible. Also, I want my arrowhead to be a solid triangle, not a V. I tried using the packages available on the Matlab File Exchange: arrow, arrows, arrows3, and probably at least one other one. I even tried manually creating an arrow in the Matlab figure editor, but when I adjust the line width, the arrow looks like this: I used the annotation command to create the arrow above: annotation(gcf,'arrow',[0.621875 0

Curve fitting a series of line segments

放肆的年华 提交于 2019-12-18 17:32:40
问题 There are a lot of curve fitting questions on SO but I can't seem to find one that addresses what I'm looking for. The scenario is simple: I capture X/Y points on a tablet screen. I'd like to draw the resulting line segments as a smooth curve instead of a series of line segments. Many apps do this, for example: Penultimate (sketching demo at 0:36) or Autodesk Sketchbook. Bezier curve algorithms take a fixed number of points to draw a curve and don't seem to work well with numerous multiple

How to go about creating a race track game? [closed]

独自空忆成欢 提交于 2019-12-18 17:03:10
问题 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 . i am planning to make racing game in android.I have created many applications in different mobile technology. but i am pretty much beginner for game application. So my question is how can i make race track in android? How should i show that car is moving on that race track. I have

IOS: draw a line with your finger

北慕城南 提交于 2019-12-18 16:59:26
问题 I want to know what's the approach to draw a line with a finger in a white view. I want to do an artboard, and I want begin to understand how draw a simple line or a track done with a finger. How can I do it? 回答1: I have understood your problem. Please see the bellow code.It will use full for you. -(void)intializeDrawImage { drawImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100, 320, 320)]; [drawImage setBackgroundColor:[UIColor purpleColor]]; [drawImage setUserInteractionEnabled

How to draw in the nonclient area?

こ雲淡風輕ζ 提交于 2019-12-18 15:48:11
问题 I'd like to be able to do some drawing to the right of the menu bar, in the nonclient area of a window. Is this possible, using C++ / MFC? 回答1: Charlie hit on the answer with WM_NCPAINT . If you're using MFC, the code would look something like this: // in the message map ON_WM_NCPAINT() // ... void CMainFrame::OnNcPaint() { // still want the menu to be drawn, so trigger default handler first Default(); // get menu bar bounds MENUBARINFO menuInfo = {sizeof(MENUBARINFO)}; if ( GetMenuBarInfo

Create layer list with rounded corners programmatically

▼魔方 西西 提交于 2019-12-18 15:17:31
问题 I am currently trying to convert the following XML to be created programmatically so that I can set the top corners and bottom corners as needed throughout my project. It is a simple Layer list that has two rectangles; one on top of another. I would like to use this as a background for a few different views so it is important that the result scales. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="20dp"> <shape android:shape="rectangle" > <size

how to draw CALayer with line path like simulate eraser effect?

落爺英雄遲暮 提交于 2019-12-18 13:48:07
问题 I want to simulate eraser effect with touch event to show a image that behind something block on top, eg, gray color; Something like that: I have find for a long time for the solution but I can't do it well. following is my custom view code: CustomView.m: -(id)initWithCoder:(NSCoder *)aDecoder { if (self = [super initWithCoder:aDecoder]) { [self setup]; } return self; } -(id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setup]; } return self; } -(void