draw

Drawing SVG with Mouse

白昼怎懂夜的黑 提交于 2019-12-04 14:25:46
问题 I having be exploring several options for building an open-source HTML5 based application like Sketch, which will basically be vector based app for creating UI screens etc. I saw several great JS Libraries like http://snapsvg.io, http://paperjs.orgetc... And creating a static SVG element is as simple as below: var s = Snap("#svg"); // Lets create big circle in the middle: var bigCircle = s.circle(150, 150, 100); What I am not having clue about is, binding the job to mouse move event. So if

How to allow only one feature/polygon to be edited at a time with Leaflet?

荒凉一梦 提交于 2019-12-04 14:20:17
问题 It's been days I'm trying to solve my problem. I have a polygon layer from a GeoJSON. I want to edit my polygons with the click event. When I click on a polygon it becomes editable but what I want is that when I click on another polygon, the first polygon is no longer in editable mode. OpenLayers but naturally does not Leaflet. Here's an excerpt from my code: var editableLayers = new L.FeatureGroup().addTo(map); var polygon_json; $.ajax({ type: "GET", dataType: "json", url: "get_json.php",

iOS- How to paint in the within limits

て烟熏妆下的殇ゞ 提交于 2019-12-04 12:55:12
I used the scanning line seed filling algorithm to realize the color filling function. But I don't know how to do that. When my pen lands in the flower, I need to draw only Inside the black edge of the flower,do not draw in the hair. I have tried to use : CALayer *layer = [CALayer layer]; layer.contents = (__bridge id)(image.CGImage); self.drawView.layer.mask = layer; But the plan didn't work. if any one gives solution it would be so great,Thank you. (English is not my native language; please excuse typing errors.) Use a two pass approach. Use the same algorithm as the fill algorithm to create

Android draw path

半城伤御伤魂 提交于 2019-12-04 12:19:01
问题 It is not good idea to construct path object every time when call Draw method. Is it better to keep path object and clear/set points every time? Update: One more question - what is difference between 'reset' and 'rewind' path object? 回答1: Yes, it is better to reset the path and set the points rather than instatiating a new one. This prevents excessive allocation of memory, which can lead to frequent garbage collection. When the GC runs the graphics may pause for a moment, especially on older

Draw into UIImage

二次信任 提交于 2019-12-04 08:22:12
how can I draw into an existing UIImage using monotouch? I load an image: UIImage.FromFile("MyImage.png") Then I want to draw a string and some lines into this image. Does anyone has a code sample? Thx Here is a method that does it: private void drawOnTouch(object data) { UITouch touch = data as UITouch; if (null != touch) { UIGraphics.BeginImageContext(this.Image == null ? this.Frame.Size : this.Image.Size); using (CGContext cont = UIGraphics.GetCurrentContext()) { if (this.Image != null) { cont.TranslateCTM(0f, this.Image.Size.Height); cont.ScaleCTM(1.0f, -1.0f); cont.DrawImage(new

Matplotlib and Networkx - drawing a self loop node

馋奶兔 提交于 2019-12-04 08:18:33
I have this function and I want to draw a self loop. How can I do that? The edge exists but I think it's just a point in this exemple is (1,1) and I couldn't add the name of nodes. My goal is from adjacency matrix draw a graph. Is there there is better way to do this? import networkx as nx import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch, Circle import numpy as np def draw_network(G,pos,ax,sg=None): for n in G: c=Circle(pos[n],radius=0.05,alpha=0.7) ax.add_patch(c) G.node[n]['patch']=c x,y=pos[n] seen={} for (u,v,d) in G.edges(data=True): n1=G.node[u]['patch'] n2

pil draw text with different colors

本秂侑毒 提交于 2019-12-04 07:47:59
Hi to draw three different text with different options for ex: text-number-1 , font=arial, color=red text-number-2 , font=veranda, color=blue, size=30 text-number-3 , font=tahoma, color=green, size=40 , align=center text must go in new lines. def pil_image(request): text = request.GET.get('text', None) font = str(request.GET.get('font', 'arial')) fontsize = int(request.GET.get('fontsize', '20')) textcolor = str(request.GET.get('textcolor', '000')) import Image, ImageDraw, ImageFont, textwrap img = Image.open('media/text/transparent.png') img = img.convert("RGBA") datas = img.getdata() w, h =

Drawing on top of an image in Javascript

独自空忆成欢 提交于 2019-12-04 07:00:46
I want to let the user draw on an image in a browser. In other words, I need both bitmapped graphics and drawing capabilities, whether vector or bitmapped. Canvas looks good, but is not supported by IE, and though there is ExCanvas, I wonder if ExCanvas is stable enough for consistent use in IE6 through 8. Or best of all, is there an open-source image/drawing library that supports all this out of the box? I found two dozen or so Web-based image editors or drawing tools, but none support the requirements. (And I'd like to avoid Flash/Flex/Silverlight/JavaFX.) Even though you said you'd like to

Delphi: how to draw small icons in List View on CustomDrawItem

余生颓废 提交于 2019-12-04 06:19:42
问题 how to extend this code: ListView in vsReport mode colouring of Items and rows to draw small icons? and why do I have the error 'List index out of bounds (2)' if I have 3 columns? Thanks! 回答1: There are many ways to draw the icons, depending on where they come frome (a file, a resource, a system icon, etc.) and depending on if there should be a single icon for all items or if every item has its own icon. Anyhow, the general idea should be clear from this extended version of the code in the

Drawing with a brush

允我心安 提交于 2019-12-04 06:18:22
问题 I need help with the implementation of the brush on PyQt5 I already have some event code for the mouse: def mousePressEvent(self, event): if event.button() and event.button() == Qt.LeftButton: self.lastPoint = event.pos() self.scribbling = True def mouseMoveEvent(self, event): if (event.buttons() & Qt.LeftButton) and self.scribbling: self.drawLineTo(event.pos()) def mouseReleaseEvent(self, event): if event.button() == Qt.LeftButton and self.scribbling: self.drawLineTo(event.pos()) self