Loading core/java/com/android/internal/widget/remotecompose/accessibility/PlatformRemoteComposeTouchHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import com.android.internal.widget.ExploreByTouchHelper; import com.android.internal.widget.remotecompose.core.CoreDocument; import com.android.internal.widget.remotecompose.core.operations.layout.Component; import com.android.internal.widget.remotecompose.core.semantics.AccessibilitySemantics; import com.android.internal.widget.remotecompose.core.semantics.CoreSemantics.Mode; import com.android.internal.widget.remotecompose.core.semantics.AccessibleComponent.Mode; import java.util.HashSet; import java.util.List; Loading core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +81 −44 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class CoreDocument { return mWidth; } /** * Set the viewport width of the document * * @param width document width */ public void setWidth(int width) { this.mWidth = width; mRemoteComposeState.setWindowWidth(width); Loading @@ -132,6 +137,11 @@ public class CoreDocument { return mHeight; } /** * Set the viewport height of the document * * @param height document height */ public void setHeight(int height) { this.mHeight = height; mRemoteComposeState.setWindowHeight(height); Loading Loading @@ -395,6 +405,11 @@ public class CoreDocument { // ============== Haptic support ================== public interface HapticEngine { /** * Implements a haptic effect * * @param type the type of effect */ void haptic(int type); } Loading @@ -404,6 +419,11 @@ public class CoreDocument { mHapticEngine = engine; } /** * Execute an haptic command * * @param type the type of haptic pre-defined effect */ public void haptic(int type) { if (mHapticEngine != null) { mHapticEngine.haptic(type); Loading @@ -412,12 +432,23 @@ public class CoreDocument { // ============== Haptic support ================== public void appliedTouchOperation(Component operation) { mAppliedTouchOperations.add(operation); /** * To signal that the given component will apply the touch operation * * @param component the component applying the touch */ public void appliedTouchOperation(Component component) { mAppliedTouchOperations.add(component); } /** Callback interface for host actions */ public interface ActionCallback { /** * Callback for actions * * @param name the action name * @param value the payload of the action */ void onAction(@NonNull String name, Object value); } Loading Loading @@ -450,7 +481,14 @@ public class CoreDocument { mActionListeners.clear(); } /** Id Actions */ public interface IdActionCallback { /** * Callback on Id Actions * * @param id the actio id triggered * @param metadata optional metadata */ void onAction(int id, @Nullable String metadata); } Loading Loading @@ -530,10 +568,20 @@ public class CoreDocument { return mTop; } /** * Returns the width of the click area * * @return the width of the click area */ public float width() { return Math.max(0, mRight - mLeft); } /** * Returns the height of the click area * * @return the height of the click area */ public float height() { return Math.max(0, mBottom - mTop); } Loading Loading @@ -816,6 +864,7 @@ public class CoreDocument { for (ClickAreaRepresentation clickArea : mClickAreas) { if (clickArea.mId == id) { warnClickListeners(clickArea); return; } } for (IdActionCallback listener : mIdActionListeners) { Loading Loading @@ -1127,6 +1176,11 @@ public class CoreDocument { return count; } /** * Returns a list of useful statistics for the runtime document * * @return */ @NonNull public String[] getStats() { ArrayList<String> ret = new ArrayList<>(); Loading @@ -1145,8 +1199,8 @@ public class CoreDocument { values[0] += 1; values[1] += sizeOfComponent(mOperation, buffer); if (mOperation instanceof Component) { Component com = (Component) mOperation; if (mOperation instanceof Container) { Container com = (Container) mOperation; count += addChildren(com, map, buffer); } else if (mOperation instanceof LoopOperation) { LoopOperation com = (LoopOperation) mOperation; Loading @@ -1172,9 +1226,9 @@ public class CoreDocument { } private int addChildren( @NonNull Component base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.mList.size(); for (Operation mOperation : base.mList) { @NonNull Container base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.getList().size(); for (Operation mOperation : base.getList()) { Class<? extends Operation> c = mOperation.getClass(); int[] values; if (map.containsKey(c.getSimpleName())) { Loading @@ -1185,65 +1239,42 @@ public class CoreDocument { } values[0] += 1; values[1] += sizeOfComponent(mOperation, tmp); if (mOperation instanceof Component) { count += addChildren((Component) mOperation, map, tmp); } if (mOperation instanceof LoopOperation) { count += addChildren((LoopOperation) mOperation, map, tmp); } } return count; } private int addChildren( @NonNull LoopOperation base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.mList.size(); for (Operation mOperation : base.mList) { Class<? extends Operation> c = mOperation.getClass(); int[] values; if (map.containsKey(c.getSimpleName())) { values = map.get(c.getSimpleName()); } else { values = new int[2]; map.put(c.getSimpleName(), values); } values[0] += 1; values[1] += sizeOfComponent(mOperation, tmp); if (mOperation instanceof Component) { count += addChildren((Component) mOperation, map, tmp); } if (mOperation instanceof LoopOperation) { count += addChildren((LoopOperation) mOperation, map, tmp); if (mOperation instanceof Container) { count += addChildren((Container) mOperation, map, tmp); } } return count; } /** * Returns a string representation of the operations, traversing the list of operations & * containers * * @return */ @NonNull public String toNestedString() { StringBuilder ret = new StringBuilder(); for (Operation mOperation : mOperations) { ret.append(mOperation.toString()); ret.append("\n"); if (mOperation instanceof Component) { toNestedString((Component) mOperation, ret, " "); if (mOperation instanceof Container) { toNestedString((Container) mOperation, ret, " "); } } return ret.toString(); } private void toNestedString( @NonNull Component base, @NonNull StringBuilder ret, String indent) { for (Operation mOperation : base.mList) { @NonNull Container base, @NonNull StringBuilder ret, String indent) { for (Operation mOperation : base.getList()) { for (String line : mOperation.toString().split("\n")) { ret.append(indent); ret.append(line); ret.append("\n"); } if (mOperation instanceof Component) { toNestedString((Component) mOperation, ret, indent + " "); if (mOperation instanceof Container) { toNestedString((Container) mOperation, ret, indent + " "); } } } Loading @@ -1255,6 +1286,12 @@ public class CoreDocument { /** defines if a shader can be run */ public interface ShaderControl { /** * validate if a shader can run in the document * * @param shader the source of the shader * @return true if the shader is allowed to run */ boolean isShaderValid(String shader); } Loading core/java/com/android/internal/widget/remotecompose/core/Operations.java +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ import com.android.internal.widget.remotecompose.core.operations.MatrixSkew; import com.android.internal.widget.remotecompose.core.operations.MatrixTranslate; import com.android.internal.widget.remotecompose.core.operations.NamedVariable; import com.android.internal.widget.remotecompose.core.operations.PaintData; import com.android.internal.widget.remotecompose.core.operations.ParticlesCreate; import com.android.internal.widget.remotecompose.core.operations.ParticlesLoop; import com.android.internal.widget.remotecompose.core.operations.PathAppend; import com.android.internal.widget.remotecompose.core.operations.PathCreate; import com.android.internal.widget.remotecompose.core.operations.PathData; Loading @@ -75,6 +77,8 @@ import com.android.internal.widget.remotecompose.core.operations.layout.CanvasCo import com.android.internal.widget.remotecompose.core.operations.layout.ClickModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.ComponentStart; import com.android.internal.widget.remotecompose.core.operations.layout.ContainerEnd; import com.android.internal.widget.remotecompose.core.operations.layout.ImpulseOperation; import com.android.internal.widget.remotecompose.core.operations.layout.ImpulseProcess; import com.android.internal.widget.remotecompose.core.operations.layout.LayoutComponentContent; import com.android.internal.widget.remotecompose.core.operations.layout.LoopOperation; import com.android.internal.widget.remotecompose.core.operations.layout.RootLayoutComponent; Loading Loading @@ -188,6 +192,11 @@ public class Operations { public static final int PATH_TWEEN = 158; public static final int PATH_CREATE = 159; public static final int PATH_ADD = 160; public static final int PARTICLE_CREATE = 161; public static final int PARTICLE_PROCESS = 162; public static final int PARTICLE_LOOP = 163; public static final int IMPULSE_START = 164; public static final int IMPULSE_PROCESS = 165; ///////////////////////////////////////// ====================== Loading Loading @@ -366,6 +375,10 @@ public class Operations { map.put(PATH_TWEEN, PathTween::read); map.put(PATH_CREATE, PathCreate::read); map.put(PATH_ADD, PathAppend::read); map.put(IMPULSE_START, ImpulseOperation::read); map.put(IMPULSE_PROCESS, ImpulseProcess::read); map.put(PARTICLE_CREATE, ParticlesCreate::read); map.put(PARTICLE_LOOP, ParticlesLoop::read); map.put(ACCESSIBILITY_SEMANTICS, CoreSemantics::read); // map.put(ACCESSIBILITY_CUSTOM_ACTION, CoreSemantics::read); Loading core/java/com/android/internal/widget/remotecompose/core/PaintContext.java +147 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,16 @@ public abstract class PaintContext { return mContext; } /** * Returns true if the needsRepaint flag is set * * @return true if the document asks to be repainted */ public boolean doesNeedsRepaint() { return mNeedsRepaint; } /** Clear the needsRepaint flag */ public void clearNeedsRepaint() { mNeedsRepaint = false; } Loading Loading @@ -65,6 +71,20 @@ public abstract class PaintContext { matrixSave(); } /** * Draw a bitmap * * @param imageId * @param srcLeft * @param srcTop * @param srcRight * @param srcBottom * @param dstLeft * @param dstTop * @param dstRight * @param dstBottom * @param cdId */ public abstract void drawBitmap( int imageId, int srcLeft, Loading @@ -77,26 +97,105 @@ public abstract class PaintContext { int dstBottom, int cdId); /** * scale the following commands * * @param scaleX horizontal scale factor * @param scaleY vertical scale factor */ public abstract void scale(float scaleX, float scaleY); /** * Rotate the following commands * * @param translateX horizontal translation * @param translateY vertical translation */ public abstract void translate(float translateX, float translateY); /** * Draw an arc * * @param left * @param top * @param right * @param bottom * @param startAngle * @param sweepAngle */ public abstract void drawArc( float left, float top, float right, float bottom, float startAngle, float sweepAngle); /** * Draw a sector * * @param left * @param top * @param right * @param bottom * @param startAngle * @param sweepAngle */ public abstract void drawSector( float left, float top, float right, float bottom, float startAngle, float sweepAngle); /** * Draw a bitmap * * @param id * @param left * @param top * @param right * @param bottom */ public abstract void drawBitmap(int id, float left, float top, float right, float bottom); /** * Draw a circle * * @param centerX * @param centerY * @param radius */ public abstract void drawCircle(float centerX, float centerY, float radius); /** * Draw a line * * @param x1 * @param y1 * @param x2 * @param y2 */ public abstract void drawLine(float x1, float y1, float x2, float y2); /** * Draw an oval * * @param left * @param top * @param right * @param bottom */ public abstract void drawOval(float left, float top, float right, float bottom); /** * Draw a path * * @param id the path id * @param start starting point of the path where we start drawing it * @param end ending point of the path where we stop drawing it */ public abstract void drawPath(int id, float start, float end); /** * Draw a rectangle * * @param left left coordinate of the rectangle * @param top top coordinate of the rectangle * @param right right coordinate of the rectangle * @param bottom bottom coordinate of the rectangle */ public abstract void drawRect(float left, float top, float right, float bottom); /** this caches the paint to a paint stack */ Loading @@ -105,9 +204,27 @@ public abstract class PaintContext { /** This restores the paint form the paint stack */ public abstract void restorePaint(); /** * draw a round rect * * @param left left coordinate of the rectangle * @param top top coordinate of the rectangle * @param right right coordinate of the rectangle * @param bottom bottom coordinate of the rectangle * @param radiusX horizontal radius of the rounded corner * @param radiusY vertical radius of the rounded corner */ public abstract void drawRoundRect( float left, float top, float right, float bottom, float radiusX, float radiusY); /** * Draw the text glyphs on the provided path * * @param textId id of the text * @param pathId id of the path * @param hOffset horizontal offset * @param vOffset vertical offset */ public abstract void drawTextOnPath(int textId, int pathId, float hOffset, float vOffset); /** Loading Loading @@ -158,6 +275,14 @@ public abstract class PaintContext { public abstract void drawTweenPath( int path1Id, int path2Id, float tween, float start, float stop); /** * Interpolate between two path and return the resulting path * * @param out the interpolated path * @param path1 start path * @param path2 end path * @param tween interpolation value from 0 (start path) to 1 (end path) */ public abstract void tweenPath(int out, int path1, int path2, float tween); /** Loading Loading @@ -275,12 +400,33 @@ public abstract class PaintContext { System.out.println("[LOG] " + content); } /** Indicates the document needs to be repainted */ public void needsRepaint() { mNeedsRepaint = true; } /** * Starts a graphics layer * * @param w * @param h */ public abstract void startGraphicsLayer(int w, int h); /** * Starts a graphics layer * * @param scaleX * @param scaleY * @param rotationX * @param rotationY * @param rotationZ * @param shadowElevation * @param transformOriginX * @param transformOriginY * @param alpha * @param renderEffectId */ public abstract void setGraphicsLayer( float scaleX, float scaleY, Loading @@ -293,6 +439,7 @@ public abstract class PaintContext { float alpha, int renderEffectId); /** Ends a graphics layer */ public abstract void endGraphicsLayer(); public boolean isVisualDebug() { Loading core/java/com/android/internal/widget/remotecompose/core/PaintOperation.java +5 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ public abstract class PaintOperation extends Operation { return indent + toString(); } /** * Paint the operation in the context * * @param context painting context */ public abstract void paint(@NonNull PaintContext context); /** Loading Loading
core/java/com/android/internal/widget/remotecompose/accessibility/PlatformRemoteComposeTouchHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import com.android.internal.widget.ExploreByTouchHelper; import com.android.internal.widget.remotecompose.core.CoreDocument; import com.android.internal.widget.remotecompose.core.operations.layout.Component; import com.android.internal.widget.remotecompose.core.semantics.AccessibilitySemantics; import com.android.internal.widget.remotecompose.core.semantics.CoreSemantics.Mode; import com.android.internal.widget.remotecompose.core.semantics.AccessibleComponent.Mode; import java.util.HashSet; import java.util.List; Loading
core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +81 −44 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class CoreDocument { return mWidth; } /** * Set the viewport width of the document * * @param width document width */ public void setWidth(int width) { this.mWidth = width; mRemoteComposeState.setWindowWidth(width); Loading @@ -132,6 +137,11 @@ public class CoreDocument { return mHeight; } /** * Set the viewport height of the document * * @param height document height */ public void setHeight(int height) { this.mHeight = height; mRemoteComposeState.setWindowHeight(height); Loading Loading @@ -395,6 +405,11 @@ public class CoreDocument { // ============== Haptic support ================== public interface HapticEngine { /** * Implements a haptic effect * * @param type the type of effect */ void haptic(int type); } Loading @@ -404,6 +419,11 @@ public class CoreDocument { mHapticEngine = engine; } /** * Execute an haptic command * * @param type the type of haptic pre-defined effect */ public void haptic(int type) { if (mHapticEngine != null) { mHapticEngine.haptic(type); Loading @@ -412,12 +432,23 @@ public class CoreDocument { // ============== Haptic support ================== public void appliedTouchOperation(Component operation) { mAppliedTouchOperations.add(operation); /** * To signal that the given component will apply the touch operation * * @param component the component applying the touch */ public void appliedTouchOperation(Component component) { mAppliedTouchOperations.add(component); } /** Callback interface for host actions */ public interface ActionCallback { /** * Callback for actions * * @param name the action name * @param value the payload of the action */ void onAction(@NonNull String name, Object value); } Loading Loading @@ -450,7 +481,14 @@ public class CoreDocument { mActionListeners.clear(); } /** Id Actions */ public interface IdActionCallback { /** * Callback on Id Actions * * @param id the actio id triggered * @param metadata optional metadata */ void onAction(int id, @Nullable String metadata); } Loading Loading @@ -530,10 +568,20 @@ public class CoreDocument { return mTop; } /** * Returns the width of the click area * * @return the width of the click area */ public float width() { return Math.max(0, mRight - mLeft); } /** * Returns the height of the click area * * @return the height of the click area */ public float height() { return Math.max(0, mBottom - mTop); } Loading Loading @@ -816,6 +864,7 @@ public class CoreDocument { for (ClickAreaRepresentation clickArea : mClickAreas) { if (clickArea.mId == id) { warnClickListeners(clickArea); return; } } for (IdActionCallback listener : mIdActionListeners) { Loading Loading @@ -1127,6 +1176,11 @@ public class CoreDocument { return count; } /** * Returns a list of useful statistics for the runtime document * * @return */ @NonNull public String[] getStats() { ArrayList<String> ret = new ArrayList<>(); Loading @@ -1145,8 +1199,8 @@ public class CoreDocument { values[0] += 1; values[1] += sizeOfComponent(mOperation, buffer); if (mOperation instanceof Component) { Component com = (Component) mOperation; if (mOperation instanceof Container) { Container com = (Container) mOperation; count += addChildren(com, map, buffer); } else if (mOperation instanceof LoopOperation) { LoopOperation com = (LoopOperation) mOperation; Loading @@ -1172,9 +1226,9 @@ public class CoreDocument { } private int addChildren( @NonNull Component base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.mList.size(); for (Operation mOperation : base.mList) { @NonNull Container base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.getList().size(); for (Operation mOperation : base.getList()) { Class<? extends Operation> c = mOperation.getClass(); int[] values; if (map.containsKey(c.getSimpleName())) { Loading @@ -1185,65 +1239,42 @@ public class CoreDocument { } values[0] += 1; values[1] += sizeOfComponent(mOperation, tmp); if (mOperation instanceof Component) { count += addChildren((Component) mOperation, map, tmp); } if (mOperation instanceof LoopOperation) { count += addChildren((LoopOperation) mOperation, map, tmp); } } return count; } private int addChildren( @NonNull LoopOperation base, @NonNull HashMap<String, int[]> map, @NonNull WireBuffer tmp) { int count = base.mList.size(); for (Operation mOperation : base.mList) { Class<? extends Operation> c = mOperation.getClass(); int[] values; if (map.containsKey(c.getSimpleName())) { values = map.get(c.getSimpleName()); } else { values = new int[2]; map.put(c.getSimpleName(), values); } values[0] += 1; values[1] += sizeOfComponent(mOperation, tmp); if (mOperation instanceof Component) { count += addChildren((Component) mOperation, map, tmp); } if (mOperation instanceof LoopOperation) { count += addChildren((LoopOperation) mOperation, map, tmp); if (mOperation instanceof Container) { count += addChildren((Container) mOperation, map, tmp); } } return count; } /** * Returns a string representation of the operations, traversing the list of operations & * containers * * @return */ @NonNull public String toNestedString() { StringBuilder ret = new StringBuilder(); for (Operation mOperation : mOperations) { ret.append(mOperation.toString()); ret.append("\n"); if (mOperation instanceof Component) { toNestedString((Component) mOperation, ret, " "); if (mOperation instanceof Container) { toNestedString((Container) mOperation, ret, " "); } } return ret.toString(); } private void toNestedString( @NonNull Component base, @NonNull StringBuilder ret, String indent) { for (Operation mOperation : base.mList) { @NonNull Container base, @NonNull StringBuilder ret, String indent) { for (Operation mOperation : base.getList()) { for (String line : mOperation.toString().split("\n")) { ret.append(indent); ret.append(line); ret.append("\n"); } if (mOperation instanceof Component) { toNestedString((Component) mOperation, ret, indent + " "); if (mOperation instanceof Container) { toNestedString((Container) mOperation, ret, indent + " "); } } } Loading @@ -1255,6 +1286,12 @@ public class CoreDocument { /** defines if a shader can be run */ public interface ShaderControl { /** * validate if a shader can run in the document * * @param shader the source of the shader * @return true if the shader is allowed to run */ boolean isShaderValid(String shader); } Loading
core/java/com/android/internal/widget/remotecompose/core/Operations.java +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ import com.android.internal.widget.remotecompose.core.operations.MatrixSkew; import com.android.internal.widget.remotecompose.core.operations.MatrixTranslate; import com.android.internal.widget.remotecompose.core.operations.NamedVariable; import com.android.internal.widget.remotecompose.core.operations.PaintData; import com.android.internal.widget.remotecompose.core.operations.ParticlesCreate; import com.android.internal.widget.remotecompose.core.operations.ParticlesLoop; import com.android.internal.widget.remotecompose.core.operations.PathAppend; import com.android.internal.widget.remotecompose.core.operations.PathCreate; import com.android.internal.widget.remotecompose.core.operations.PathData; Loading @@ -75,6 +77,8 @@ import com.android.internal.widget.remotecompose.core.operations.layout.CanvasCo import com.android.internal.widget.remotecompose.core.operations.layout.ClickModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.ComponentStart; import com.android.internal.widget.remotecompose.core.operations.layout.ContainerEnd; import com.android.internal.widget.remotecompose.core.operations.layout.ImpulseOperation; import com.android.internal.widget.remotecompose.core.operations.layout.ImpulseProcess; import com.android.internal.widget.remotecompose.core.operations.layout.LayoutComponentContent; import com.android.internal.widget.remotecompose.core.operations.layout.LoopOperation; import com.android.internal.widget.remotecompose.core.operations.layout.RootLayoutComponent; Loading Loading @@ -188,6 +192,11 @@ public class Operations { public static final int PATH_TWEEN = 158; public static final int PATH_CREATE = 159; public static final int PATH_ADD = 160; public static final int PARTICLE_CREATE = 161; public static final int PARTICLE_PROCESS = 162; public static final int PARTICLE_LOOP = 163; public static final int IMPULSE_START = 164; public static final int IMPULSE_PROCESS = 165; ///////////////////////////////////////// ====================== Loading Loading @@ -366,6 +375,10 @@ public class Operations { map.put(PATH_TWEEN, PathTween::read); map.put(PATH_CREATE, PathCreate::read); map.put(PATH_ADD, PathAppend::read); map.put(IMPULSE_START, ImpulseOperation::read); map.put(IMPULSE_PROCESS, ImpulseProcess::read); map.put(PARTICLE_CREATE, ParticlesCreate::read); map.put(PARTICLE_LOOP, ParticlesLoop::read); map.put(ACCESSIBILITY_SEMANTICS, CoreSemantics::read); // map.put(ACCESSIBILITY_CUSTOM_ACTION, CoreSemantics::read); Loading
core/java/com/android/internal/widget/remotecompose/core/PaintContext.java +147 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,16 @@ public abstract class PaintContext { return mContext; } /** * Returns true if the needsRepaint flag is set * * @return true if the document asks to be repainted */ public boolean doesNeedsRepaint() { return mNeedsRepaint; } /** Clear the needsRepaint flag */ public void clearNeedsRepaint() { mNeedsRepaint = false; } Loading Loading @@ -65,6 +71,20 @@ public abstract class PaintContext { matrixSave(); } /** * Draw a bitmap * * @param imageId * @param srcLeft * @param srcTop * @param srcRight * @param srcBottom * @param dstLeft * @param dstTop * @param dstRight * @param dstBottom * @param cdId */ public abstract void drawBitmap( int imageId, int srcLeft, Loading @@ -77,26 +97,105 @@ public abstract class PaintContext { int dstBottom, int cdId); /** * scale the following commands * * @param scaleX horizontal scale factor * @param scaleY vertical scale factor */ public abstract void scale(float scaleX, float scaleY); /** * Rotate the following commands * * @param translateX horizontal translation * @param translateY vertical translation */ public abstract void translate(float translateX, float translateY); /** * Draw an arc * * @param left * @param top * @param right * @param bottom * @param startAngle * @param sweepAngle */ public abstract void drawArc( float left, float top, float right, float bottom, float startAngle, float sweepAngle); /** * Draw a sector * * @param left * @param top * @param right * @param bottom * @param startAngle * @param sweepAngle */ public abstract void drawSector( float left, float top, float right, float bottom, float startAngle, float sweepAngle); /** * Draw a bitmap * * @param id * @param left * @param top * @param right * @param bottom */ public abstract void drawBitmap(int id, float left, float top, float right, float bottom); /** * Draw a circle * * @param centerX * @param centerY * @param radius */ public abstract void drawCircle(float centerX, float centerY, float radius); /** * Draw a line * * @param x1 * @param y1 * @param x2 * @param y2 */ public abstract void drawLine(float x1, float y1, float x2, float y2); /** * Draw an oval * * @param left * @param top * @param right * @param bottom */ public abstract void drawOval(float left, float top, float right, float bottom); /** * Draw a path * * @param id the path id * @param start starting point of the path where we start drawing it * @param end ending point of the path where we stop drawing it */ public abstract void drawPath(int id, float start, float end); /** * Draw a rectangle * * @param left left coordinate of the rectangle * @param top top coordinate of the rectangle * @param right right coordinate of the rectangle * @param bottom bottom coordinate of the rectangle */ public abstract void drawRect(float left, float top, float right, float bottom); /** this caches the paint to a paint stack */ Loading @@ -105,9 +204,27 @@ public abstract class PaintContext { /** This restores the paint form the paint stack */ public abstract void restorePaint(); /** * draw a round rect * * @param left left coordinate of the rectangle * @param top top coordinate of the rectangle * @param right right coordinate of the rectangle * @param bottom bottom coordinate of the rectangle * @param radiusX horizontal radius of the rounded corner * @param radiusY vertical radius of the rounded corner */ public abstract void drawRoundRect( float left, float top, float right, float bottom, float radiusX, float radiusY); /** * Draw the text glyphs on the provided path * * @param textId id of the text * @param pathId id of the path * @param hOffset horizontal offset * @param vOffset vertical offset */ public abstract void drawTextOnPath(int textId, int pathId, float hOffset, float vOffset); /** Loading Loading @@ -158,6 +275,14 @@ public abstract class PaintContext { public abstract void drawTweenPath( int path1Id, int path2Id, float tween, float start, float stop); /** * Interpolate between two path and return the resulting path * * @param out the interpolated path * @param path1 start path * @param path2 end path * @param tween interpolation value from 0 (start path) to 1 (end path) */ public abstract void tweenPath(int out, int path1, int path2, float tween); /** Loading Loading @@ -275,12 +400,33 @@ public abstract class PaintContext { System.out.println("[LOG] " + content); } /** Indicates the document needs to be repainted */ public void needsRepaint() { mNeedsRepaint = true; } /** * Starts a graphics layer * * @param w * @param h */ public abstract void startGraphicsLayer(int w, int h); /** * Starts a graphics layer * * @param scaleX * @param scaleY * @param rotationX * @param rotationY * @param rotationZ * @param shadowElevation * @param transformOriginX * @param transformOriginY * @param alpha * @param renderEffectId */ public abstract void setGraphicsLayer( float scaleX, float scaleY, Loading @@ -293,6 +439,7 @@ public abstract class PaintContext { float alpha, int renderEffectId); /** Ends a graphics layer */ public abstract void endGraphicsLayer(); public boolean isVisualDebug() { Loading
core/java/com/android/internal/widget/remotecompose/core/PaintOperation.java +5 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ public abstract class PaintOperation extends Operation { return indent + toString(); } /** * Paint the operation in the context * * @param context painting context */ public abstract void paint(@NonNull PaintContext context); /** Loading