1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.internal.widget.remotecompose.core; 17 18 import com.android.internal.widget.remotecompose.core.operations.BitmapData; 19 import com.android.internal.widget.remotecompose.core.operations.ClickArea; 20 import com.android.internal.widget.remotecompose.core.operations.ClipPath; 21 import com.android.internal.widget.remotecompose.core.operations.ClipRect; 22 import com.android.internal.widget.remotecompose.core.operations.ColorExpression; 23 import com.android.internal.widget.remotecompose.core.operations.DrawArc; 24 import com.android.internal.widget.remotecompose.core.operations.DrawBitmap; 25 import com.android.internal.widget.remotecompose.core.operations.DrawBitmapInt; 26 import com.android.internal.widget.remotecompose.core.operations.DrawCircle; 27 import com.android.internal.widget.remotecompose.core.operations.DrawLine; 28 import com.android.internal.widget.remotecompose.core.operations.DrawOval; 29 import com.android.internal.widget.remotecompose.core.operations.DrawPath; 30 import com.android.internal.widget.remotecompose.core.operations.DrawRect; 31 import com.android.internal.widget.remotecompose.core.operations.DrawRoundRect; 32 import com.android.internal.widget.remotecompose.core.operations.DrawText; 33 import com.android.internal.widget.remotecompose.core.operations.DrawTextAnchored; 34 import com.android.internal.widget.remotecompose.core.operations.DrawTextOnPath; 35 import com.android.internal.widget.remotecompose.core.operations.DrawTweenPath; 36 import com.android.internal.widget.remotecompose.core.operations.FloatConstant; 37 import com.android.internal.widget.remotecompose.core.operations.FloatExpression; 38 import com.android.internal.widget.remotecompose.core.operations.Header; 39 import com.android.internal.widget.remotecompose.core.operations.MatrixRestore; 40 import com.android.internal.widget.remotecompose.core.operations.MatrixRotate; 41 import com.android.internal.widget.remotecompose.core.operations.MatrixSave; 42 import com.android.internal.widget.remotecompose.core.operations.MatrixScale; 43 import com.android.internal.widget.remotecompose.core.operations.MatrixSkew; 44 import com.android.internal.widget.remotecompose.core.operations.MatrixTranslate; 45 import com.android.internal.widget.remotecompose.core.operations.PaintData; 46 import com.android.internal.widget.remotecompose.core.operations.PathData; 47 import com.android.internal.widget.remotecompose.core.operations.RootContentBehavior; 48 import com.android.internal.widget.remotecompose.core.operations.RootContentDescription; 49 import com.android.internal.widget.remotecompose.core.operations.ShaderData; 50 import com.android.internal.widget.remotecompose.core.operations.TextData; 51 import com.android.internal.widget.remotecompose.core.operations.TextFromFloat; 52 import com.android.internal.widget.remotecompose.core.operations.TextMerge; 53 import com.android.internal.widget.remotecompose.core.operations.Theme; 54 import com.android.internal.widget.remotecompose.core.operations.utilities.IntMap; 55 56 /** 57 * List of operations supported in a RemoteCompose document 58 */ 59 public class Operations { 60 61 //////////////////////////////////////// 62 // Protocol 63 //////////////////////////////////////// 64 public static final int HEADER = 0; 65 public static final int LOAD_BITMAP = 4; 66 public static final int THEME = 63; 67 public static final int CLICK_AREA = 64; 68 public static final int ROOT_CONTENT_BEHAVIOR = 65; 69 public static final int ROOT_CONTENT_DESCRIPTION = 103; 70 71 //////////////////////////////////////// 72 // Draw commands 73 //////////////////////////////////////// 74 public static final int DRAW_BITMAP = 44; 75 public static final int DRAW_BITMAP_INT = 66; 76 public static final int DATA_BITMAP = 101; 77 public static final int DATA_SHADER = 45; 78 public static final int DATA_TEXT = 102; 79 80 /////////////////////////////===================== 81 public static final int CLIP_PATH = 38; 82 public static final int CLIP_RECT = 39; 83 public static final int PAINT_VALUES = 40; 84 public static final int DRAW_RECT = 42; 85 public static final int DRAW_TEXT_RUN = 43; 86 public static final int DRAW_CIRCLE = 46; 87 public static final int DRAW_LINE = 47; 88 public static final int DRAW_ROUND_RECT = 51; 89 public static final int DRAW_ARC = 52; 90 public static final int DRAW_TEXT_ON_PATH = 53; 91 public static final int DRAW_OVAL = 56; 92 public static final int DATA_PATH = 123; 93 public static final int DRAW_PATH = 124; 94 public static final int DRAW_TWEEN_PATH = 125; 95 public static final int MATRIX_SCALE = 126; 96 public static final int MATRIX_TRANSLATE = 127; 97 public static final int MATRIX_SKEW = 128; 98 public static final int MATRIX_ROTATE = 129; 99 public static final int MATRIX_SAVE = 130; 100 public static final int MATRIX_RESTORE = 131; 101 public static final int MATRIX_SET = 132; 102 public static final int DATA_FLOAT = 80; 103 public static final int ANIMATED_FLOAT = 81; 104 public static final int DRAW_TEXT_ANCHOR = 133; 105 public static final int COLOR_EXPRESSIONS = 134; 106 public static final int TEXT_FROM_FLOAT = 135; 107 public static final int TEXT_MERGE = 136; 108 109 /////////////////////////////////////////====================== 110 public static IntMap<CompanionOperation> map = new IntMap<>(); 111 112 static { map.put(HEADER, Header.COMPANION)113 map.put(HEADER, Header.COMPANION); map.put(DRAW_BITMAP_INT, DrawBitmapInt.COMPANION)114 map.put(DRAW_BITMAP_INT, DrawBitmapInt.COMPANION); map.put(DATA_BITMAP, BitmapData.COMPANION)115 map.put(DATA_BITMAP, BitmapData.COMPANION); map.put(DATA_TEXT, TextData.COMPANION)116 map.put(DATA_TEXT, TextData.COMPANION); map.put(THEME, Theme.COMPANION)117 map.put(THEME, Theme.COMPANION); map.put(CLICK_AREA, ClickArea.COMPANION)118 map.put(CLICK_AREA, ClickArea.COMPANION); map.put(ROOT_CONTENT_BEHAVIOR, RootContentBehavior.COMPANION)119 map.put(ROOT_CONTENT_BEHAVIOR, RootContentBehavior.COMPANION); map.put(ROOT_CONTENT_DESCRIPTION, RootContentDescription.COMPANION)120 map.put(ROOT_CONTENT_DESCRIPTION, RootContentDescription.COMPANION); 121 map.put(DRAW_ARC, DrawArc.COMPANION)122 map.put(DRAW_ARC, DrawArc.COMPANION); map.put(DRAW_BITMAP, DrawBitmap.COMPANION)123 map.put(DRAW_BITMAP, DrawBitmap.COMPANION); map.put(DRAW_CIRCLE, DrawCircle.COMPANION)124 map.put(DRAW_CIRCLE, DrawCircle.COMPANION); map.put(DRAW_LINE, DrawLine.COMPANION)125 map.put(DRAW_LINE, DrawLine.COMPANION); map.put(DRAW_OVAL, DrawOval.COMPANION)126 map.put(DRAW_OVAL, DrawOval.COMPANION); map.put(DRAW_PATH, DrawPath.COMPANION)127 map.put(DRAW_PATH, DrawPath.COMPANION); map.put(DRAW_RECT, DrawRect.COMPANION)128 map.put(DRAW_RECT, DrawRect.COMPANION); map.put(DRAW_ROUND_RECT, DrawRoundRect.COMPANION)129 map.put(DRAW_ROUND_RECT, DrawRoundRect.COMPANION); map.put(DRAW_TEXT_ON_PATH, DrawTextOnPath.COMPANION)130 map.put(DRAW_TEXT_ON_PATH, DrawTextOnPath.COMPANION); map.put(DRAW_TEXT_RUN, DrawText.COMPANION)131 map.put(DRAW_TEXT_RUN, DrawText.COMPANION); map.put(DRAW_TWEEN_PATH, DrawTweenPath.COMPANION)132 map.put(DRAW_TWEEN_PATH, DrawTweenPath.COMPANION); map.put(DATA_PATH, PathData.COMPANION)133 map.put(DATA_PATH, PathData.COMPANION); map.put(PAINT_VALUES, PaintData.COMPANION)134 map.put(PAINT_VALUES, PaintData.COMPANION); map.put(MATRIX_RESTORE, MatrixRestore.COMPANION)135 map.put(MATRIX_RESTORE, MatrixRestore.COMPANION); map.put(MATRIX_ROTATE, MatrixRotate.COMPANION)136 map.put(MATRIX_ROTATE, MatrixRotate.COMPANION); map.put(MATRIX_SAVE, MatrixSave.COMPANION)137 map.put(MATRIX_SAVE, MatrixSave.COMPANION); map.put(MATRIX_SCALE, MatrixScale.COMPANION)138 map.put(MATRIX_SCALE, MatrixScale.COMPANION); map.put(MATRIX_SKEW, MatrixSkew.COMPANION)139 map.put(MATRIX_SKEW, MatrixSkew.COMPANION); map.put(MATRIX_TRANSLATE, MatrixTranslate.COMPANION)140 map.put(MATRIX_TRANSLATE, MatrixTranslate.COMPANION); map.put(CLIP_PATH, ClipPath.COMPANION)141 map.put(CLIP_PATH, ClipPath.COMPANION); map.put(CLIP_RECT, ClipRect.COMPANION)142 map.put(CLIP_RECT, ClipRect.COMPANION); map.put(DATA_SHADER, ShaderData.COMPANION)143 map.put(DATA_SHADER, ShaderData.COMPANION); map.put(DATA_FLOAT, FloatConstant.COMPANION)144 map.put(DATA_FLOAT, FloatConstant.COMPANION); map.put(ANIMATED_FLOAT, FloatExpression.COMPANION)145 map.put(ANIMATED_FLOAT, FloatExpression.COMPANION); map.put(DRAW_TEXT_ANCHOR, DrawTextAnchored.COMPANION)146 map.put(DRAW_TEXT_ANCHOR, DrawTextAnchored.COMPANION); map.put(COLOR_EXPRESSIONS, ColorExpression.COMPANION)147 map.put(COLOR_EXPRESSIONS, ColorExpression.COMPANION); map.put(TEXT_FROM_FLOAT, TextFromFloat.COMPANION)148 map.put(TEXT_FROM_FLOAT, TextFromFloat.COMPANION); map.put(TEXT_MERGE, TextMerge.COMPANION)149 map.put(TEXT_MERGE, TextMerge.COMPANION); 150 151 } 152 153 } 154