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
275
votes
14 answers

Can you control how an SVG's stroke-width is drawn?

Currently building a browser-based SVG application. Within this app, various shapes can be styled and positioned by the user, including rectangles. When I apply a stroke-width to an SVG rect element of say 1px, the stroke is applied to the rect’s…
Steve
  • 3,483
  • 5
  • 21
  • 20
179
votes
3 answers

Border in shape XML

I am trying to make a drawable to use for a button. I would like it to have this coloring, with a 2px border around it. Everything works just fine except I cannot get the border to show up...
Matt
  • 5,461
  • 7
  • 36
  • 43
87
votes
7 answers

I need to change the stroke color to a user defined color. Nothing to do with the state

I need to change the stroke color from the app. The user is able to change the background color so I need to also let them change the stroke (outline) of the button. As its is already set in the drawable (sample below) I have not found a way to…
Mark Worsnop
  • 4,407
  • 15
  • 54
  • 79
36
votes
1 answer

Android Paint stroke width positioning

Given this code to draw a line: Paint p; p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(android.graphics.Color.WHITE); p.setStyle(Paint.Style.FILL); p.setStrokeWidth(21); canvas.drawLine(0,50,100,50,p); there are 3 possible stroke-drawing…
ilomambo
  • 8,290
  • 12
  • 57
  • 106
33
votes
3 answers

Android : stroke in a shape create a margin of the stroke width

I created a rectangle shape in order to use it as list item background. My problem is the stroke does not follow the view border but let a margin of +/- the stroke width. Here is the xml of my shape :
Anthony
  • 429
  • 1
  • 4
  • 10
33
votes
7 answers

HTML5 canvas stroke() thick and fuzzy

I'm trying to allow the user to draw a rectangle on the canvas (like a selection box). I'm getting some ridiculous results, but then I noticed that even just trying the code from my reference here, I get huge fuzzy lines and don't know why. it's…
Nona Urbiz
  • 4,873
  • 16
  • 57
  • 84
31
votes
6 answers

Why is SVG stroke-width : 1 making lines transparent?

I'm creating stock charts with svg and I'm having a problem when I set the stroke-width of my path elements to 1. Instead of making the lines more narrow, it just makes it the same size as stroke-width:2 but slightly transparent. I can't post an…
MattL922
  • 621
  • 2
  • 7
  • 12
31
votes
2 answers

how to change the color of route in google maps v3

I am using this code to get directions between two points. Is it possible to change the color of the route from blue? I am not using polyline in my code. Thanx in advance :)
user2809895
  • 331
  • 1
  • 3
  • 8
28
votes
9 answers

How to make text stroke in SwiftUI?

I'm trying to make text-stroke in SwiftUI or add a border on my text, in the letters not the Text() item. Is it possible? I want to make this effect with the border: (source: noelshack.com)
Nicolas M
  • 475
  • 1
  • 7
  • 14
27
votes
1 answer

Android Canvas.drawTextOnPath does not look correct when paint is set to Stroke

I have some code setup in an extended view which does some drawings which are easily scaled (vector-like). (My scale is setup as 0-1.0) I noticed that when I set my paint fill to FILL, the text drawn on a path looks correct, but when I set the fill…
Chrispix
  • 17,941
  • 20
  • 62
  • 70
19
votes
6 answers

Outline UILabel text in UILabel Subclass

I'm trying hard to find a way to simply add an outline/stroke/contour to my UILabel text. Talking about a stroke around the letters of the text not around the background of a UILabel. I'm using swift 3 and I'd like to outline my text directly into…
iji
  • 392
  • 1
  • 2
  • 13
17
votes
5 answers

How to make an SVG "line" with a border around it?

I have a little svg widget whose purpose is to display a list of angles (see image). Right now, the angles are line elements, which only have a stroke and no fill. But now I'd like to have an "inside fill" color and a "stroke/border" around it. I'm…
Tony R
  • 11,224
  • 23
  • 76
  • 101
15
votes
1 answer

Add a border and shadow around non transparent pixels of UIImage

I'm trying to add a stroke/border and a drop shadow around the non transparent pixels of a UIImage. The goal is to get something that looks like this: I've tried several things and am still trying to figure out exactly how to accomplish this. In…
N V
  • 742
  • 1
  • 6
  • 21
14
votes
3 answers

Transparency of a filled stroke in HTML5

I'm working on a doodling app in HTML5 and I would like to do a sort of bucket feature. The idea is to draw a path and it will be closed and filled with the selected colour (colour of the stroke). It works quite well with solid colours, but if I…
Mathieu
  • 622
  • 1
  • 6
  • 12
13
votes
3 answers

AffineTransform without transforming Stroke?

When using the Graphics2D scale() function with two different parameters (scaling by different ratios in x- and y-direction), everything drawn later on this Graphics2D object is scaled too. This has the strange effect that lines drawn in one…
Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
1
2 3
31 32