drawing

How to paint additional things on a drawn panel?

南楼画角 提交于 2019-12-25 09:29:10
问题 I'm reading a lot about C# drawing and reading MSDN tutorial on GDI+ using Graphics handlers. I want to be able to paint a graph, which nodes I have in a list but I can't use auto-placing, I need the nodes to be in a specified place and have specific appearance and so on, changing over time, that's why I stopped looking for graph libraries. It all works great when painted for the first time but when I want something painted after something else happens in the code (not after clicking the

onclick function button change canvas

百般思念 提交于 2019-12-25 08:56:36
问题 I have the following code creating an animated series of lines in canvas. I would like to change the context being drawn in the canvas depending on certain DOM elements being clicked. I have the following html: <style> *{ overflow: hidden; margin: 0; width: 100%; height: 100%; } .c{ background: black;} </style> <canvas class='c'>waves</canvas> <div style="width:100%; height:100%; position:absolute; top:0; left:0;"> <center> <img id="click" style="margin:0 auto; position:relative; top:20%;

Adding multiple touch listeners inside canvas Android

让人想犯罪 __ 提交于 2019-12-25 08:15:46
问题 Suppose I have multiple drawings in my canvas, how can I add touch listener for each of the drawings seperately inside that canvas? I will be having different drawings like star, circle, rectangle etc etc added dynamically how can I handle each of them ? I couldn find ans in SO the very close question was this Set touch listeners on canvas drawings but it has no ans. Help and suggestions will be appreciated. Thanks in advance :) 回答1: Actually you can't add any touch listener on the drawings

How to flip alignment of drawn content in a panel

筅森魡賤 提交于 2019-12-25 07:03:20
问题 I am using two panels for drawing ruler along the sides (top and left) of a picture box. It works, but now my requirement is to flip the direction of the ruler so that the line starts from the picture box and the text (numbers) are the top. How can I do this? My code is as follows: private void panel2_Paint(object sender, PaintEventArgs e)//left Panel { Graphics g = e.Graphics; g.PageUnit = GraphicsUnit.Millimeter; int step = 1; int length = panelleft.Height / 3; int small = 5; int big = 10;

Action script 3 drawing app undo and redo function

若如初见. 提交于 2019-12-25 05:56:55
问题 Can anyone show me how can I make undo and redo function? so this is my current action script. I cant figure how to do it and i see some example in some web site, the action script is to long to under stand. Pls show a simple way that i can make this work.. sorry for bad grammar... import flash.display.MovieClip; import flash.events.MouseEvent; var pen_mc:MovieClip; var drawing:Boolean = false; var penSize:uint = 1; var penColor:Number = 0x000000; var shapes:Vector.<Shape>=new Vector.<Shape>(

Huge FPS drop when PictureBox have an Image - Is there a way to improve the FPS of this WinForm code sample?

岁酱吖の 提交于 2019-12-25 05:32:18
问题 I'm looking for the fastest way to refresh an image (and draw some shapes) on a Winform. I'm using a PictureBox now, but I'm open for suggestions. The way I'm getting the max FPS possible I took from here: "My last post on render loops (hopefully)" This is a game loop pattern, but it can also be used to other purpose, like to display live images acquired from a camera. I'm drawing a red circle in different positions. As you can see, the FPS drops a lot when a Bitmap is loaded at the

Drawing translucent shapes without overlapping

痞子三分冷 提交于 2019-12-25 05:16:15
问题 I am drawing several circles with transparency. The number of circles and their positions are not fixed. Currently I am setting the transparent color in a Paint object and drawing the circles in a for loop with the Canvas object. But that causes overlapping. I have thought of a method: - Render all the circles as opaque on something other than the main canvas. - Set the transparency. - Draw the final object on canvas. How do i implement that on android? 回答1: Create a new bitmap with ARGB888,

How to avoid overlapping polygon

浪尽此生 提交于 2019-12-25 04:36:11
问题 I created a program to draw many polygons automatically everytimes user presses a button. The points of the polygon are generated automatically using the random function. The problem is that, since the points of the polygon were randomly generated, some of the polygon are overlap with other polygon. How can I avoid this, so that every polygon shown without being overlapped? ..... List<Polygon> triangles = new LinkedList<Polygon>(); Random generator = new Random(); public void paintComponent

Qt - draw inside QScrollArea in a QDialog

假如想象 提交于 2019-12-25 04:24:20
问题 In Qt 5, I have a QDialog window on which I have drawn a circle as follows: void MyDialog::paintEvent(QPaintEvent *pe) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing,true); QPen pen(Qt::blue,2); painter.setPen(pen); QRect r=QRect(0,0,100,100); painter.drawEllipse(r); } If I draw a larger circle, for example by using QRect(0,0,500,500); , the circle being greater than the dialog window is clipped. So I dragged a QScrollArea onto the the dialog window and decide to draw

HTML5 Canvas Drawing History

懵懂的女人 提交于 2019-12-25 03:48:21
问题 I'm curious to know how applications such as Adobe Photoshop implement their drawing history with the ability to go back or undo strokes on rasterized graphics without having to redraw each stroke from the beginning... I'm wanting to implement a similar history function on an HTML5 drawing application I'm working on but duplicating the canvas after every stoke seems like it'd use too much memory to be a practical approach, especially on larger canvas'... Any suggestions on how this might be