(draw-to-image! path elem)
(draw-to-image! path elem [w h :as size])
(draw-to-image! path elem [w h :as size] image-format quality clear?)
Creates an image of elem. Returns true on success, false otherwise.
path
: the filename to write the image to
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.
image-format
: The image format to use. Should be one of
:membrane.skia/image-format-jpeg
:membrane.skia/image-format-png
:membrane.skia/image-format-webp
if image-format
is nil, then it will be guessed based on the path's file extension.
quality
: specifies the image quality to use for lossy image formats like jpeg. defaults to 100
clear?
: Specifies if the canvas should be cleared before drawing. defaults to true.
note: draw-to-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:
(skia/draw-to-image! "out@2x.png" (ui/scale 2 2 (ui/label "hello world")))
Creates an image of elem. Returns true on success, false otherwise. `path`: the filename to write the image to `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. `image-format`: The image format to use. Should be one of :membrane.skia/image-format-jpeg :membrane.skia/image-format-png :membrane.skia/image-format-webp if `image-format` is nil, then it will be guessed based on the path's file extension. `quality`: specifies the image quality to use for lossy image formats like jpeg. defaults to 100 `clear?`: Specifies if the canvas should be cleared before drawing. defaults to true. note: `draw-to-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: `(skia/draw-to-image! "out@2x.png" (ui/scale 2 2 (ui/label "hello world")))`
gets or creates an opengl image texture given some various types
gets or creates an opengl image texture given some various types
(get-image-texture x)
(cleanup! _)
(init! _)
(repaint! _)
(reshape! _ width height)
(should-close? _)
(run make-ui)
(run make-ui
{:keys [window-start-width window-start-height window-start-x
window-start-y handlers]
:as options})
Open a window and call make-ui
to draw. Returns a channel that is closed when the window is closed.
make-ui
should be a 0 argument function that returns an object satisfying IDraw
.
make-ui
will be called for every repaint. Repaints occur on every event. You can also trigger a repaint by calling glfw-post-empty-event
.
options
is a map that can contain the following keys
Optional parameters
window-start-width
: the starting width of the window
window-start-height
: the starting height of the window
note: The window may be resized.
window-start-x
: the starting x coordinate of the top left corner of the window
window-start-y
: the starting y coordinate of the top left corner of the window
note: The window may be moved.
handlers
: A map of callback backs for glfw events
The events correspond to the available glfw events. If no handlers
map is provided, then the defaults are used.
If a handlers key is provided, it does not replace the defaults, but get merged into the defaults.
available handler events :key args are [window window-handle key scancode action mods]. default is -key-callback. :char args are [window window-handle codepoint]. default is -character-callback. :mouse-button args are [window window-handle button action mods]. default is -mouse-button-callback. :reshape args are [window window-handle width height]. default is -reshape. :scroll args are [window window-handle offset-x offset-y]. default is -scroll-callback. :refresh args are [window window-handle]. default is -window-refresh-callback. :cursor args are [window window-handle x y]. default is -cursor-pos-callback.
For each handler, window
is the GlfwSkiaWindow and window-handle is a jna pointer to the glfw pointer.
Open a window and call `make-ui` to draw. Returns a channel that is closed when the window is closed. `make-ui` should be a 0 argument function that returns an object satisfying `IDraw`. `make-ui` will be called for every repaint. Repaints occur on every event. You can also trigger a repaint by calling `glfw-post-empty-event`. `options` is a map that can contain the following keys Optional parameters `window-start-width`: the starting width of the window `window-start-height`: the starting height of the window note: The window may be resized. `window-start-x`: the starting x coordinate of the top left corner of the window `window-start-y`: the starting y coordinate of the top left corner of the window note: The window may be moved. `handlers`: A map of callback backs for glfw events The events correspond to the available glfw events. If no `handlers` map is provided, then the defaults are used. If a handlers key is provided, it does not replace the defaults, but get merged into the defaults. available handler events :key args are [window window-handle key scancode action mods]. default is -key-callback. :char args are [window window-handle codepoint]. default is -character-callback. :mouse-button args are [window window-handle button action mods]. default is -mouse-button-callback. :reshape args are [window window-handle width height]. default is -reshape. :scroll args are [window window-handle offset-x offset-y]. default is -scroll-callback. :refresh args are [window window-handle]. default is -window-refresh-callback. :cursor args are [window window-handle x y]. default is -cursor-pos-callback. For each handler, `window` is the GlfwSkiaWindow and window-handle is a jna pointer to the glfw pointer.
(run-sync make-ui)
(run-sync make-ui
{:keys [window-start-width window-start-height window-start-x
window-start-y handlers]
:as options})
Open a window and call make-ui
to draw. Returns when the window is closed.
make-ui
should be a 0 argument function that returns an object satisfying IDraw
.
make-ui
will be called for every repaint. Repaints occur on every event. You can also trigger a repaint by calling glfw-post-empty-event
.
options
is a map that can contain the following keys
Optional parameters
window-start-width
: the starting width of the window
window-start-height
: the starting height of the window
note: The window may be resized.
window-start-x
: the starting x coordinate of the top left corner of the window
window-start-y
: the starting y coordinate of the top left corner of the window
note: The window may be moved.
handlers
: A map of callback backs for glfw events
The events correspond to the available glfw events. If no handlers
map is provided, then the defaults are used.
If a handlers key is provided, it does not replace the defaults, but get merged into the defaults.
available handler events :key args are [window window-handle key scancode action mods]. default is -key-callback. :char args are [window window-handle codepoint]. default is -character-callback. :mouse-button args are [window window-handle button action mods]. default is -mouse-button-callback. :reshape args are [window window-handle width height]. default is -reshape. :scroll args are [window window-handle offset-x offset-y]. default is -scroll-callback. :refresh args are [window window-handle]. default is -window-refresh-callback. :cursor args are [window window-handle x y]. default is -cursor-pos-callback.
For each handler, window
is the GlfwSkiaWindow and window-handle is a jna pointer to the glfw pointer.
Open a window and call `make-ui` to draw. Returns when the window is closed. `make-ui` should be a 0 argument function that returns an object satisfying `IDraw`. `make-ui` will be called for every repaint. Repaints occur on every event. You can also trigger a repaint by calling `glfw-post-empty-event`. `options` is a map that can contain the following keys Optional parameters `window-start-width`: the starting width of the window `window-start-height`: the starting height of the window note: The window may be resized. `window-start-x`: the starting x coordinate of the top left corner of the window `window-start-y`: the starting y coordinate of the top left corner of the window note: The window may be moved. `handlers`: A map of callback backs for glfw events The events correspond to the available glfw events. If no `handlers` map is provided, then the defaults are used. If a handlers key is provided, it does not replace the defaults, but get merged into the defaults. available handler events :key args are [window window-handle key scancode action mods]. default is -key-callback. :char args are [window window-handle codepoint]. default is -character-callback. :mouse-button args are [window window-handle button action mods]. default is -mouse-button-callback. :reshape args are [window window-handle width height]. default is -reshape. :scroll args are [window window-handle offset-x offset-y]. default is -scroll-callback. :refresh args are [window window-handle]. default is -window-refresh-callback. :cursor args are [window window-handle x y]. default is -cursor-pos-callback. For each handler, `window` is the GlfwSkiaWindow and window-handle is a jna pointer to the glfw pointer.
(skia_render_selection skia-resource
font-ptr
text
text-length
selection-start
selection-end)
(slurp-bytes x)
Slurp the bytes from a slurpable thing
Slurp the bytes from a slurpable thing
(text-selection-draw {:keys [text font]
[selection-start selection-end] :selection
:as text-selection})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close