membrane.skia

*already-drawing*

dynamic

*draw-cache*

dynamic

*font-cache*

dynamic

*image-cache*

dynamic

*origin*

dynamic

*paint*

dynamic

*skia-resource*

dynamic

*view*

dynamic

*window*

dynamic

-main

(-main & args)

-reshape

(-reshape window window-handle width height)

-window-close-callback

(-window-close-callback window window-handle)

argc

argv

bstr

(bstr num)

byte-array-class

def-objc-class

macro

(def-objc-class kls)

DEFAULT-COLOR

defc

macro

(defc fn-name lib ret)(defc fn-name lib ret args)

defgl

macro

(defgl fn-name ret)(defgl fn-name ret args)

draw-to-image!

(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?)

DEPRECATED: use save-image instead.

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")))

ffi-buf

macro

(ffi-buf)

ffi-buf*

ffi-buf-size

macro

(ffi-buf-size)

font-advance-x

(font-advance-x font text)

font-dir

font-exists?

(font-exists? font)

font-line-height

(font-line-height font)

font-metrics

(font-metrics font)

font-slants

font-weights

font-widths

get-window-content-scale-size

(get-window-content-scale-size window-handle)

getClass

gl

macro

(gl fn-name)(gl fn-name args)

GL_COLOR_BUFFER_BIT

GL_STENCIL_BUFFER_BIT

GL_TRUE

GL_UNPACK_ALIGNMENT

glfw-call

macro

(glfw-call ret fn-name & args)

GLFW_CONNECTED

GLFW_CONTEXT_VERSION_MAJOR

GLFW_CONTEXT_VERSION_MINOR

GLFW_DISCONNECTED

GLFW_GAMEPAD_BUTTON_A

GLFW_GAMEPAD_BUTTON_B

GLFW_GAMEPAD_BUTTON_BACK

GLFW_GAMEPAD_BUTTON_CIRCLE

GLFW_GAMEPAD_BUTTON_CROSS

GLFW_GAMEPAD_BUTTON_DPAD_DOWN

GLFW_GAMEPAD_BUTTON_DPAD_LEFT

GLFW_GAMEPAD_BUTTON_DPAD_RIGHT

GLFW_GAMEPAD_BUTTON_DPAD_UP

GLFW_GAMEPAD_BUTTON_GUIDE

GLFW_GAMEPAD_BUTTON_LAST

GLFW_GAMEPAD_BUTTON_LEFT_BUMPER

GLFW_GAMEPAD_BUTTON_LEFT_THUMB

GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER

GLFW_GAMEPAD_BUTTON_RIGHT_THUMB

GLFW_GAMEPAD_BUTTON_SQUARE

GLFW_GAMEPAD_BUTTON_START

GLFW_GAMEPAD_BUTTON_TRIANGLE

GLFW_GAMEPAD_BUTTON_X

GLFW_GAMEPAD_BUTTON_Y

GLFW_MOD_ALT

GLFW_MOD_CAPS_LOCK

GLFW_MOD_CONTROL

GLFW_MOD_NUM_LOCK

GLFW_MOD_SHIFT

GLFW_MOD_SUPER

GLFW_OPENGL_CORE_PROFILE

GLFW_OPENGL_FORWARD_COMPAT

GLFW_OPENGL_PROFILE

GLFW_VISIBLE

guess-image-format

(guess-image-format path)

horizontal-layout

IDraw

protocol

members

draw

(draw this)

if-class

macro

(if-class class-name then)(if-class class-name then else?)

image-formats

ImageFactory

protocol

gets or creates an opengl image texture given some various types

members

get-image-texture

(get-image-texture x)

IWindow

protocol

members

cleanup!

(cleanup! _)

init!

(init! _)

repaint!

(repaint! _)

reshape!

(reshape! _ width height)

should-close?

(should-close? _)

kA16_float_SkColorType

pixel with a half float for alpha

kA16_unorm_SkColorType

pixel with a little endian uint16_t for alpha

kAlpha_8_SkColorType

pixel with alpha in 8-bit byte

kARGB_4444_SkColorType

pixel with 4 bits for alpha, red, green, blue; in 16-bit word

