membrane.java2d
logical-font->font-family
(logical-font->font-family logical-font)
Returns the font family for the given logical-font
.
logical-font
: should be one of :monospace :serif :sans-serif
merge-stroke
(merge-stroke stroke {:keys [width cap join miter-limit dash dash-phase]})
Create a new java.awt.BasicStroke with the non properties replaced.
keys:
:width
float getLineWidth()
Returns the line width.
:cap
int getEndCap()
Returns the end cap style.
:join
int getLineJoin()
Returns the line join style.
:miter-limit
float getMiterLimit()
Returns the limit of miter joins.
:dash
float[] getDashArray()
Returns the array representing the lengths of the dash segments.
:dash-phase
float getDashPhase()
Returns the current dash phase.
run
(run view-fn)
(run view-fn {:keys [window-title window-start-width window-start-height window-start-x window-start-y], :as options})
run-sync
(run-sync view-fn)
(run-sync view-fn {:keys [window-title window-start-width window-start-height window-start-x window-start-y], :as options})
save-image
(save-image dest elem)
(save-image dest elem size)
Saves an image of elem to file with name dest
.
dest
: the filename to write the image to. dest
can also be anything clojure.java.io/output-stream would accept.
elem: the graphical element to draw
size`: the width and height of the image. If size is nil, the bounds and origin of elem will be used.
note: save-image
does not take into account the content scale of your monitor. ie. if you
have a retina display, the image will be lower resolution. if you'd like the same resolution
as your retina display, you can do use scale
like the following:
(save-image "out@2x.png" (ui/scale 2 2 (ui/label "hello world")))
text-selection-draw
(text-selection-draw font text [selection-start selection-end] selection-color)