Questions tagged [stroke]

a line drawn along a path

On iOS, this might be a UIBezierPath or on Android, this would be a collection of attributes describing the line in XML (such as width, color, width and gap).

476 questions
5
votes
2 answers

Why doesn't the Graphics' draw method respect stroke attributes?

I want to create a custom border with rounded corners. Code - import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import…
mre
  • 43,520
  • 33
  • 120
  • 170
5
votes
1 answer

default stroke and fill in SVG

Im confused about stroke and fill defaults in SVG. in the SVG spec (http://www.w3.org/TR/SVG/painting.html#StrokeProperty) it says the initial value for the stroke property is none - which i am guessing is transparent? and the default stroke width…
siliconeagle
  • 7,379
  • 3
  • 29
  • 41
5
votes
1 answer

How to maintain pixel when zooming into SVG canvas?

I've built a frontend tool for zooming in/out of an SVG canvas, but when I zoom, any 1px strokes increase in width (visually). Is there a svg setting that will ensure that 1px strokes remain 1px (visually) when zoomed? I remember reading about it…
Steve
  • 3,483
  • 5
  • 21
  • 20
5
votes
4 answers

clear line on HTML5 Canvas

Is there a way to unstroke a line? On my canvas I have a line with opacity 0.5, and width of 20 pixels, let's say. Now I want to to make it longer, means to draw another line right out of the old one. when doing that, the matching points between the…
Amit Hagin
  • 3,136
  • 6
  • 26
  • 36
5
votes
2 answers

Draw a line of varying width in p5.js

I wish to draw lines on my canvas with width that gradually vary from start to end. That is, say the line starts at (0, 0) with width = 1 (equivalently, strokeWeight) and ends at (50, 50) with width = 3, and the width must (linearly) increase from 1…
amzon-ex
  • 1,645
  • 1
  • 6
  • 28
5
votes
1 answer

D3 changing color of path stroke on mouseover

based on my former question How to center (horizontal and vertical) text along an textPath inside an arc using d3.js?, I would like to know how to highlight the borders of the arc using mouseover and mouseout event. Please take a look at the…
Rico Sonntag
  • 1,505
  • 1
  • 15
  • 21
5
votes
2 answers

Set Border/Stroke to Vector Drawable Programmatically

I can change the color of vector drawables programmatically, but I want to apply the stroke to vector drawable. I need a method that will change the vector drawable stroke at runtime: previously i used this method but failed in my case. i converted…
waqas
  • 51
  • 1
  • 3
5
votes
2 answers

Appearance of lines with stroke-width = 1px

I'm working on a visualization that requires thin vertical lines. Ideally I'd like them to be 1px wide. When I position them using a linear scale width the default "range()", they appear as being of different widths, because their computed position…
GuitarExtended
  • 787
  • 2
  • 11
  • 32
5
votes
1 answer

(Unity) Add Outline to Alpha Cutout Shader

I have a very simple Cutout Shader for displaying Icons in 3D space (see below). I want to 'programatically' add an outline/stroke which follows the alpha contours, with a user defined thickness and colour. (Left): What I currently have - an alpha…
Ben Hayward
  • 1,444
  • 23
  • 37
5
votes
1 answer

how to align stroke only inside of the svg path?

Is there any option in SVG to make stroke inside to the element ? #html-cup { stroke: #f00; stroke-opacity: 0.5; stroke-width: 4px; fill: #666666; }
Mo.
  • 26,306
  • 36
  • 159
  • 225
5
votes
1 answer

Android multiple stroke box in drawable xml

I'm trying to achieve what amounts to effectively 2 strokes on a rectangle in a element in an android drawable xml. A dark green outer line and a light green inner line, with a gradient fill in the center of it all. My code currently looks…
Ben
  • 16,124
  • 22
  • 77
  • 122
5
votes
3 answers

Clearing a strokeRect() on HTML5 Canvas

I can draw a square with a border on my canvas perfectly fine. However, when I attempt to clear this square-with-border shape using the clearRect() function, some strokes do not get cleared. HTML
d m
  • 581
  • 3
  • 6
  • 8
5
votes
2 answers

Preserve line width while scaling all points in the context with CGAffineTransform

I have a CGPath in some coordinate system that I'd like to draw. Doing so involves scaling the old coordinate system onto the Context's one. For that purpose, I use CGContextConcatCTM() which does transform all the points as it should. But, as it is…
MrMage
  • 7,282
  • 2
  • 41
  • 71
5
votes
1 answer

Drawing perfectly circular arcs with HTML5 Canvas + KineticJS

I'm currently trying to draw arcs using the KineticJS canvas framework. The issue I'm having is that these arcs are not nearly as "perfectly" circular as required. They're being drawn out as follows: var redArc = new Kinetic.Shape({ drawFunc:…
zesda
  • 418
  • 6
  • 18
5
votes
2 answers

Outline (stroke) for non-rectangular CCNode in cocos2d

I need to create an outline like this dynamically: Not for a CCSprite, but for multiple animated CCSprites united in one CCNode. I'm thinking about: copying CCNode's content to a texture (like canvasBitmapData.draw(sourceDisplayObject) in…
Ivan Mir
  • 1,209
  • 1
  • 12
  • 32