kBGR_101010x_SkColorType

pixel with 10 bits each for blue, green, red; in 32-bit word

kBGR_101010x_XR_SkColorType

pixel with 10 bits each for blue, green, red; in 32-bit word, extended range

kBGRA_1010102_SkColorType

10 bits for blue, green, red; 2 bits for alpha; in 32-bit word

kBGRA_8888_SkColorType

pixel with 8 bits for blue, green, red, alpha; in 32-bit word

key-action-map

keycodes

keymap

kGray_8_SkColorType

pixel with grayscale level in 8-bit byte

kOpaque_SkAlphaType

pixel is opaque

kPremul_SkAlphaType

pixel components are premultiplied by alpha

kR16G16_float_SkColorType

pixel with a half float for red and green

kR16G16_unorm_SkColorType

pixel with a little endian uint16_t for red and green

kR16G16B16A16_unorm_SkColorType

pixel with a little endian uint16_t for red, green, blue

kR8_unorm_SkColorType

kR8G8_unorm_SkColorType

pixel with a uint8_t for red and green

kRGB_101010x_SkColorType

pixel with 10 bits each for red, green, blue; in 32-bit word

kRGB_565_SkColorType

pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word

kRGB_888x_SkColorType

pixel with 8 bits each for red, green, blue; in 32-bit word

kRGBA_1010102_SkColorTyp

10 bits for red, green, blue; 2 bits for alpha; in 32-bit word

kRGBA_8888_SkColorType

pixel with 8 bits for red, green, blue, alpha; in 32-bit word

kRGBA_F16_SkColorType

pixel with half floats for red, green, blue, alpha;

kRGBA_F16Norm_SkColorType

pixel with half floats in 0,1 for red, green, blue, alpha;

kRGBA_F32_SkColorType

pixel using C float for red, green, blue, alpha; in 128-bit word

kSRGBA_8888_SkColorType

kUnpremul_SkAlphaType

pixel components are independent of alpha

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

messages

NSDictionary

NSNumber

NSUserDefaults

objc-call

macro

(objc-call obj return-type sel & args)

print-timing

macro

(print-timing & body)

push-paint

macro

(push-paint & args)

quit?

rectangle

render-text

run

(run view-fn)(run view-fn {:keys [window-start-width window-start-height window-start-x window-start-y handlers], :as options})

Open a window and call view-fn to draw. Returns a channel that is closed when the window is closed.

view-fn should be a 0 argument function that returns an object satisfying IDraw. view-fn 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

(run-sync view-fn)(run-sync view-fn {:keys [window-start-width window-start-height window-start-x window-start-y handlers], :as options})

Open a window and call view-fn to draw. Returns when the window is closed.

view-fn should be a 0 argument function that returns an object satisfying IDraw. view-fn 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. :mouse-enter args are window window-handle entered. default is -mouse-enter-callback. :window-close args are window window-handle. default is -window-close-callback.

For each handler, window is the GlfwSkiaWindow and window-handle is a jna pointer to the glfw pointer.

save-canvas

macro

(save-canvas & args)

save-image

(save-image dest elem)(save-image dest elem [w h :as size])(save-image dest elem [w h :as size] image-format quality clear?)

Creates an image of elem. Returns true on success, false otherwise.

dest: 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 dest'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: 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: (skia/save-image "out@2x.png" (ui/scale 2 2 (ui/label "hello world")))

skia-advance-x

(skia-advance-x font text)

skia-font-family-name

(skia-font-family-name font-ptr)

skia-line-height

(skia-line-height font)

skia-load-image

(skia-load-image image-path)

skia-load-image-from-memory

(skia-load-image-from-memory bytes)

skia-style

svg

(svg svg)

Displays an svg element.

svg can be a string representation, a java.io.File, or a utf8-encoded byte array.

SVGFactory

protocol

gets or creates an opengl image texture given some various types

members

get-svg-dom

(get-svg-dom x)

swizzle-image-size

sx

sy

toolkit

transform

(transform matrix drawable)

vertical-layout

window-chan

with-cpu-skia-resource

macro

(with-cpu-skia-resource resource-sym size & body)