Package playn.core
Class Graphics
java.lang.Object
playn.core.Graphics
Provides access to graphics information and services.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates simplified device orientations.static enumEnumerates detailed device orientations. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe render target for the default framebuffer.final ValueView<Graphics.Orientation>The current orientation of the device.final GL20Provides access to GL services.The current orientation of the device in more detailed form.final IDimensionThe current size of the graphics viewport. -
Method Summary
Modifier and TypeMethodDescriptioncreateCanvas(float width, float height) Creates aCanvaswith the specified display unit size.abstract CanvascreateCanvas(Scale scale, int pixelWidth, int pixelHeight) Creates aCanvasat the specified scale and with the specified (pixel) width and height.createCanvas(IDimension size) abstract GradientcreateGradient(Gradient.Config config) Creates aGradientfill pattern.abstract PathCreates aPathobject.createTexture(float width, float height, Texture.Config config) Creates an empty texture into which one can render.createTexture(IDimension size, Texture.Config config) abstract TextLayoutlayoutText(String text, TextFormat format) Lays out a single line of text using the specified format.abstract TextLayout[]layoutText(String text, TextFormat format, TextWrap wrap) Lays out multiple lines of text using the specified format and wrap configuration.scale()Returns the display scale factor.abstract IDimensionReturns the size of the screen in display units.
-
Field Details
-
gl
Provides access to GL services. -
viewSize
The current size of the graphics viewport. -
deviceOrient
The current orientation of the device. Devices that do not support orientation will always bePORTRAIT. -
orientDetail
The current orientation of the device in more detailed form. Devices that do not support orientation will always beUNKNOWN. -
defaultRenderTarget
The render target for the default framebuffer.
-
-
Method Details
-
scale
Returns the display scale factor. This will beScale.ONEexcept on HiDPI devices that have been configured to use HiDPI mode. -
screenSize
Returns the size of the screen in display units. On some platforms (like the desktop) the screen size may be larger than the view size. -
createCanvas
Creates aCanvaswith the specified display unit size. -
createCanvas
-
createCanvas
Creates aCanvasat the specified scale and with the specified (pixel) width and height. Most callers should usecreateCanvas(float,float)rather than this method, but if you have special needs, this gives you full control over the size of the canvas's underlying bitmap. -
createPath
Creates aPathobject. -
createGradient
Creates aGradientfill pattern. -
createTexture
Creates an empty texture into which one can render. The supplied width and height are in display units and will be converted to pixels based on the current scale factor. -
createTexture
-
layoutText
Lays out a single line of text using the specified format. The text may subsequently be rendered on a canvas via(TextLayout,float,float). -
layoutText
Lays out multiple lines of text using the specified format and wrap configuration. The text may subsequently be rendered on a canvas via(TextLayout,float,float).
-