canvasfx (desktop)

Содержит функции для работы с графикой Java FX

Константы

ArcType : map = {OPEN=0, CHORD=1, ROUND=2}

BlendMode : map =

17 элементов
{
  SRC_OVER=0,
  SRC_ATOP=1,
  ADD=2,
  MULTIPLY=3,
  SCREEN=4,
  OVERLAY=5,
  DARKEN=6,
  LIGHTEN=7,
  COLOR_DODGE=8,
  COLOR_BURN=9,
  HARD_LIGHT=10,
  SOFT_LIGHT=11,
  DIFFERENCE=12,
  EXCLUSION=13,
  RED=14,
  GREEN=15,
  BLUE=16
}

Color : map =

152 элементов
{
  hsb=def(hue,saturation,brightness,opacity=1.0),
  new=def(rgb) def(r,g,b,opacity=1.0),
  rgb=def(r,g,b,opacity=1.0),
  web=def(name,opacity=1.0,
  ALICEBLUE=ColorValue 0xf0f8ffff,
  ANTIQUEWHITE=ColorValue 0xfaebd7ff,
  AQUA=ColorValue 0x00ffffff,
  AQUAMARINE=ColorValue 0x7fffd4ff,
  AZURE=ColorValue 0xf0ffffff,
  BEIGE=ColorValue 0xf5f5dcff,
  BISQUE=ColorValue 0xffe4c4ff,
  BLACK=ColorValue 0x000000ff,
  BLANCHEDALMOND=ColorValue 0xffebcdff,
  BLUE=ColorValue 0x0000ffff,
  BLUEVIOLET=ColorValue 0x8a2be2ff,
  BROWN=ColorValue 0xa52a2aff,
  BURLYWOOD=ColorValue 0xdeb887ff,
  CADETBLUE=ColorValue 0x5f9ea0ff,
  CHARTREUSE=ColorValue 0x7fff00ff,
  CHOCOLATE=ColorValue 0xd2691eff,
  CORAL=ColorValue 0xff7f50ff,
  CORNFLOWERBLUE=ColorValue 0x6495edff,
  CORNSILK=ColorValue 0xfff8dcff,
  CRIMSON=ColorValue 0xdc143cff,
  CYAN=ColorValue 0x00ffffff,
  DARKBLUE=ColorValue 0x00008bff,
  DARKCYAN=ColorValue 0x008b8bff,
  DARKGOLDENROD=ColorValue 0xb8860bff,
  DARKGRAY=ColorValue 0xa9a9a9ff,
  DARKGREEN=ColorValue 0x006400ff,
  DARKGREY=ColorValue 0xa9a9a9ff,
  DARKKHAKI=ColorValue 0xbdb76bff,
  DARKMAGENTA=ColorValue 0x8b008bff,
  DARKOLIVEGREEN=ColorValue 0x556b2fff,
  DARKORANGE=ColorValue 0xff8c00ff,
  DARKORCHID=ColorValue 0x9932ccff,
  DARKRED=ColorValue 0x8b0000ff,
  DARKSALMON=ColorValue 0xe9967aff,
  DARKSEAGREEN=ColorValue 0x8fbc8fff,
  DARKSLATEBLUE=ColorValue 0x483d8bff,
  DARKSLATEGRAY=ColorValue 0x2f4f4fff,
  DARKSLATEGREY=ColorValue 0x2f4f4fff,
  DARKTURQUOISE=ColorValue 0x00ced1ff,
  DARKVIOLET=ColorValue 0x9400d3ff,
  DEEPPINK=ColorValue 0xff1493ff,
  DEEPSKYBLUE=ColorValue 0x00bfffff,
  DIMGRAY=ColorValue 0x696969ff,
  DIMGREY=ColorValue 0x696969ff,
  DODGERBLUE=ColorValue 0x1e90ffff,
  FIREBRICK=ColorValue 0xb22222ff,
  FLORALWHITE=ColorValue 0xfffaf0ff,
  FORESTGREEN=ColorValue 0x228b22ff,
  FUCHSIA=ColorValue 0xff00ffff,
  GAINSBORO=ColorValue 0xdcdcdcff,
  GHOSTWHITE=ColorValue 0xf8f8ffff,
  GOLD=ColorValue 0xffd700ff,
  GOLDENROD=ColorValue 0xdaa520ff,
  GRAY=ColorValue 0x808080ff,
  GREEN=ColorValue 0x008000ff,
  GREENYELLOW=ColorValue 0xadff2fff,
  GREY=ColorValue 0x808080ff,
  HONEYDEW=ColorValue 0xf0fff0ff,
  HOTPINK=ColorValue 0xff69b4ff,
  INDIANRED=ColorValue 0xcd5c5cff,
  INDIGO=ColorValue 0x4b0082ff,
  IVORY=ColorValue 0xfffff0ff,
  KHAKI=ColorValue 0xf0e68cff,
  LAVENDER=ColorValue 0xe6e6faff,
  LAVENDERBLUSH=ColorValue 0xfff0f5ff,
  LAWNGREEN=ColorValue 0x7cfc00ff,
  LEMONCHIFFON=ColorValue 0xfffacdff,
  LIGHTBLUE=ColorValue 0xadd8e6ff,
  LIGHTCORAL=ColorValue 0xf08080ff,
  LIGHTCYAN=ColorValue 0xe0ffffff,
  LIGHTGOLDENRODYELLOW=ColorValue 0xfafad2ff,
  LIGHTGRAY=ColorValue 0xd3d3d3ff,
  LIGHTGREEN=ColorValue 0x90ee90ff,
  LIGHTGREY=ColorValue 0xd3d3d3ff,
  LIGHTPINK=ColorValue 0xffb6c1ff,
  LIGHTSALMON=ColorValue 0xffa07aff,
  LIGHTSEAGREEN=ColorValue 0x20b2aaff,
  LIGHTSKYBLUE=ColorValue 0x87cefaff,
  LIGHTSLATEGRAY=ColorValue 0x778899ff,
  LIGHTSLATEGREY=ColorValue 0x778899ff,
  LIGHTSTEELBLUE=ColorValue 0xb0c4deff,
  LIGHTYELLOW=ColorValue 0xffffe0ff,
  LIME=ColorValue 0x00ff00ff,
  LIMEGREEN=ColorValue 0x32cd32ff,
  LINEN=ColorValue 0xfaf0e6ff,
  MAGENTA=ColorValue 0xff00ffff,
  MAROON=ColorValue 0x800000ff,
  MEDIUMAQUAMARINE=ColorValue 0x66cdaaff,
  MEDIUMBLUE=ColorValue 0x0000cdff,
  MEDIUMORCHID=ColorValue 0xba55d3ff,
  MEDIUMPURPLE=ColorValue 0x9370dbff,
  MEDIUMSEAGREEN=ColorValue 0x3cb371ff,
  MEDIUMSLATEBLUE=ColorValue 0x7b68eeff,
  MEDIUMSPRINGGREEN=ColorValue 0x00fa9aff,
  MEDIUMTURQUOISE=ColorValue 0x48d1ccff,
  MEDIUMVIOLETRED=ColorValue 0xc71585ff,
  MIDNIGHTBLUE=ColorValue 0x191970ff,
  MINTCREAM=ColorValue 0xf5fffaff,
  MISTYROSE=ColorValue 0xffe4e1ff,
  MOCCASIN=ColorValue 0xffe4b5ff,
  NAVAJOWHITE=ColorValue 0xffdeadff,
  NAVY=ColorValue 0x000080ff,
  OLDLACE=ColorValue 0xfdf5e6ff,
  OLIVE=ColorValue 0x808000ff,
  OLIVEDRAB=ColorValue 0x6b8e23ff,
  ORANGE=ColorValue 0xffa500ff,
  ORANGERED=ColorValue 0xff4500ff,
  ORCHID=ColorValue 0xda70d6ff,
  PALEGOLDENROD=ColorValue 0xeee8aaff,
  PALEGREEN=ColorValue 0x98fb98ff,
  PALETURQUOISE=ColorValue 0xafeeeeff,
  PALEVIOLETRED=ColorValue 0xdb7093ff,
  PAPAYAWHIP=ColorValue 0xffefd5ff,
  PEACHPUFF=ColorValue 0xffdab9ff,
  PERU=ColorValue 0xcd853fff,
  PINK=ColorValue 0xffc0cbff,
  PLUM=ColorValue 0xdda0ddff,
  POWDERBLUE=ColorValue 0xb0e0e6ff,
  PURPLE=ColorValue 0x800080ff,
  RED=ColorValue 0xff0000ff,
  ROSYBROWN=ColorValue 0xbc8f8fff,
  ROYALBLUE=ColorValue 0x4169e1ff,
  SADDLEBROWN=ColorValue 0x8b4513ff,
  SALMON=ColorValue 0xfa8072ff,
  SANDYBROWN=ColorValue 0xf4a460ff,
  SEAGREEN=ColorValue 0x2e8b57ff,
  SEASHELL=ColorValue 0xfff5eeff,
  SIENNA=ColorValue 0xa0522dff,
  SILVER=ColorValue 0xc0c0c0ff,
  SKYBLUE=ColorValue 0x87ceebff,
  SLATEBLUE=ColorValue 0x6a5acdff,
  SLATEGRAY=ColorValue 0x708090ff,
  SLATEGREY=ColorValue 0x708090ff,
  SNOW=ColorValue 0xfffafaff,
  SPRINGGREEN=ColorValue 0x00ff7fff,
  STEELBLUE=ColorValue 0x4682b4ff,
  TAN=ColorValue 0xd2b48cff,
  TEAL=ColorValue 0x008080ff,
  THISTLE=ColorValue 0xd8bfd8ff,
  TOMATO=ColorValue 0xff6347ff,
  TRANSPARENT=ColorValue 0x00000000,
  TURQUOISE=ColorValue 0x40e0d0ff,
  VIOLET=ColorValue 0xee82eeff,
  WHEAT=ColorValue 0xf5deb3ff,
  WHITE=ColorValue 0xffffffff,
  WHITESMOKE=ColorValue 0xf5f5f5ff,
  YELLOW=ColorValue 0xffff00ff,
  YELLOWGREEN=ColorValue 0x9acd32ff
}

Events : map =

17 элементов
{
  DRAG_DETECTED=0,
  MOUSE_CLICKED=1,
  MOUSE_DRAGGED=2,
  MOUSE_ENTERED=3,
  MOUSE_ENTERED_TARGET=4,
  MOUSE_EXITED=5,
  MOUSE_EXITED_TARGET=6,
  MOUSE_MOVED=7,
  MOUSE_PRESSED=8,
  MOUSE_RELEASED=9,
  KEY_PRESSED=10,
  KEY_RELEASED=11,
  KEY_TYPED=12,
  SWIPE_DOWN=13,
  SWIPE_LEFT=14,
  SWIPE_RIGHT=15,
  SWIPE_UP=16
}

FillRule : map = {EVEN_ODD=0, NON_ZERO=1}

KeyCode : map =

224 элементов
{
  A=36,
  ACCEPT=158,
  ADD=76,
  AGAIN=180,
  ALL_CANDIDATES=168,
  ALPHANUMERIC=162,
  ALT=7,
  ALT_GRAPH=185,
  AMPERSAND=134,
  ASTERISK=135,
  AT=141,
  B=37,
  BACK_QUOTE=112,
  BACK_SLASH=63,
  BACK_SPACE=1,
  BEGIN=186,
  BRACELEFT=139,
  BRACERIGHT=140,
  C=38,
  CANCEL=3,
  CAPS=9,
  CHANNEL_DOWN=218,
  CHANNEL_UP=217,
  CIRCUMFLEX=143,
  CLEAR=4,
  CLOSE_BRACKET=64,
  CODE_INPUT=170,
  COLON=142,
  COLORED_KEY_0=206,
  COLORED_KEY_1=207,
  COLORED_KEY_2=208,
  COLORED_KEY_3=209,
  COMMA=20,
  COMMAND=222,
  COMPOSE=184,
  CONTEXT_MENU=154,
  CONTROL=6,
  CONVERT=156,
  COPY=177,
  CUT=176,
  D=39,
  DEAD_ABOVEDOT=124,
  DEAD_ABOVERING=126,
  DEAD_ACUTE=119,
  DEAD_BREVE=123,
  DEAD_CARON=128,
  DEAD_CEDILLA=129,
  DEAD_CIRCUMFLEX=120,
  DEAD_DIAERESIS=125,
  DEAD_DOUBLEACUTE=127,
  DEAD_GRAVE=118,
  DEAD_IOTA=131,
  DEAD_MACRON=122,
  DEAD_OGONEK=130,
  DEAD_SEMIVOICED_SOUND=133,
  DEAD_TILDE=121,
  DEAD_VOICED_SOUND=132,
  DECIMAL=79,
  DELETE=81,
  DIGIT0=24,
  DIGIT1=25,
  DIGIT2=26,
  DIGIT3=27,
  DIGIT4=28,
  DIGIT5=29,
  DIGIT6=30,
  DIGIT7=31,
  DIGIT8=32,
  DIGIT9=33,
  DIVIDE=80,
  DOLLAR=144,
  DOWN=19,
  E=40,
  EJECT_TOGGLE=210,
  END=14,
  ENTER=0,
  EQUALS=35,
  ESCAPE=10,
  EURO_SIGN=145,
  EXCLAMATION_MARK=146,
  F=41,
  F1=84,
  F10=93,
  F11=94,
  F12=95,
  F13=96,
  F14=97,
  F15=98,
  F16=99,
  F17=100,
  F18=101,
  F19=102,
  F2=85,
  F20=103,
  F21=104,
  F22=105,
  F23=106,
  F24=107,
  F3=86,
  F4=87,
  F5=88,
  F6=89,
  F7=90,
  F8=91,
  F9=92,
  FAST_FWD=213,
  FINAL=155,
  FIND=181,
  FULL_WIDTH=165,
  G=42,
  GAME_A=198,
  GAME_B=199,
  GAME_C=200,
  GAME_D=201,
  GREATER=138,
  H=43,
  HALF_WIDTH=166,
  HELP=110,
  HIRAGANA=164,
  HOME=15,
  I=44,
  INFO=205,
  INPUT_METHOD_ON_OFF=175,
  INSERT=109,
  INVERTED_EXCLAMATION_MARK=147,
  J=45,
  JAPANESE_HIRAGANA=172,
  JAPANESE_KATAKANA=171,
  JAPANESE_ROMAN=173,
  K=46,
  KANA=160,
  KANA_LOCK=174,
  KANJI=161,
  KATAKANA=163,
  KP_DOWN=115,
  KP_LEFT=116,
  KP_RIGHT=117,
  KP_UP=114,
  L=47,
  LEFT=16,
  LEFT_PARENTHESIS=148,
  LESS=137,
  M=48,
  META=111,
  MINUS=21,
  MODECHANGE=159,
  MULTIPLY=75,
  MUTE=221,
  N=49,
  NONCONVERT=157,
  NUMBER_SIGN=149,
  NUMPAD0=65,
  NUMPAD1=66,
  NUMPAD2=67,
  NUMPAD3=68,
  NUMPAD4=69,
  NUMPAD5=70,
  NUMPAD6=71,
  NUMPAD7=72,
  NUMPAD8=73,
  NUMPAD9=74,
  NUM_LOCK=82,
  O=50,
  OPEN_BRACKET=62,
  P=51,
  PAGE_DOWN=13,
  PAGE_UP=12,
  PASTE=178,
  PAUSE=8,
  PERIOD=22,
  PLAY=211,
  PLUS=150,
  POUND=203,
  POWER=204,
  PREVIOUS_CANDIDATE=169,
  PRINTSCREEN=108,
  PROPS=182,
  Q=52,
  QUOTE=113,
  QUOTEDBL=136,
  R=53,
  RECORD=212,
  REWIND=214,
  RIGHT=18,
  RIGHT_PARENTHESIS=151,
  ROMAN_CHARACTERS=167,
  S=54,
  SCROLL_LOCK=83,
  SEMICOLON=34,
  SEPARATOR=77,
  SHIFT=5,
  SHORTCUT=223,
  SLASH=23,
  SOFTKEY_0=188,
  SOFTKEY_1=189,
  SOFTKEY_2=190,
  SOFTKEY_3=191,
  SOFTKEY_4=192,
  SOFTKEY_5=193,
  SOFTKEY_6=194,
  SOFTKEY_7=195,
  SOFTKEY_8=196,
  SOFTKEY_9=197,
  SPACE=11,
  STAR=202,
  STOP=183,
  SUBTRACT=78,
  T=55,
  TAB=2,
  TRACK_NEXT=216,
  TRACK_PREV=215,
  U=56,
  UNDEFINED=187,
  UNDERSCORE=152,
  UNDO=179,
  UP=17,
  V=57,
  VOLUME_DOWN=220,
  VOLUME_UP=219,
  W=58,
  WINDOWS=153,
  X=59,
  Y=60,
  Z=61
}

MouseButton : map = {NONE=0, PRIMARY=1, MIDDLE=2, SECONDARY=3}

StrokeLineCap : map = {SQUARE=0, BUTT=1, ROUND=2}

StrokeLineJoin : map = {MITER=0, BEVEL=1, ROUND=2}

TextAlignment : map = {LEFT=0, CENTER=1, RIGHT=2, JUSTIFY=3}

VPos : map = {TOP=0, CENTER=1, BASELINE=2, BOTTOM=3}

Функции

BlendEffect()

BloomEffect()

BoxBlurEffect()

ColorAdjustEffect()

ColorInputEffect()

DropShadowEffect()

GaussianBlurEffect()

GlowEffect()

InnerShadowEffect()

LightingEffect()

MotionBlurEffect()

PerspectiveTransformEffect()

ReflectionEffect()

SepiaToneEffect()

ShadowEffect()

addEventFilter()

addEventHandler()

createImage(...)createImage(url) - создаёт изображение из пути к ресурсу.

createImage(w, h) - создаёт новое изображение с заданным размером.

createBitmap(w, h, pixels) - создаёт изображение из массива пикселей.

Возвращает ImageFXValue.

use canvasfx

g = showcanvas()
url = "http://lorempixel.com/640/480/nature"
bitmap = createImage(url)
g.drawBitmap(bitmap, 0, 0)
bitmap = createImage("file:image.png")
g.drawBitmap(bitmap, 200, 0)

repaint()

window()

Типы

ColorValue

EffectValue

GraphicsFXValue

Функции

appendSVGPath()

applyEffect()

arc()

arcTo()

beginPath()

bezierCurveTo()

clearRect()

clip()

closePath()

fill()

fillArc()

fillOval()

fillPolygon()

fillRect()

fillRoundRect()

fillText()

getFill()

getFillRule()

getGlobalAlpha()

getGlobalBlendMode()

getLineCap()

getLineJoin()

getLineWidth()

getMiterLimit()

getStroke()

getTextAlign()

getTextBaseline()

isPointInPath()

lineTo()

moveTo()

quadraticCurveTo()

rect()

restore()

rotate()

save()

scale()

setEffect()

setFill()

setFillRule()

setGlobalAlpha()

setGlobalBlendMode()

setLineCap()

setLineJoin()

setLineWidth()

setMiterLimit()

setStroke()

setTextAlign()

setTextBaseline()

stroke()

strokeArc()

strokeLine(x1, y1, x2, y2)

strokeOval()

strokePolygon()

strokePolyline()

strokeRect()

strokeRoundRect()

strokeText()

transform()

translate()

ImageFXValue

Функции

getPixels() — возвращает массив пикселей изображения