drawing

Drawing lines with clickable points using JavaScript

青春壹個敷衍的年華 提交于 2019-12-12 01:32:53
问题 I'm interested in doing some drawing using JavaScript. I'll get straight to an example: alt text http://img693.imageshack.us/img693/3774/linep.png The green horizontal line would be static, and all the vertical lines would be clickable. An example of a clicked line would be the red one. I've seen many API's, but they all allow more complexity than I need, making it more complicated than necessary. Any suggestion for a good API? Make it oneself? 回答1: You could use CSS and html to make up the

Convert piece of canvas to blob type

偶尔善良 提交于 2019-12-12 01:19:12
问题 I am trying to optimize some code that uses the canvas.drawImage() call. This is a pretty expensive call when called several hundreds or thousands of times. Found out about the canvas.toBlob(callback) method but I want to know if there is a way to get only a section of the canvas. drawimage() gives much more fine grain control over which sections should be draw. canvas.drawImage(canvas, sx, sy, sw, sh, dx, dy, dw, dh); Any suggestions / thoughts are welcomed! 回答1: The canvas.toBlob method is

Drawing filled circle using trigonometry [duplicate]

若如初见. 提交于 2019-12-12 00:29:08
问题 This question already has answers here : How to draw a filled circle? (2 answers) Closed 4 years ago . Is there any function I can create in order to draw a filled circle using the base drawing functions: putpixel(x, y); lineto(x, y); ? Note that it must use trigonometric functions (videlicet sin , cos etc..) so I can easily turn it into a hexagon and even further - a square or another type of polygon. And finally, not necessarily but always appreciated if it isn't very slow in drawing (one

Draw image in canvas with decimal values

狂风中的少年 提交于 2019-12-11 23:52:20
问题 I am trying to draw an image originating from a list of X,Y values that represent the start and stop points of a line. They are in inches, so they are currently formatted in to decimals. The problem I am having is with the drawing. The MoveTo and LineTo commands require an integer not a double. If I use the Round(float) math operation, you see the output below. The rounding results in the same start and stop point, so nothing is drawn. How can I draw my shape from a list of decimal X,Y points

Drawing OCX to given printer-devicecontext

十年热恋 提交于 2019-12-11 20:11:04
问题 In order to print some data I have to print an OCX as well. To do so I create a printer-dc from the GUI, print on it and so on. When it comes to printing the OCX I want to use its existing Draw-Method but to the printer-devicecontext I have. The code shown seems to work but look kind of hacked to me and I'm not sure if it works just "by accident". So the question is: Is this the right way to give a device-Context via Com-call to the OCX and use it? This is in an Visual-C++-MFC-Project

UIBezierPath Array rendering issue (How to use CGLayerRef for optimization)

只愿长相守 提交于 2019-12-11 18:49:36
问题 friends, I am working with UIBezierPaths, for free hand drawing , and everything works fine, for this I am storing my paths in a path array, everything works fine, while rendering, I am looping the whole array and rendering the paths,but soon as the array count increases, I see a lag while drawing, below is my drawRect code. please help me out in finding where I am going wrong - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *mytouch=[[touches allObjects]

Drawing on PDF file C#

一世执手 提交于 2019-12-11 18:28:29
问题 I need to write a PDF file from my WPF app. I've seen some 3rd party libraries to create PDF files, but I couldn't find any that would allow me to write boxes, or any shape for the matter. Do I have to use some 2D library from .NET or is there any PDF library that provides that type of work? This is what I need to draw: I'll have a list of objects List<ObjX> list; that I'll use to fill each box. Think of it as a Personal Data list of all employees, for instance. ______________________________

Drawing a line by mouse in a panel

六眼飞鱼酱① 提交于 2019-12-11 18:14:27
问题 I want to draw a line by mouse(interactively) , I used C# and WinForm, the line should appear at any time from the starting point(when the mouse press on the panel) to the current position of the mouse, exactly like drawing a line in Paint program. but the code produces a lot of lines, i know why but i don't know how to overcome this problem Here is my code: namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Graphics g; Pen myPen

How to draw a drop shadow on ellipse?

风格不统一 提交于 2019-12-11 18:05:07
问题 g.FillEllipse(Pens.Black, ClientRectangle.X, ClientRectangle.Y, 60, 60); This is my code of ellipse. So I want to make transparent shadow for it, with adjustable size of shadow if possible. 回答1: There is no ready-made drop shadow in winforms but you can get a nice effect by drawing a few semitransparent ellipses before drawing the real one: Don't let the code fool you: The drop shadow is effectively created by only three lines. private void panel1_Paint_1(object sender, PaintEventArgs e) {

Is there a way to draw under names in MKMapView?

坚强是说给别人听的谎言 提交于 2019-12-11 16:35:09
问题 I've looked at the many fine threads on how to draw routes on an MKMapView and didn't see anything on this. I want to be able to draw information (e.g. traffic flow imagery for routes, possibly annotations) over the map terrain but under road names and numbers etc. It seems likely that there's no way to do this since the map / road names aren't exposed as separate layers in the mapkit? It does sound like I could draw a route under road names but that's because I can use Apple's API for that