aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/output/video/resolution.lux
blob: bbe7bdd7416b03303faee73bf0ba407c1ad48221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(.module:
  [library
   [lux #*
    [abstract
     [equivalence (#+ Equivalence)]
     [hash (#+ Hash)]]
    [control
     [parser
      ["<.>" code]]]
    [data
     ["." product]
     ["." text]]
    [macro
     [syntax (#+ syntax:)]
     ["." code]
     ["." template]]
    [math
     [number
      ["." nat]]]]])

(type: .public Resolution
  {#.doc (example "A screen resolution.")}
  {#width Nat
   #height Nat})

(def: .public hash
  (Hash Resolution)
  (product.hash nat.hash nat.hash))

(def: .public equivalence
  (Equivalence Resolution)
  (\ ..hash &equivalence))

(syntax: (description {name <code>.local_identifier})
  (in (list (|> name
                (text.replaced "/" " ")
                (text.replaced "_" " ")
                text.upper_cased
                code.text))))

... https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions
(template [<name> <width> <height>]
  [(with_expansions [<description> (..description <name>)
                     <documentation> (template.text [<description> " resolution: " <width> "x" <height> "."])]
     (def: .public <name>
       {#.doc <documentation>}
       Resolution
       {#width <width>
        #height <height>}))]

  [svga        800  600]
  [wsvga      1024  600]
  [xga        1024  768]
  [xga+       1152  864]
  [wxga/16:9  1280  720]
  [wxga/5:3   1280  768]
  [wxga/16:10 1280  800]
  [sxga       1280 1024]
  [wxga+      1440  900]
  [hd+        1600  900]
  [wsxga+     1680 1050]
  [fhd        1920 1080]
  [wuxga      1920 1200]
  [wqhd       2560 1440]
  [uhd_4k     3840 2160]
  )