vector-graphics

Drawing varying line widths with NSBezierPath?

雨燕双飞 提交于 2020-07-18 05:16:33
问题 I would like to create a vector object that can be drawn with a pen tablet and will honor the pressure information from the pen (by increasing/decreasing line width appropriately). Now I know how to get the pressure info out of the NSEvent, but of course NSBezierPath doesn't support varying line widths. So I'm trying to generate a Bezier path that is the outline of my line, by calculating the perpendicular lines at the ends of the curve and connecting those with the very same curve. It nearly

Is there any OSS library or paper that does Vector path tracing of mono bitmaps?

落花浮王杯 提交于 2020-01-24 00:37:27
问题 i am just interested in how these things work and am after a library or paper that describes the approach that most of these take. At a guess they probably support a few basic constructs. line arc dot 回答1: A large part of image processing is about reasoning about an image at a higher level of abstraction than just pixels, which is exactly what you need to do to vectorise an image. As such, OpenCV is well worth looking at. It contains various image processing functions for blob detection and

Recommendations for converting raster images to vector graphics

拜拜、爱过 提交于 2020-01-23 02:00:07
问题 If a person is looking to batch convert a large number of raster images into vector graphics, are there any tools out there that do that well? For an example, think of just about any diagram that has standard shapes (ellipses, rectangles) and text. 回答1: Inkscape uses the Potrace engine to trace raster graphics. You usually have to play with it a bit to get useful output, but it does surprisingly well and is easy to use. 回答2: Maybe the desktop edition (not free) of Vector Magic could help you

Drawing overlapping semi-transparent lines without visible overlap

三世轮回 提交于 2020-01-20 02:44:25
问题 I'm developing a painter program using HTML5 canvas. I have created a drawing tool where the user drags and moves the mouse. I have a listener on mousemove event that draws short lines: Painter.mainCanvas.beginPath(); Painter.mainCanvas.moveTo(Painter.lastX, Painter.lastY); Painter.lastX = e.offsetX; Painter.lastY = e.offsetY; Painter.mainCanvas.lineTo(Painter.lastX, Painter.lastY); Painter.mainCanvas.stroke(); Everything works well until I set the global Alpha to < 1. When using this method

tspan elements appear outside of SVG text bounds in Safari

六月ゝ 毕业季﹏ 提交于 2020-01-16 16:47:19
问题 I'm making a website for a local band and they wanted a design with outlined text. I look up how to do this and found that the only way to have transparent fill and a solid outline is to use SVG text. I've built the site for them and it works fine in Chrome/Firefox/Opera, but there are a number of problems in Safari. When you hover over one of the letters of the logo on the first page, it should change to solid white and play a sound. To do this, I've split the text element by letters, using

interior angles of irregular polygon with angles > 180

时光总嘲笑我的痴心妄想 提交于 2020-01-13 14:56:07
问题 I'm trying to calculate the values shown in the picture in red i.e. the interior angles. I've got an array of the points where lines intersect and have tried using the dot-product but it only returns the smallest angles. I need the full range of internal angles (0-359) but can't seem to find much that meets this criteria. 回答1: Assuming your angles are in standard counterclockwise format, the following should work: void angles(double points[][2], double angles[], int npoints){ for(int i = 0; i

Generate random 5d vector of given magnitude

…衆ロ難τιáo~ 提交于 2020-01-13 07:08:20
问题 Given a five dimensional space, I would like to generate 100 vectors, all with a fixed magnitude=M, where the components values are randomly distributed. I was originally thinking of starting off with a unit vector and then applying a rotation matrix, with random parameters for the 10 degrees of freedom ... Would this work? and how? Any nice way of doing this in Javascript...? cheers for any pointers! 回答1: Here is the Monte Carlo algorithm that I would use (I do not know Javascript well

matplotlib: generating vector plot

一世执手 提交于 2020-01-12 06:42:07
问题 I want to generate a vector plot with matplotlib. I tried hard - but the output is a raster image. Here's what I use: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt and finally: myfig.savefig('myfig.eps', format='eps') I've found that export to ps gives a vector image, but the problem with eps remains. 回答1: If you need emf files as output format, e.g. to insert high quality plots into ms word/powerpoint and you are willing to use inkscape as converter you can apply

Error importing Vector Asset into Android Studio

拈花ヽ惹草 提交于 2020-01-05 03:30:43
问题 I created a simple play-button image in Illustrator, saved it as a SVG, used an online SVG-to-Drawable converter to create an xml of the file, and then tried using Android Studio's Vector Asset tool to import the file into my project. However, when imported, one of the elements of the drawable is missing, in this case the white triangle in the middle of the circle. play_circle.xml (the converted xml file) <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com

Irregular anchors and shapes using JS in HTML/HTML5

a 夏天 提交于 2020-01-04 07:03:56
问题 Is it possible to have irregular shapes like anchors on some surface in JS that can be clickable and it becomes a ball on runtime on page loads? I want to animate that surface that can be a ball and also want to track that which anchor shape is at particular point. So is it possible using JS? How can this be achieved? I was unable to find any solution. Is there some JS library that can do this? Something like processing.js or Raphael js? 回答1: I suggest using SVG with excelent Raphael js