Package playn.core
Class Graphics
java.lang.Object
playn.core.Graphics
Provides access to graphics information and services.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumerates simplified device orientations.static enum
Enumerates detailed device orientations. -
Field Summary
Modifier and TypeFieldDescriptionThe render target for the default framebuffer.final ValueView<Graphics.Orientation>
The current orientation of the device.final GL20
Provides access to GL services.The current orientation of the device in more detailed form.final IDimension
The current size of the graphics viewport. -
Method Summary
Modifier and TypeMethodDescriptioncreateCanvas
(float width, float height) Creates aCanvas
with the specified display unit size.abstract Canvas
createCanvas
(Scale scale, int pixelWidth, int pixelHeight) Creates aCanvas
at the specified scale and with the specified (pixel) width and height.createCanvas
(IDimension size) abstract Gradient
createGradient
(Gradient.Config config) Creates aGradient
fill pattern.abstract Path
Creates aPath
object.createTexture
(float width, float height, Texture.Config config) Creates an empty texture into which one can render.createTexture
(IDimension size, Texture.Config config) abstract TextLayout
layoutText
(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 IDimension
Returns 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.ONE
except 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 aCanvas
with the specified display unit size. -
createCanvas
-
createCanvas
Creates aCanvas
at 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 aPath
object. -
createGradient
Creates aGradient
fill 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)
.
-