TinyVG / specification

The specification for TinyVG. This is the central authority for the file system
https://tinyvg.tech/
MIT License
239 stars 6 forks source link

[Clarification] Define pixel units #9

Closed rsheeter closed 2 years ago

rsheeter commented 2 years ago

Spec refers to pixels in several places (width, height, and "at least a single display pixel"). Pixel is a fairly ambiguous unit, suggest further definition or avoidance.

  1. CSS "pixel" https://drafts.csswg.org/css-values/#absolute-lengths
  2. Android has several "pixels"; https://developer.android.com/guide/topics/resources/more-resources.html#Dimension
ikskuh commented 2 years ago

Yeah, this is something which is bugging me as well and which is definitly underspecified.

My proposal here is:

A line width of 0 is actually a display pixel. It is as thin as possible, but definitly visible. The anti-alias renderer already respects this and scales a line up to a "logical" pixel in the final output.

For everything else, i would exchange the word pixel for something like more abstract like unit, which doesn't have a physical dimension applied. This isn't removing any features, as it's vector graphics. The size only defines the aspect and viewbox of the image, but not the actual final dimensions

neinseg commented 2 years ago

I think it would be good to have a physical scale embedded into the file (e.g. through a DPI value, assuming an isotropic display/print technology). If nothing else it would allow a viewer that does not know anything about the file to display it at a "sensible" scale on an unknown display (e.g. a High-DPI one).

Without this scale, a viewer displaying a random TinyVG file could either a) scale it to screen (which would be extremely goofy for e.g. icons), or it could apply an arbitrary scale (e.g. "1 unit = 1mm"), but that would also be goofy in many cases because some files might be in pixels @ something like 90 DPI, others in inches.

ikskuh commented 2 years ago

It is now clarified that a TinyVG display unit is a CSS pixel (1/96 inch)