Class Image
-
-
Field Summary
Fields Modifier and Type Field Description private final transient BooleanfixedSizeprivate PolyImageimageprivate final ImagePropertiespropertiesprivate transient PolyColor.Animatedcolorprivate transient Drawableparentprivate transient Layoutlayoutprivate transient BooleanconsumesHoverprivate Booleandisabledprivate Vec2<Unit>sizeprivate final transient HashMap<Event, Function2<Drawable, Event, Boolean>>eventHandlersprivate transient StringsimpleNameprivate transient Rendererrendererprivate transient PolyUIpolyUIprivate BooleanacceptsInputprivate final transient ByteinitStageprivate final transient BooleanmouseOverprivate transient Booleanrendersprivate Floatxprivate Floatyprivate Floatwidthprivate Floatheightprivate Booleanexistsprivate transient FloattrueXprivate transient FloattrueYprivate final Unit.TypeatTypeprivate final Unit.TypesizeTypeprivate final BooleanisDynamicprivate Doublerotationprivate DoubleskewXprivate DoubleskewYprivate FloatscaleXprivate FloatscaleYprivate Floatalphaprivate transient Floatacxprivate transient Floatacyprivate final Vec2<Unit>atprivate final BooleanrawResize
-
Constructor Summary
Constructors Constructor Description Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Image>, Unit> events)Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize, Boolean acceptInput)Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize)Image(ImageProperties properties, PolyImage image, Vec2<Unit> at)Image(PolyImage image, Vec2<Unit> at)
-
Method Summary
Modifier and Type Method Description final BooleangetFixedSize()final PolyImagegetImage()final UnitsetImage(PolyImage image)ImagePropertiesgetProperties()Unitsetup(Renderer renderer, PolyUI polyUI)give this a renderer reference and a PolyUI reference. UnitonColorsChanged(Colors colors)Function that is called when the colors attached to this drawable change. Unitrescale(Float scaleX, Float scaleY)Method that is called when the physical size of the total window area changes. Unitrender()draw script for this drawable. Vec2<Unit>calculateSize()Implement this function to return the size of this drawable, if no size is specified during construction. -
Methods inherited from class org.polyfrost.polyui.component.Component
accept, addKeyframes, addOperation, calculateBounds, canBeRemoved, debugRender, draggable, every, getColor, getConsumesHover, getDisabled, getLayout, getParent, getSize, onFontsChanged, preRender, recolor, setColor, setConsumesHover, setDisabled, setLayout, setParent, setProperties, setSize, toString, trueX, trueY, wantRedraw -
Methods inherited from class org.polyfrost.polyui.component.Drawable
addEventHandler, addEventhandler, animateBy, animateTo, clone, debugPrint, doDynamicSize, events, fadeBy, fadeTo, getAcceptsInput, getAcx, getAcy, getAlpha, getAt, getAtType, getContainingLayout, getEventHandlers, getExists, getHeight, getInitStage, getMouseOver, getPolyUI, getRawResize, getRenderer, getRenders, getRotation, getScaleX, getScaleY, getSimpleName, getSizeType, getSkewX, getSkewY, getTrueX, getTrueY, getWidth, getX, getY, intersects, isDynamic, isInside, isInside, moveBy, moveTo, onInitComplete, onParentInitComplete, postRender, removeOperation, reset, resize, rotateBy, rotateTo, scaleBy, scaleTo, setAcceptsInput, setAcx, setAcy, setAlpha, setExists, setHeight, setPolyUI, setRenderer, setRenders, setRotation, setScaleX, setScaleY, setSimpleName, setSkewX, setSkewY, setTrueX, setTrueY, setWidth, setX, setY, skewBy, skewTo -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Image
Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Image>, Unit> events)
-
Image
Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize, Boolean acceptInput)
-
Image
Image(ImageProperties properties, PolyImage image, Vec2<Unit> at, Boolean rawResize)
-
Image
Image(ImageProperties properties, PolyImage image, Vec2<Unit> at)
-
-
Method Detail
-
getFixedSize
final Boolean getFixedSize()
-
getProperties
ImageProperties getProperties()
-
setup
Unit setup(Renderer renderer, PolyUI polyUI)
give this a renderer reference and a PolyUI reference.
You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes.
If you need a method that has access to component's sizes, see here or here (if you are operating on yourself only).
this method is called once, and only once.
-
onColorsChanged
Unit onColorsChanged(Colors colors)
Function that is called when the colors attached to this drawable change.
If this is a layout, the colors will change, and all its children and components will be notified and updated accordingly.
Make sure to call super.onColorsChanged() if you override this!
- Since:
0.17.5
-
rescale
Unit rescale(Float scaleX, Float scaleY)
Method that is called when the physical size of the total window area changes.
-
calculateSize
Vec2<Unit> calculateSize()
Implement this function to return the size of this drawable, if no size is specified during construction.
This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:
size: Vec2<org.polyfrost.polyui.unit.Unit>? = null;and this method needs to be implemented!Otherwise, the size parameter in the constructor must be specified.
-
-
-
-