drawing

Drawing a bordered path with sharp corners in Java

南笙酒味 提交于 2019-12-10 21:18:56
问题 I am working on an application that displays GPS tracks on a map. I want to draw the track as a colored path of arbitrary thickness. I found the GeneralPath class which seems to do just what I want. However, I want the colored path to also have a black border. I couldn't find anything about how to add a border to a path, so I came up with a quick hacky solution of drawing a thick black path first, and then drawing a thin colored path on top. SSCCE: import java.awt.BasicStroke; import java.awt

Drawing a line with a pixmap brush in Qt?

跟風遠走 提交于 2019-12-10 19:38:30
问题 For some time I'm developing a simple drawing and painting app with Qt/C++. Currently I'm using QPainter::drawLine() to draw, and it works fine. What I want to do is drawing with pixmap brushes, which in a way I can do. I can draw with single color filled pixmaps using QPainterPath and QPainter::strokePath(). I stroke the path with a pen using a brush with the pixmap. In case you're still reading, my problem is, if I use a QPen and QPainter::strokePath() I get a line with tiled brush. But I

Joined lines at certain angles have pointed vertexes instead of rounded

烈酒焚心 提交于 2019-12-10 19:19:18
问题 My app allows you to draw using a variety of tools. One of them lets you make an angle: you tap three times, then an angle is drawn for you. Unfortunately, it gets really pointy but then rounded again at certain angles for some reason. I'm using CGContextSetLineCap(context, kCGLineCapRound); Here is a picture to exemplify what I'm talking about: Does anyone know what causes this or how to fix it so it is round all the time?? For the most part, all I do is: CGContextMoveToPoint(context, first

Why does this this Swing bug occur when using repaint() and not with getParent().repaint()?

百般思念 提交于 2019-12-10 18:05:23
问题 This question is based on a problem I had a while back with a simple Swing dice program. The original question I posted is here and has an accepted answer, but I'd like to know exactly what is happening, why the problem occurs, and why the solution works. I managed to whittle down the original code to get to the core of the problem and it now looks very different: I have two ColorPanel s that each draw a coloured square when you click on a panel the box should change colour in this order:

How do I remove a UIBezierPath drawing?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:27:44
问题 I'm creating an app where you eventually have to sign, and I was wondering how you would clear the signature if they messed up? EDIT: Line Class: #import "LinearInterpView.h" @implementation LinearInterpView { UIBezierPath *path; // (3) } - (id)initWithCoder:(NSCoder *)aDecoder // (1) { if (self = [super initWithCoder:aDecoder]) { self.backgroundColor = UIColor.whiteColor; [self setMultipleTouchEnabled:NO]; // (2) [self setBackgroundColor:[UIColor whiteColor]]; path = [UIBezierPath bezierPath

Drawing a chart in WPF C# design questions

人盡茶涼 提交于 2019-12-10 15:45:37
问题 I had a project a month ago where I drew a stock chart in an application using Windows Forms. I did this by creating a bitmap that would stretch to the dimensions of the window. This would allow my chart to resize with the window. I am now expanding the project using WPF. I have been trying to work on my design for the project, but I cant seem to get any idea on the best way to do the same chart. I have looked at canvases, grids, and a few other controls. I thought I was on the right track

Wrong colors antialiasing with Pygame on OS X

谁说胖子不能爱 提交于 2019-12-10 15:24:10
问题 I'm using Pygame on a Macbook Pro (non-retina) running OS X. When I try to create an antialiased line or circle, it seems to be coming out as the wrong color. Here's an example: import sys, pygame, random, math import pygame.gfxdraw black = (0,0,0) white = (255, 255, 255) green = (0, 255, 0) pygame.init() size = width, height = 800, 600 screen = pygame.display.set_mode(size) # make the background background = pygame.Surface(screen.get_size()) #background.fill(black) background.fill(white)

javascript library for free form drawing

ぃ、小莉子 提交于 2019-12-10 15:12:02
问题 Is there a javascript library which lets me draw on a web page and then save the state of that drawing? I want to draw an 2D image using the mouse and then how to store and load that drawing 回答1: You should look at ProcessingJS. 回答2: Use HTML5 Canvas. A simple example for drawing images is here: http://jsfiddle.net/ghostoy/wTmFE/1/. I recommend this online book: Dive Into HTML5. 回答3: If you want the free drawing to work with touchscreens, I recommend Fabric.js: Demo Tutorial Code: <canvas id=

iOS draw line with both arrow with start-end point while finger touch end and rotate from start or end point

亡梦爱人 提交于 2019-12-10 15:06:39
问题 I need help making a drawing demo. When the user draws a line using their finger, the line has directional arrows on both ends. When their finger releases, it draws the line with "?" (question-mark) in center of the line. Then, when user taps on the "?", it will show a new view and the user can enter a value, and the value is in that line. And we can add multiple lines on capture-image and also we can delete selected line. I don't understand how can I start developing these features so please

Find the third point

拟墨画扇 提交于 2019-12-10 14:52:09
问题 I have 2 points P1 and P2 . I need to find the P3 , in order that all points to be on the same line; P3 should be at the distance d from the P2 (away from P1 ) I started a complicated system apparently hardly to resolve... PS. Vectorial answers is cool, but I use C# and don't know how to add vectors over there. 回答1: P3 = P2 + d * ±(P2 - P1) / |P2 - P1| EDIT: Because shopping is easy: mag = sqrt((P2x - P1x) ** 2 + (P2y - P1y) ** 2) P3x = P2x + d * (P2x - P1x) / mag P3y = P2y + d * (P2y - P1y)