This object is in archive! 

Theme development - line width in "dp"

John Campbell shared this problem 9 years ago
Solved

I am attempting to update my themes to make them compatible with devices of differing dpi, using "dp" to define sizes.

It seems that there is a minimum line widths that can be rendered this way of 0.25dp. Lines narrower than this render as it they were 0.25dp, which is quite wide at higher zooms. This is the case both in lines and borders to areas. No such limitation appears to apply with standard numerical definitions of widths. An example of this would be in contour lines:

<line stroke="#A07F5F" stroke-width="0.15"/>

<line stroke="#A07F5F" stroke-width="0.15dp"/>

Is this intentional?

Replies (4)

photo
1

Hello John,


as I know, there is no specific limit on width of lines.


Anyway your 0.25dp should be in worst case of really huge screens, took as 4 x 0.25dp = 1px! So still really thin. Maybe Petr that do internal themes for Locus has any experience with it, Petr?

photo
1

Hi Menion,


Your 1px dimension doesn't allow for magnification on zooming. At what zoom is it 1px?

The attachments show a contour line at zoom=20, with the internal Hiking style (stroke-width="0.15", I think) and a custom style using 0.1dp (which is the same as 0.25dp) at 320dpi on a MotoG.

Come to think of it, the width of the line is far greater than it should be even for 0.25dp.

photo
1

FWIW, looks like the min size rendered is 0.5dp

photo
1

Good day John,


thanks to Peters help, I was able to find out why this happen and fix it. So thank you for your report. In next Locus version will be possible to draw thin lines as expected ;).

photo
1

Many thanks. This also happens with circles, and with borders on areas. Have you picked those up as well?

photo
1

It should be same problem so also solved by this fix.

Replies have been locked on this page!