File tree Expand file tree Collapse file tree 2 files changed +56
-16
lines changed Expand file tree Collapse file tree 2 files changed +56
-16
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ head = "./fonts/larabiefont.ttf"
10
10
icon = " ./fonts/devicons.ttf"
11
11
note = " ./fonts/rondo.ttf"
12
12
13
+ [[extra ]]
14
+ width = 2400
15
+ height = 1200
16
+ vertical = true
17
+
13
18
[[group ]]
14
19
[[group .item ]]
15
20
kind = " Head"
Original file line number Diff line number Diff line change @@ -44,22 +44,38 @@ main = withUtf8 $ do
44
44
}
45
45
let width = cfg ^. # cfgImg . # imgWidth . # unPx
46
46
let height = cfg ^. # cfgImg . # imgHeight . # unPx
47
- CP. writePng
48
- ( " ./img/card-"
49
- <> inspect width
50
- <> " x"
51
- <> inspect height
52
- <> " .png"
53
- )
54
- img
55
- CP. writePng
56
- ( " ./img/card-"
57
- <> inspect height
58
- <> " x"
59
- <> inspect width
60
- <> " .png"
61
- )
62
- $ JP. rotateRight90 img
47
+ forM_ (Extra (Px width) (Px height) False : cfgExtra cfg) $ \ ext -> do
48
+ let extWidth = ext ^. # extraWidth . # unPx
49
+ let extHeight = ext ^. # extraHeight . # unPx
50
+ let fin =
51
+ R. renderDrawingAtDpi
52
+ extWidth
53
+ extHeight
54
+ (cfg ^. # cfgImg . # imgDpi . # unPx)
55
+ white
56
+ . R. drawImage img 0
57
+ $ R. V2
58
+ (unsafeFrom @ Int @ Float (extWidth - width) / 2 )
59
+ (unsafeFrom @ Int @ Float (extHeight - height) / 2 )
60
+ if extraVertical ext
61
+ then
62
+ CP. writePng
63
+ ( " ./img/card-"
64
+ <> inspect extHeight
65
+ <> " x"
66
+ <> inspect extWidth
67
+ <> " .png"
68
+ )
69
+ $ JP. rotateRight90 fin
70
+ else
71
+ CP. writePng
72
+ ( " ./img/card-"
73
+ <> inspect extWidth
74
+ <> " x"
75
+ <> inspect extHeight
76
+ <> " .png"
77
+ )
78
+ fin
63
79
64
80
mkFont :: Text -> IO TT. Font
65
81
mkFont =
@@ -201,6 +217,7 @@ newtype Px = Px
201
217
data Cfg = Cfg
202
218
{ cfgImg :: Img ,
203
219
cfgFont :: CfgFont ,
220
+ cfgExtra :: [Extra ],
204
221
cfgGroup :: [Group ]
205
222
}
206
223
deriving stock
@@ -254,6 +271,24 @@ data CfgFont = CfgFont
254
271
)
255
272
via GenericType CfgFont
256
273
274
+ data Extra = Extra
275
+ { extraWidth :: Px ,
276
+ extraHeight :: Px ,
277
+ extraVertical :: Bool
278
+ }
279
+ deriving stock
280
+ ( Eq ,
281
+ Ord ,
282
+ Show ,
283
+ Data ,
284
+ Generic
285
+ )
286
+ deriving
287
+ ( HasCodec ,
288
+ HasItemCodec
289
+ )
290
+ via GenericType Extra
291
+
257
292
newtype Group = Group
258
293
{ groupItem :: [Item ]
259
294
}
You can’t perform that action at this time.
0 commit comments