MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / Graphics

Class Graphics

CodenameOne/src/com/codename1/ui/Graphics.java:39–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37/// using either a paint callback or a mutable image. There is no supported way to create this
38/// object directly.
39public final class Graphics {
40 /// Rendering hint to indicate that the context should prefer to render
41 /// primitives in a quick way, at the cost of quality, if there is an
42 /// expensive operation.
43 ///
44 /// #### See also
45 ///
46 /// - #setRenderingHints(int)
47 ///
48 /// - #getRenderingHints()
49 public static final int RENDERING_HINT_FAST = 1;
50 private final CodenameOneImplementation impl;
51 /// Flag that specifies that native peers are rendered "behind" the this
52 /// graphics context. The main difference is that drawPeerComponent() will
53 /// call clearRect() for its bounds to "poke a hole" in the graphics context
54 /// to see through to the native layer.
55 boolean paintPeersBehind;
56 private int xTranslate;
57 private int yTranslate;
58 private Transform translation;
59 /// Last non-identity argument to setTransform(). When the impl has
60 /// `isTranslationSupported() == false` (every active port today: iOS,
61 /// Android, JavaSE, JavaScript), the matrix actually pushed to
62 /// impl.setTransform is `T(xTranslate) * userTransform * T(-xTranslate)`,
63 /// so the user-visible transform applies to local coordinates regardless
64 /// of any prior g.translate(). getTransform() returns this original
65 /// (un-conjugated) matrix.
66 private Transform userTransform;
67 private GeneralPath tmpClipShape;
68 /// A buffer shape to use when we need to transform a shape
69 private int color;
70 private Paint paint;
71 private Font current = Font.getDefaultFont();
72 private Object nativeGraphics;
73 private Object[] nativeGraphicsState;
74 private float scaleX = 1;
75 private float scaleY = 1;
76
77 /// Constructing new graphics with a given javax.microedition.lcdui.Graphics
78 ///
79 /// #### Parameters
80 ///
81 /// - `g`: an implementation dependent native graphics instance
82 Graphics(Object nativeGraphics) {
83 setGraphics(nativeGraphics);
84 impl = Display.impl;
85 }
86
87 // PMD thinks we need to override finalize. Ugh.
88 @SuppressWarnings("PMD.MissingOverride")
89 protected void finalize() {
90 if (nativeGraphics != null) {
91 impl.disposeGraphics(nativeGraphics);
92 }
93 }
94
95 private Transform translation() {
96 if (translation == null) {

Callers

nothing calls this directly

Calls 1

getDefaultFontMethod · 0.95

Tested by

no test coverage detected