drawing

Circles in circles fading out, creating a target

柔情痞子 提交于 2019-12-24 11:14:05
问题 I want to create a graphics whereby circles are overlapped and their colour fades out, also the circles should have a white space in between each other, something similar to this: Here is how far I've got: import java.awt.*; import java.awt.geom.*; import javax.swing.*; import java.awt.event.MouseListener; import java.awt.event.MouseEvent; class Circles extends JPanel implements MouseListener { public void mouseReleased(MouseEvent event) { } public void mousePressed(MouseEvent event) { }

Disposing of System.Drawing Objects

ε祈祈猫儿з 提交于 2019-12-24 11:01:08
问题 Is it necessary to manually manage the lifetime of System.Drawing objects? Currently I am employing 'using' statements to minimise the lifespan of Brushes and other Drawing objects e.g. using ( Brush br = new SolidBrush( color ) ) { // Do something with br } Is this necessary or is it safe to let the garbage collector work its magic when and if it needs to? As a quick aside to the question... what do people think is the cleanest way to achieve this? 回答1: It is good to Dispose of System

Invalid Pointer Operation + Runtime Error with custom drawing

你。 提交于 2019-12-24 10:37:43
问题 I'm working on a simple little app which has 1 image and 3 timers. The goal is to draw a number of balls chasing back and forth with a decaying color after each one. It looks something like this: Now the problem is when I close the application, I get a number of errors in this order, and does not give me a breakpoint in the code. It only happens when it's moving from the right to the left, not from the left to the right. I thought it probably had to do with the timer(s) continuing after the

Draw Rectangle over PictureBox

爷,独闯天下 提交于 2019-12-24 07:27:21
问题 The next code lets you draw Rectangles in the Form with mouse clics. Why not, or how can be draw over a PictureBox? Public Class Form1 Dim SelectRect As Rectangle = New Rectangle() Dim ps As Point = New Point() Dim pe As Point = New Point() This catch the first click, starting point or corner of the rectangle Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown SelectRect.Width = 0 SelectRect.Height = 0 SelectRect.X = e.X

How can I create a transparent System.Windows.Forms.Panel on top of two other already existing Panels then draw a line on my transparent panel?

拈花ヽ惹草 提交于 2019-12-24 06:39:00
问题 I'm writing a form in C# and have several panels. I need to draw a line between two of the panels. I've found online several ways to go about this, the most promising appears to be to create a third panel, make it transparent, place it on top of my original panels and draw the line here. I'm not able to get the panel to be transparent, even if I set its BackColor and ForeColor properties to transparent (in code or in design view of VS). Any ideas on how to make the panel itself transparent

What exactly does getSubimage() of BufferedImage do?

ぃ、小莉子 提交于 2019-12-24 04:26:06
问题 I'm working on a 'drawing' application. The entire 'drawing' is constantly stored in a BufferedImage object (using a constant update loop). Let's call it drawingArea . I'm implementing a selection tool, using the BufferedImage class' getSubimage() method. The user uses this tool to select an area of the drawing, and paste it anywhere on the drawing. The user selects an area by dragging the mouse, and when he/she releases the mouse, the selected area is stored in a BufferedImage . This is done

Draw smooth line in InkCanvas WPF with Kinect

烂漫一生 提交于 2019-12-24 02:11:14
问题 I'm trying to create simple app that tracks right wrist position and draw line (or rather path with curves) as it moves (the exact behaviour of InkCanvas control using mouse when left mouse button is pressed). So I track position change of RightWrist and draw line this way: public void Paint(Point startPoint, Point nextPoint, InkCanvas paintSurface) { Line line = new Line(); if (currentPoint.X == 0 && currentPoint.Y == 0) { currentPoint = new Point(); currentPoint = startPoint; } line.Stroke

iOS - Brush that doesn't overlay itself

拜拜、爱过 提交于 2019-12-23 22:29:23
问题 When you draw by a brush in Photoshop it doesn't overlap itself until you release mouse button and press it again. I found these images, that let me explain myself better. Now my drawing works the right way, but i want them to work like the left one. If it's even possible I wish It wouldn't overlay itself even after user releases finger and start drawing again, but I'll go with basic photoshop-like brush. I guess creating brush that never overlap itself is simmilar with creating an eraser, in

BlackBerry - how two merge two images

自闭症网瘾萝莉.ら 提交于 2019-12-23 21:39:06
问题 I want to merge two images in blackberry. one image is a big image and other image is a small one. position of small image will be define by developer. what are the possible ways? 回答1: You can use the Graphics class to draw multiple Bitmaps onto it in different offsets. Look into the Graphic.drawBitmap function. We use something like: graphics.drawBitmap(x1, y1, icon.getWidth(), icon.getHeight(), icon, 0, 0); Where the graphics object is the one passed by the paint method we override and icon

Python Qt bindings: setCosmetic() and sceneRect(), problems with margins

和自甴很熟 提交于 2019-12-23 20:25:50
问题 With the following simple example (which works well with either PySide or PyQt4): import sys import random import numpy from PySide import QtGui, QtCore class Window(QtGui.QWidget): def __init__(self): super(Window, self).__init__() self.resize(600, 400) self.view = QtGui.QGraphicsView() self.scene = QtGui.QGraphicsScene() self.view.setScene(self.scene) self.setWindowTitle('Example') # Layout layout = QtGui.QGridLayout() layout.addWidget(self.view, 0, 0) self.setLayout(layout) # Styles self