├── JSON └── readme.md ├── proto ├── dart │ ├── svga.pb.dart │ ├── svga.pbenum.dart │ ├── svga.pbjson.dart │ └── svga.pbserver.dart ├── java │ └── com │ │ └── opensource │ │ └── svgaplayer │ │ └── proto │ │ └── Svga.java ├── js │ ├── svga.json │ └── svga_pb.js ├── oc │ ├── Svga.pbobjc.h │ └── Svga.pbobjc.m ├── svga.pb.sh ├── svga.proto ├── wire-compiler-2.2.0-jar-with-dependencies.jar └── wire220 │ └── com │ └── opensource │ └── svgaplayer │ └── proto │ ├── AudioEntity.java │ ├── FrameEntity.java │ ├── Layout.java │ ├── MovieEntity.java │ ├── MovieParams.java │ ├── ShapeEntity.java │ ├── SpriteEntity.java │ └── Transform.java └── readme.md /JSON/readme.md: -------------------------------------------------------------------------------- 1 | # SVGA-Format 2 | 3 | JSON 格式是 1.x 的描述标准,在 2.x 版本中已经使用 Protobuf 替代。 4 | 5 | ## 介绍 6 | 7 | * SVGA 是一种专有动画格式 8 | * SVGA 的类似格式是 GIF / A-PNG / WebP 9 | 10 | ## 格式规范 11 | 12 | * SVGA 文件以 .svga 作为后缀使用(该后缀不是ISO格式) 13 | * SVGA 使用 ZIP 进行压缩、打包 14 | * SVGA 解压后不允许拥有子目录 15 | * SVGA 打包前、解压后的文件名不允许包含非标准文件名字符存在(不允许中文、日文等字符) 16 | 17 | ## 图像文件 18 | 19 | * 位图文件要求格式为 PNG-8 或 PNG-24 20 | * 位图文件建议使用 pngquant 进行压缩 21 | * 位图文件以 .png 后缀命名 22 | 23 | ## 描述文件 24 | 25 | * 描述文件协议为 JSON,文件名为 movie.spec。 26 | 27 | ### JSON 结构 28 | 29 | ```js 30 | { 31 | ver: "1.1.0", // SVGA 格式版本号 32 | movie: { 33 | viewBox: { 34 | width: 300.0, 35 | height: 300.0 36 | }, // 画布大小 37 | fps: 20, // 动画每秒播放帖数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 38 | frames: 144 // 动画总帖数 39 | }, 40 | images: { 41 | Key: "Path" // Key 是位图键名,Path 是位图文件名。 42 | }, 43 | sprites: [ 44 | { 45 | imageKey: "AwesomeSprite", // 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层。 46 | matteKey: "AwesomeSprite", // 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. 47 | frames: [ 48 | { 49 | alpha: 1.0, // 元件透明度 50 | layout: { 51 | x: 0, 52 | y: 0, 53 | width: 100, 54 | height: 100 55 | }, // 元件初始约束大小 56 | transform: { 57 | a: 1.0, 58 | b: 0.0, 59 | c: 0.0, 60 | d: 1.0, 61 | tx: 0.0, 62 | ty: 0.0 63 | }, // 元件变化矩阵,3 * 3 矩阵中的具体含义,参照 CSS transform。 64 | clipPath: "", // 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 65 | shapes: [ 66 | { 67 | type: enum("shape", "rect", "ellipse", "keep"), // 矢量类型 68 | args: {}, // 矢量参数 [附1] 69 | styles: { 70 | fill: [0.0, 0.0, 0.0, 1.0], // 填充色, RGBA 71 | stroke: [0.0, 0.0, 0.0, 1.0], // 描边色, RGBA 72 | strokeWidth: 0, // 描边宽 73 | lineCap: enum("butt", "round", "square"), // 线段端点样式 74 | lineJoin: enum("miter", "round", "bevel"), // 线段连接样式 75 | miterLimit: 0, // 尖角限制 76 | lineDash: [0.0, 0.0, 0.0] // 虚线参数, dash,gap,offset 77 | }, 78 | transform: { 79 | a: 1.0, 80 | b: 0.0, 81 | c: 0.0, 82 | d: 1.0, 83 | tx: 0.0, 84 | ty: 0.0 85 | } 86 | } 87 | ] // 矢量路径,使用 SVG 标准 Path 绘制图案,如果 shapes[0].type == "KEEP" 时,则使用上一帖进行绘制。 88 | } 89 | ] // 元件在每一帖中的表现,对于某一帖中隐藏的元件,也需要使用一个对象进行占位。 90 | } 91 | ] // 元件列表,在数组中索引值越大,代表层级越高。 92 | } 93 | ``` 94 | 95 | ### 类型参考 96 | * "1.0.0" = String 97 | * 1.0 = Double 98 | * 1 = Int 99 | * true = Boolean 100 | 101 | 102 | ### 附1, 矢量参数 103 | 104 | #### shape 105 | ``` 106 | { 107 | d: "M 0 0 C 0 0 0 0 0" // SVG Path 108 | } 109 | ``` 110 | 111 | #### rect 112 | ``` 113 | { 114 | x: 0.0, // x 115 | y: 0.0, // y 116 | width: 0.0, // 宽 117 | height: 0.0, // 高 118 | cornerRadius: 0.0 // 圆角大小 119 | } 120 | ``` 121 | 122 | #### ellipse 123 | ``` 124 | { 125 | x: 0.0, // 圆中心点 X 126 | y: 0.0, // 圆中心点 Y 127 | radiusX: 0.0 // 圆半径 128 | radiusY: 0.0 // 圆半径 129 | } 130 | ``` -------------------------------------------------------------------------------- /proto/dart/svga.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: svga.proto 4 | /// 5 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name 6 | 7 | import 'dart:core' as $core show bool, Deprecated, double, int, List, Map, override, pragma, String; 8 | 9 | import 'package:protobuf/protobuf.dart' as $pb; 10 | 11 | import 'svga.pbenum.dart'; 12 | 13 | export 'svga.pbenum.dart'; 14 | 15 | class MovieParams extends $pb.GeneratedMessage { 16 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('MovieParams', package: const $pb.PackageName('com.opensource.svga')) 17 | ..a<$core.double>(1, 'viewBoxWidth', $pb.PbFieldType.OF) 18 | ..a<$core.double>(2, 'viewBoxHeight', $pb.PbFieldType.OF) 19 | ..a<$core.int>(3, 'fps', $pb.PbFieldType.O3) 20 | ..a<$core.int>(4, 'frames', $pb.PbFieldType.O3) 21 | ..hasRequiredFields = false 22 | ; 23 | 24 | MovieParams._() : super(); 25 | factory MovieParams() => create(); 26 | factory MovieParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 27 | factory MovieParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 28 | MovieParams clone() => MovieParams()..mergeFromMessage(this); 29 | MovieParams copyWith(void Function(MovieParams) updates) => super.copyWith((message) => updates(message as MovieParams)); 30 | $pb.BuilderInfo get info_ => _i; 31 | @$core.pragma('dart2js:noInline') 32 | static MovieParams create() => MovieParams._(); 33 | MovieParams createEmptyInstance() => create(); 34 | static $pb.PbList createRepeated() => $pb.PbList(); 35 | static MovieParams getDefault() => _defaultInstance ??= create()..freeze(); 36 | static MovieParams _defaultInstance; 37 | 38 | $core.double get viewBoxWidth => $_getN(0); 39 | set viewBoxWidth($core.double v) { $_setFloat(0, v); } 40 | $core.bool hasViewBoxWidth() => $_has(0); 41 | void clearViewBoxWidth() => clearField(1); 42 | 43 | $core.double get viewBoxHeight => $_getN(1); 44 | set viewBoxHeight($core.double v) { $_setFloat(1, v); } 45 | $core.bool hasViewBoxHeight() => $_has(1); 46 | void clearViewBoxHeight() => clearField(2); 47 | 48 | $core.int get fps => $_get(2, 0); 49 | set fps($core.int v) { $_setSignedInt32(2, v); } 50 | $core.bool hasFps() => $_has(2); 51 | void clearFps() => clearField(3); 52 | 53 | $core.int get frames => $_get(3, 0); 54 | set frames($core.int v) { $_setSignedInt32(3, v); } 55 | $core.bool hasFrames() => $_has(3); 56 | void clearFrames() => clearField(4); 57 | } 58 | 59 | class SpriteEntity extends $pb.GeneratedMessage { 60 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('SpriteEntity', package: const $pb.PackageName('com.opensource.svga')) 61 | ..aOS(1, 'imageKey') 62 | ..pc(2, 'frames', $pb.PbFieldType.PM,FrameEntity.create) 63 | ..aOS(3, 'matteKey') 64 | ..hasRequiredFields = false 65 | ; 66 | 67 | SpriteEntity._() : super(); 68 | factory SpriteEntity() => create(); 69 | factory SpriteEntity.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 70 | factory SpriteEntity.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 71 | SpriteEntity clone() => SpriteEntity()..mergeFromMessage(this); 72 | SpriteEntity copyWith(void Function(SpriteEntity) updates) => super.copyWith((message) => updates(message as SpriteEntity)); 73 | $pb.BuilderInfo get info_ => _i; 74 | @$core.pragma('dart2js:noInline') 75 | static SpriteEntity create() => SpriteEntity._(); 76 | SpriteEntity createEmptyInstance() => create(); 77 | static $pb.PbList createRepeated() => $pb.PbList(); 78 | static SpriteEntity getDefault() => _defaultInstance ??= create()..freeze(); 79 | static SpriteEntity _defaultInstance; 80 | 81 | $core.String get imageKey => $_getS(0, ''); 82 | set imageKey($core.String v) { $_setString(0, v); } 83 | $core.bool hasImageKey() => $_has(0); 84 | void clearImageKey() => clearField(1); 85 | 86 | $core.List get frames => $_getList(1); 87 | 88 | $core.String get matteKey => $_getS(2, ''); 89 | set matteKey($core.String v) { $_setString(2, v); } 90 | $core.bool hasMatteKey() => $_has(2); 91 | void clearMatteKey() => clearField(3); 92 | } 93 | 94 | class AudioEntity extends $pb.GeneratedMessage { 95 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('AudioEntity', package: const $pb.PackageName('com.opensource.svga')) 96 | ..aOS(1, 'audioKey') 97 | ..a<$core.int>(2, 'startFrame', $pb.PbFieldType.O3) 98 | ..a<$core.int>(3, 'endFrame', $pb.PbFieldType.O3) 99 | ..a<$core.int>(4, 'startTime', $pb.PbFieldType.O3) 100 | ..a<$core.int>(5, 'totalTime', $pb.PbFieldType.O3) 101 | ..hasRequiredFields = false 102 | ; 103 | 104 | AudioEntity._() : super(); 105 | factory AudioEntity() => create(); 106 | factory AudioEntity.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 107 | factory AudioEntity.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 108 | AudioEntity clone() => AudioEntity()..mergeFromMessage(this); 109 | AudioEntity copyWith(void Function(AudioEntity) updates) => super.copyWith((message) => updates(message as AudioEntity)); 110 | $pb.BuilderInfo get info_ => _i; 111 | @$core.pragma('dart2js:noInline') 112 | static AudioEntity create() => AudioEntity._(); 113 | AudioEntity createEmptyInstance() => create(); 114 | static $pb.PbList createRepeated() => $pb.PbList(); 115 | static AudioEntity getDefault() => _defaultInstance ??= create()..freeze(); 116 | static AudioEntity _defaultInstance; 117 | 118 | $core.String get audioKey => $_getS(0, ''); 119 | set audioKey($core.String v) { $_setString(0, v); } 120 | $core.bool hasAudioKey() => $_has(0); 121 | void clearAudioKey() => clearField(1); 122 | 123 | $core.int get startFrame => $_get(1, 0); 124 | set startFrame($core.int v) { $_setSignedInt32(1, v); } 125 | $core.bool hasStartFrame() => $_has(1); 126 | void clearStartFrame() => clearField(2); 127 | 128 | $core.int get endFrame => $_get(2, 0); 129 | set endFrame($core.int v) { $_setSignedInt32(2, v); } 130 | $core.bool hasEndFrame() => $_has(2); 131 | void clearEndFrame() => clearField(3); 132 | 133 | $core.int get startTime => $_get(3, 0); 134 | set startTime($core.int v) { $_setSignedInt32(3, v); } 135 | $core.bool hasStartTime() => $_has(3); 136 | void clearStartTime() => clearField(4); 137 | 138 | $core.int get totalTime => $_get(4, 0); 139 | set totalTime($core.int v) { $_setSignedInt32(4, v); } 140 | $core.bool hasTotalTime() => $_has(4); 141 | void clearTotalTime() => clearField(5); 142 | } 143 | 144 | class Layout extends $pb.GeneratedMessage { 145 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('Layout', package: const $pb.PackageName('com.opensource.svga')) 146 | ..a<$core.double>(1, 'x', $pb.PbFieldType.OF) 147 | ..a<$core.double>(2, 'y', $pb.PbFieldType.OF) 148 | ..a<$core.double>(3, 'width', $pb.PbFieldType.OF) 149 | ..a<$core.double>(4, 'height', $pb.PbFieldType.OF) 150 | ..hasRequiredFields = false 151 | ; 152 | 153 | Layout._() : super(); 154 | factory Layout() => create(); 155 | factory Layout.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 156 | factory Layout.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 157 | Layout clone() => Layout()..mergeFromMessage(this); 158 | Layout copyWith(void Function(Layout) updates) => super.copyWith((message) => updates(message as Layout)); 159 | $pb.BuilderInfo get info_ => _i; 160 | @$core.pragma('dart2js:noInline') 161 | static Layout create() => Layout._(); 162 | Layout createEmptyInstance() => create(); 163 | static $pb.PbList createRepeated() => $pb.PbList(); 164 | static Layout getDefault() => _defaultInstance ??= create()..freeze(); 165 | static Layout _defaultInstance; 166 | 167 | $core.double get x => $_getN(0); 168 | set x($core.double v) { $_setFloat(0, v); } 169 | $core.bool hasX() => $_has(0); 170 | void clearX() => clearField(1); 171 | 172 | $core.double get y => $_getN(1); 173 | set y($core.double v) { $_setFloat(1, v); } 174 | $core.bool hasY() => $_has(1); 175 | void clearY() => clearField(2); 176 | 177 | $core.double get width => $_getN(2); 178 | set width($core.double v) { $_setFloat(2, v); } 179 | $core.bool hasWidth() => $_has(2); 180 | void clearWidth() => clearField(3); 181 | 182 | $core.double get height => $_getN(3); 183 | set height($core.double v) { $_setFloat(3, v); } 184 | $core.bool hasHeight() => $_has(3); 185 | void clearHeight() => clearField(4); 186 | } 187 | 188 | class Transform extends $pb.GeneratedMessage { 189 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('Transform', package: const $pb.PackageName('com.opensource.svga')) 190 | ..a<$core.double>(1, 'a', $pb.PbFieldType.OF) 191 | ..a<$core.double>(2, 'b', $pb.PbFieldType.OF) 192 | ..a<$core.double>(3, 'c', $pb.PbFieldType.OF) 193 | ..a<$core.double>(4, 'd', $pb.PbFieldType.OF) 194 | ..a<$core.double>(5, 'tx', $pb.PbFieldType.OF) 195 | ..a<$core.double>(6, 'ty', $pb.PbFieldType.OF) 196 | ..hasRequiredFields = false 197 | ; 198 | 199 | Transform._() : super(); 200 | factory Transform() => create(); 201 | factory Transform.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 202 | factory Transform.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 203 | Transform clone() => Transform()..mergeFromMessage(this); 204 | Transform copyWith(void Function(Transform) updates) => super.copyWith((message) => updates(message as Transform)); 205 | $pb.BuilderInfo get info_ => _i; 206 | @$core.pragma('dart2js:noInline') 207 | static Transform create() => Transform._(); 208 | Transform createEmptyInstance() => create(); 209 | static $pb.PbList createRepeated() => $pb.PbList(); 210 | static Transform getDefault() => _defaultInstance ??= create()..freeze(); 211 | static Transform _defaultInstance; 212 | 213 | $core.double get a => $_getN(0); 214 | set a($core.double v) { $_setFloat(0, v); } 215 | $core.bool hasA() => $_has(0); 216 | void clearA() => clearField(1); 217 | 218 | $core.double get b => $_getN(1); 219 | set b($core.double v) { $_setFloat(1, v); } 220 | $core.bool hasB() => $_has(1); 221 | void clearB() => clearField(2); 222 | 223 | $core.double get c => $_getN(2); 224 | set c($core.double v) { $_setFloat(2, v); } 225 | $core.bool hasC() => $_has(2); 226 | void clearC() => clearField(3); 227 | 228 | $core.double get d => $_getN(3); 229 | set d($core.double v) { $_setFloat(3, v); } 230 | $core.bool hasD() => $_has(3); 231 | void clearD() => clearField(4); 232 | 233 | $core.double get tx => $_getN(4); 234 | set tx($core.double v) { $_setFloat(4, v); } 235 | $core.bool hasTx() => $_has(4); 236 | void clearTx() => clearField(5); 237 | 238 | $core.double get ty => $_getN(5); 239 | set ty($core.double v) { $_setFloat(5, v); } 240 | $core.bool hasTy() => $_has(5); 241 | void clearTy() => clearField(6); 242 | } 243 | 244 | class ShapeEntity_ShapeArgs extends $pb.GeneratedMessage { 245 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity.ShapeArgs', package: const $pb.PackageName('com.opensource.svga')) 246 | ..aOS(1, 'd') 247 | ..hasRequiredFields = false 248 | ; 249 | 250 | ShapeEntity_ShapeArgs._() : super(); 251 | factory ShapeEntity_ShapeArgs() => create(); 252 | factory ShapeEntity_ShapeArgs.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 253 | factory ShapeEntity_ShapeArgs.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 254 | ShapeEntity_ShapeArgs clone() => ShapeEntity_ShapeArgs()..mergeFromMessage(this); 255 | ShapeEntity_ShapeArgs copyWith(void Function(ShapeEntity_ShapeArgs) updates) => super.copyWith((message) => updates(message as ShapeEntity_ShapeArgs)); 256 | $pb.BuilderInfo get info_ => _i; 257 | @$core.pragma('dart2js:noInline') 258 | static ShapeEntity_ShapeArgs create() => ShapeEntity_ShapeArgs._(); 259 | ShapeEntity_ShapeArgs createEmptyInstance() => create(); 260 | static $pb.PbList createRepeated() => $pb.PbList(); 261 | static ShapeEntity_ShapeArgs getDefault() => _defaultInstance ??= create()..freeze(); 262 | static ShapeEntity_ShapeArgs _defaultInstance; 263 | 264 | $core.String get d => $_getS(0, ''); 265 | set d($core.String v) { $_setString(0, v); } 266 | $core.bool hasD() => $_has(0); 267 | void clearD() => clearField(1); 268 | } 269 | 270 | class ShapeEntity_RectArgs extends $pb.GeneratedMessage { 271 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity.RectArgs', package: const $pb.PackageName('com.opensource.svga')) 272 | ..a<$core.double>(1, 'x', $pb.PbFieldType.OF) 273 | ..a<$core.double>(2, 'y', $pb.PbFieldType.OF) 274 | ..a<$core.double>(3, 'width', $pb.PbFieldType.OF) 275 | ..a<$core.double>(4, 'height', $pb.PbFieldType.OF) 276 | ..a<$core.double>(5, 'cornerRadius', $pb.PbFieldType.OF) 277 | ..hasRequiredFields = false 278 | ; 279 | 280 | ShapeEntity_RectArgs._() : super(); 281 | factory ShapeEntity_RectArgs() => create(); 282 | factory ShapeEntity_RectArgs.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 283 | factory ShapeEntity_RectArgs.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 284 | ShapeEntity_RectArgs clone() => ShapeEntity_RectArgs()..mergeFromMessage(this); 285 | ShapeEntity_RectArgs copyWith(void Function(ShapeEntity_RectArgs) updates) => super.copyWith((message) => updates(message as ShapeEntity_RectArgs)); 286 | $pb.BuilderInfo get info_ => _i; 287 | @$core.pragma('dart2js:noInline') 288 | static ShapeEntity_RectArgs create() => ShapeEntity_RectArgs._(); 289 | ShapeEntity_RectArgs createEmptyInstance() => create(); 290 | static $pb.PbList createRepeated() => $pb.PbList(); 291 | static ShapeEntity_RectArgs getDefault() => _defaultInstance ??= create()..freeze(); 292 | static ShapeEntity_RectArgs _defaultInstance; 293 | 294 | $core.double get x => $_getN(0); 295 | set x($core.double v) { $_setFloat(0, v); } 296 | $core.bool hasX() => $_has(0); 297 | void clearX() => clearField(1); 298 | 299 | $core.double get y => $_getN(1); 300 | set y($core.double v) { $_setFloat(1, v); } 301 | $core.bool hasY() => $_has(1); 302 | void clearY() => clearField(2); 303 | 304 | $core.double get width => $_getN(2); 305 | set width($core.double v) { $_setFloat(2, v); } 306 | $core.bool hasWidth() => $_has(2); 307 | void clearWidth() => clearField(3); 308 | 309 | $core.double get height => $_getN(3); 310 | set height($core.double v) { $_setFloat(3, v); } 311 | $core.bool hasHeight() => $_has(3); 312 | void clearHeight() => clearField(4); 313 | 314 | $core.double get cornerRadius => $_getN(4); 315 | set cornerRadius($core.double v) { $_setFloat(4, v); } 316 | $core.bool hasCornerRadius() => $_has(4); 317 | void clearCornerRadius() => clearField(5); 318 | } 319 | 320 | class ShapeEntity_EllipseArgs extends $pb.GeneratedMessage { 321 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity.EllipseArgs', package: const $pb.PackageName('com.opensource.svga')) 322 | ..a<$core.double>(1, 'x', $pb.PbFieldType.OF) 323 | ..a<$core.double>(2, 'y', $pb.PbFieldType.OF) 324 | ..a<$core.double>(3, 'radiusX', $pb.PbFieldType.OF) 325 | ..a<$core.double>(4, 'radiusY', $pb.PbFieldType.OF) 326 | ..hasRequiredFields = false 327 | ; 328 | 329 | ShapeEntity_EllipseArgs._() : super(); 330 | factory ShapeEntity_EllipseArgs() => create(); 331 | factory ShapeEntity_EllipseArgs.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 332 | factory ShapeEntity_EllipseArgs.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 333 | ShapeEntity_EllipseArgs clone() => ShapeEntity_EllipseArgs()..mergeFromMessage(this); 334 | ShapeEntity_EllipseArgs copyWith(void Function(ShapeEntity_EllipseArgs) updates) => super.copyWith((message) => updates(message as ShapeEntity_EllipseArgs)); 335 | $pb.BuilderInfo get info_ => _i; 336 | @$core.pragma('dart2js:noInline') 337 | static ShapeEntity_EllipseArgs create() => ShapeEntity_EllipseArgs._(); 338 | ShapeEntity_EllipseArgs createEmptyInstance() => create(); 339 | static $pb.PbList createRepeated() => $pb.PbList(); 340 | static ShapeEntity_EllipseArgs getDefault() => _defaultInstance ??= create()..freeze(); 341 | static ShapeEntity_EllipseArgs _defaultInstance; 342 | 343 | $core.double get x => $_getN(0); 344 | set x($core.double v) { $_setFloat(0, v); } 345 | $core.bool hasX() => $_has(0); 346 | void clearX() => clearField(1); 347 | 348 | $core.double get y => $_getN(1); 349 | set y($core.double v) { $_setFloat(1, v); } 350 | $core.bool hasY() => $_has(1); 351 | void clearY() => clearField(2); 352 | 353 | $core.double get radiusX => $_getN(2); 354 | set radiusX($core.double v) { $_setFloat(2, v); } 355 | $core.bool hasRadiusX() => $_has(2); 356 | void clearRadiusX() => clearField(3); 357 | 358 | $core.double get radiusY => $_getN(3); 359 | set radiusY($core.double v) { $_setFloat(3, v); } 360 | $core.bool hasRadiusY() => $_has(3); 361 | void clearRadiusY() => clearField(4); 362 | } 363 | 364 | class ShapeEntity_ShapeStyle_RGBAColor extends $pb.GeneratedMessage { 365 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity.ShapeStyle.RGBAColor', package: const $pb.PackageName('com.opensource.svga')) 366 | ..a<$core.double>(1, 'r', $pb.PbFieldType.OF) 367 | ..a<$core.double>(2, 'g', $pb.PbFieldType.OF) 368 | ..a<$core.double>(3, 'b', $pb.PbFieldType.OF) 369 | ..a<$core.double>(4, 'a', $pb.PbFieldType.OF) 370 | ..hasRequiredFields = false 371 | ; 372 | 373 | ShapeEntity_ShapeStyle_RGBAColor._() : super(); 374 | factory ShapeEntity_ShapeStyle_RGBAColor() => create(); 375 | factory ShapeEntity_ShapeStyle_RGBAColor.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 376 | factory ShapeEntity_ShapeStyle_RGBAColor.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 377 | ShapeEntity_ShapeStyle_RGBAColor clone() => ShapeEntity_ShapeStyle_RGBAColor()..mergeFromMessage(this); 378 | ShapeEntity_ShapeStyle_RGBAColor copyWith(void Function(ShapeEntity_ShapeStyle_RGBAColor) updates) => super.copyWith((message) => updates(message as ShapeEntity_ShapeStyle_RGBAColor)); 379 | $pb.BuilderInfo get info_ => _i; 380 | @$core.pragma('dart2js:noInline') 381 | static ShapeEntity_ShapeStyle_RGBAColor create() => ShapeEntity_ShapeStyle_RGBAColor._(); 382 | ShapeEntity_ShapeStyle_RGBAColor createEmptyInstance() => create(); 383 | static $pb.PbList createRepeated() => $pb.PbList(); 384 | static ShapeEntity_ShapeStyle_RGBAColor getDefault() => _defaultInstance ??= create()..freeze(); 385 | static ShapeEntity_ShapeStyle_RGBAColor _defaultInstance; 386 | 387 | $core.double get r => $_getN(0); 388 | set r($core.double v) { $_setFloat(0, v); } 389 | $core.bool hasR() => $_has(0); 390 | void clearR() => clearField(1); 391 | 392 | $core.double get g => $_getN(1); 393 | set g($core.double v) { $_setFloat(1, v); } 394 | $core.bool hasG() => $_has(1); 395 | void clearG() => clearField(2); 396 | 397 | $core.double get b => $_getN(2); 398 | set b($core.double v) { $_setFloat(2, v); } 399 | $core.bool hasB() => $_has(2); 400 | void clearB() => clearField(3); 401 | 402 | $core.double get a => $_getN(3); 403 | set a($core.double v) { $_setFloat(3, v); } 404 | $core.bool hasA() => $_has(3); 405 | void clearA() => clearField(4); 406 | } 407 | 408 | class ShapeEntity_ShapeStyle extends $pb.GeneratedMessage { 409 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity.ShapeStyle', package: const $pb.PackageName('com.opensource.svga')) 410 | ..a(1, 'fill', $pb.PbFieldType.OM, ShapeEntity_ShapeStyle_RGBAColor.getDefault, ShapeEntity_ShapeStyle_RGBAColor.create) 411 | ..a(2, 'stroke', $pb.PbFieldType.OM, ShapeEntity_ShapeStyle_RGBAColor.getDefault, ShapeEntity_ShapeStyle_RGBAColor.create) 412 | ..a<$core.double>(3, 'strokeWidth', $pb.PbFieldType.OF) 413 | ..e(4, 'lineCap', $pb.PbFieldType.OE, ShapeEntity_ShapeStyle_LineCap.LineCap_BUTT, ShapeEntity_ShapeStyle_LineCap.valueOf, ShapeEntity_ShapeStyle_LineCap.values) 414 | ..e(5, 'lineJoin', $pb.PbFieldType.OE, ShapeEntity_ShapeStyle_LineJoin.LineJoin_MITER, ShapeEntity_ShapeStyle_LineJoin.valueOf, ShapeEntity_ShapeStyle_LineJoin.values) 415 | ..a<$core.double>(6, 'miterLimit', $pb.PbFieldType.OF) 416 | ..a<$core.double>(7, 'lineDashI', $pb.PbFieldType.OF) 417 | ..a<$core.double>(8, 'lineDashII', $pb.PbFieldType.OF) 418 | ..a<$core.double>(9, 'lineDashIII', $pb.PbFieldType.OF) 419 | ..hasRequiredFields = false 420 | ; 421 | 422 | ShapeEntity_ShapeStyle._() : super(); 423 | factory ShapeEntity_ShapeStyle() => create(); 424 | factory ShapeEntity_ShapeStyle.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 425 | factory ShapeEntity_ShapeStyle.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 426 | ShapeEntity_ShapeStyle clone() => ShapeEntity_ShapeStyle()..mergeFromMessage(this); 427 | ShapeEntity_ShapeStyle copyWith(void Function(ShapeEntity_ShapeStyle) updates) => super.copyWith((message) => updates(message as ShapeEntity_ShapeStyle)); 428 | $pb.BuilderInfo get info_ => _i; 429 | @$core.pragma('dart2js:noInline') 430 | static ShapeEntity_ShapeStyle create() => ShapeEntity_ShapeStyle._(); 431 | ShapeEntity_ShapeStyle createEmptyInstance() => create(); 432 | static $pb.PbList createRepeated() => $pb.PbList(); 433 | static ShapeEntity_ShapeStyle getDefault() => _defaultInstance ??= create()..freeze(); 434 | static ShapeEntity_ShapeStyle _defaultInstance; 435 | 436 | ShapeEntity_ShapeStyle_RGBAColor get fill => $_getN(0); 437 | set fill(ShapeEntity_ShapeStyle_RGBAColor v) { setField(1, v); } 438 | $core.bool hasFill() => $_has(0); 439 | void clearFill() => clearField(1); 440 | 441 | ShapeEntity_ShapeStyle_RGBAColor get stroke => $_getN(1); 442 | set stroke(ShapeEntity_ShapeStyle_RGBAColor v) { setField(2, v); } 443 | $core.bool hasStroke() => $_has(1); 444 | void clearStroke() => clearField(2); 445 | 446 | $core.double get strokeWidth => $_getN(2); 447 | set strokeWidth($core.double v) { $_setFloat(2, v); } 448 | $core.bool hasStrokeWidth() => $_has(2); 449 | void clearStrokeWidth() => clearField(3); 450 | 451 | ShapeEntity_ShapeStyle_LineCap get lineCap => $_getN(3); 452 | set lineCap(ShapeEntity_ShapeStyle_LineCap v) { setField(4, v); } 453 | $core.bool hasLineCap() => $_has(3); 454 | void clearLineCap() => clearField(4); 455 | 456 | ShapeEntity_ShapeStyle_LineJoin get lineJoin => $_getN(4); 457 | set lineJoin(ShapeEntity_ShapeStyle_LineJoin v) { setField(5, v); } 458 | $core.bool hasLineJoin() => $_has(4); 459 | void clearLineJoin() => clearField(5); 460 | 461 | $core.double get miterLimit => $_getN(5); 462 | set miterLimit($core.double v) { $_setFloat(5, v); } 463 | $core.bool hasMiterLimit() => $_has(5); 464 | void clearMiterLimit() => clearField(6); 465 | 466 | $core.double get lineDashI => $_getN(6); 467 | set lineDashI($core.double v) { $_setFloat(6, v); } 468 | $core.bool hasLineDashI() => $_has(6); 469 | void clearLineDashI() => clearField(7); 470 | 471 | $core.double get lineDashII => $_getN(7); 472 | set lineDashII($core.double v) { $_setFloat(7, v); } 473 | $core.bool hasLineDashII() => $_has(7); 474 | void clearLineDashII() => clearField(8); 475 | 476 | $core.double get lineDashIII => $_getN(8); 477 | set lineDashIII($core.double v) { $_setFloat(8, v); } 478 | $core.bool hasLineDashIII() => $_has(8); 479 | void clearLineDashIII() => clearField(9); 480 | } 481 | 482 | enum ShapeEntity_Args { 483 | shape, 484 | rect, 485 | ellipse, 486 | notSet 487 | } 488 | 489 | class ShapeEntity extends $pb.GeneratedMessage { 490 | static const $core.Map<$core.int, ShapeEntity_Args> _ShapeEntity_ArgsByTag = { 491 | 2 : ShapeEntity_Args.shape, 492 | 3 : ShapeEntity_Args.rect, 493 | 4 : ShapeEntity_Args.ellipse, 494 | 0 : ShapeEntity_Args.notSet 495 | }; 496 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ShapeEntity', package: const $pb.PackageName('com.opensource.svga')) 497 | ..oo(0, [2, 3, 4]) 498 | ..e(1, 'type', $pb.PbFieldType.OE, ShapeEntity_ShapeType.SHAPE, ShapeEntity_ShapeType.valueOf, ShapeEntity_ShapeType.values) 499 | ..a(2, 'shape', $pb.PbFieldType.OM, ShapeEntity_ShapeArgs.getDefault, ShapeEntity_ShapeArgs.create) 500 | ..a(3, 'rect', $pb.PbFieldType.OM, ShapeEntity_RectArgs.getDefault, ShapeEntity_RectArgs.create) 501 | ..a(4, 'ellipse', $pb.PbFieldType.OM, ShapeEntity_EllipseArgs.getDefault, ShapeEntity_EllipseArgs.create) 502 | ..a(10, 'styles', $pb.PbFieldType.OM, ShapeEntity_ShapeStyle.getDefault, ShapeEntity_ShapeStyle.create) 503 | ..a(11, 'transform', $pb.PbFieldType.OM, Transform.getDefault, Transform.create) 504 | ..hasRequiredFields = false 505 | ; 506 | 507 | ShapeEntity._() : super(); 508 | factory ShapeEntity() => create(); 509 | factory ShapeEntity.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 510 | factory ShapeEntity.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 511 | ShapeEntity clone() => ShapeEntity()..mergeFromMessage(this); 512 | ShapeEntity copyWith(void Function(ShapeEntity) updates) => super.copyWith((message) => updates(message as ShapeEntity)); 513 | $pb.BuilderInfo get info_ => _i; 514 | @$core.pragma('dart2js:noInline') 515 | static ShapeEntity create() => ShapeEntity._(); 516 | ShapeEntity createEmptyInstance() => create(); 517 | static $pb.PbList createRepeated() => $pb.PbList(); 518 | static ShapeEntity getDefault() => _defaultInstance ??= create()..freeze(); 519 | static ShapeEntity _defaultInstance; 520 | 521 | ShapeEntity_Args whichArgs() => _ShapeEntity_ArgsByTag[$_whichOneof(0)]; 522 | void clearArgs() => clearField($_whichOneof(0)); 523 | 524 | ShapeEntity_ShapeType get type => $_getN(0); 525 | set type(ShapeEntity_ShapeType v) { setField(1, v); } 526 | $core.bool hasType() => $_has(0); 527 | void clearType() => clearField(1); 528 | 529 | ShapeEntity_ShapeArgs get shape => $_getN(1); 530 | set shape(ShapeEntity_ShapeArgs v) { setField(2, v); } 531 | $core.bool hasShape() => $_has(1); 532 | void clearShape() => clearField(2); 533 | 534 | ShapeEntity_RectArgs get rect => $_getN(2); 535 | set rect(ShapeEntity_RectArgs v) { setField(3, v); } 536 | $core.bool hasRect() => $_has(2); 537 | void clearRect() => clearField(3); 538 | 539 | ShapeEntity_EllipseArgs get ellipse => $_getN(3); 540 | set ellipse(ShapeEntity_EllipseArgs v) { setField(4, v); } 541 | $core.bool hasEllipse() => $_has(3); 542 | void clearEllipse() => clearField(4); 543 | 544 | ShapeEntity_ShapeStyle get styles => $_getN(4); 545 | set styles(ShapeEntity_ShapeStyle v) { setField(10, v); } 546 | $core.bool hasStyles() => $_has(4); 547 | void clearStyles() => clearField(10); 548 | 549 | Transform get transform => $_getN(5); 550 | set transform(Transform v) { setField(11, v); } 551 | $core.bool hasTransform() => $_has(5); 552 | void clearTransform() => clearField(11); 553 | } 554 | 555 | class FrameEntity extends $pb.GeneratedMessage { 556 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('FrameEntity', package: const $pb.PackageName('com.opensource.svga')) 557 | ..a<$core.double>(1, 'alpha', $pb.PbFieldType.OF) 558 | ..a(2, 'layout', $pb.PbFieldType.OM, Layout.getDefault, Layout.create) 559 | ..a(3, 'transform', $pb.PbFieldType.OM, Transform.getDefault, Transform.create) 560 | ..aOS(4, 'clipPath') 561 | ..pc(5, 'shapes', $pb.PbFieldType.PM,ShapeEntity.create) 562 | ..hasRequiredFields = false 563 | ; 564 | 565 | FrameEntity._() : super(); 566 | factory FrameEntity() => create(); 567 | factory FrameEntity.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 568 | factory FrameEntity.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 569 | FrameEntity clone() => FrameEntity()..mergeFromMessage(this); 570 | FrameEntity copyWith(void Function(FrameEntity) updates) => super.copyWith((message) => updates(message as FrameEntity)); 571 | $pb.BuilderInfo get info_ => _i; 572 | @$core.pragma('dart2js:noInline') 573 | static FrameEntity create() => FrameEntity._(); 574 | FrameEntity createEmptyInstance() => create(); 575 | static $pb.PbList createRepeated() => $pb.PbList(); 576 | static FrameEntity getDefault() => _defaultInstance ??= create()..freeze(); 577 | static FrameEntity _defaultInstance; 578 | 579 | $core.double get alpha => $_getN(0); 580 | set alpha($core.double v) { $_setFloat(0, v); } 581 | $core.bool hasAlpha() => $_has(0); 582 | void clearAlpha() => clearField(1); 583 | 584 | Layout get layout => $_getN(1); 585 | set layout(Layout v) { setField(2, v); } 586 | $core.bool hasLayout() => $_has(1); 587 | void clearLayout() => clearField(2); 588 | 589 | Transform get transform => $_getN(2); 590 | set transform(Transform v) { setField(3, v); } 591 | $core.bool hasTransform() => $_has(2); 592 | void clearTransform() => clearField(3); 593 | 594 | $core.String get clipPath => $_getS(3, ''); 595 | set clipPath($core.String v) { $_setString(3, v); } 596 | $core.bool hasClipPath() => $_has(3); 597 | void clearClipPath() => clearField(4); 598 | 599 | $core.List get shapes => $_getList(4); 600 | } 601 | 602 | class MovieEntity extends $pb.GeneratedMessage { 603 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('MovieEntity', package: const $pb.PackageName('com.opensource.svga')) 604 | ..aOS(1, 'version') 605 | ..a(2, 'params', $pb.PbFieldType.OM, MovieParams.getDefault, MovieParams.create) 606 | ..m<$core.String, $core.List<$core.int>>(3, 'images', 'MovieEntity.ImagesEntry',$pb.PbFieldType.OS, $pb.PbFieldType.OY, null, null, null , const $pb.PackageName('com.opensource.svga')) 607 | ..pc(4, 'sprites', $pb.PbFieldType.PM,SpriteEntity.create) 608 | ..pc(5, 'audios', $pb.PbFieldType.PM,AudioEntity.create) 609 | ..hasRequiredFields = false 610 | ; 611 | 612 | MovieEntity._() : super(); 613 | factory MovieEntity() => create(); 614 | factory MovieEntity.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 615 | factory MovieEntity.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 616 | MovieEntity clone() => MovieEntity()..mergeFromMessage(this); 617 | MovieEntity copyWith(void Function(MovieEntity) updates) => super.copyWith((message) => updates(message as MovieEntity)); 618 | $pb.BuilderInfo get info_ => _i; 619 | @$core.pragma('dart2js:noInline') 620 | static MovieEntity create() => MovieEntity._(); 621 | MovieEntity createEmptyInstance() => create(); 622 | static $pb.PbList createRepeated() => $pb.PbList(); 623 | static MovieEntity getDefault() => _defaultInstance ??= create()..freeze(); 624 | static MovieEntity _defaultInstance; 625 | 626 | $core.String get version => $_getS(0, ''); 627 | set version($core.String v) { $_setString(0, v); } 628 | $core.bool hasVersion() => $_has(0); 629 | void clearVersion() => clearField(1); 630 | 631 | MovieParams get params => $_getN(1); 632 | set params(MovieParams v) { setField(2, v); } 633 | $core.bool hasParams() => $_has(1); 634 | void clearParams() => clearField(2); 635 | 636 | $core.Map<$core.String, $core.List<$core.int>> get images => $_getMap(2); 637 | 638 | $core.List get sprites => $_getList(3); 639 | 640 | $core.List get audios => $_getList(4); 641 | } 642 | 643 | -------------------------------------------------------------------------------- /proto/dart/svga.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: svga.proto 4 | /// 5 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name 6 | 7 | // ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME 8 | import 'dart:core' as $core show int, dynamic, String, List, Map; 9 | import 'package:protobuf/protobuf.dart' as $pb; 10 | 11 | class ShapeEntity_ShapeType extends $pb.ProtobufEnum { 12 | static const ShapeEntity_ShapeType SHAPE = ShapeEntity_ShapeType._(0, 'SHAPE'); 13 | static const ShapeEntity_ShapeType RECT = ShapeEntity_ShapeType._(1, 'RECT'); 14 | static const ShapeEntity_ShapeType ELLIPSE = ShapeEntity_ShapeType._(2, 'ELLIPSE'); 15 | static const ShapeEntity_ShapeType KEEP = ShapeEntity_ShapeType._(3, 'KEEP'); 16 | 17 | static const $core.List values = [ 18 | SHAPE, 19 | RECT, 20 | ELLIPSE, 21 | KEEP, 22 | ]; 23 | 24 | static final $core.Map<$core.int, ShapeEntity_ShapeType> _byValue = $pb.ProtobufEnum.initByValue(values); 25 | static ShapeEntity_ShapeType valueOf($core.int value) => _byValue[value]; 26 | 27 | const ShapeEntity_ShapeType._($core.int v, $core.String n) : super(v, n); 28 | } 29 | 30 | class ShapeEntity_ShapeStyle_LineCap extends $pb.ProtobufEnum { 31 | static const ShapeEntity_ShapeStyle_LineCap LineCap_BUTT = ShapeEntity_ShapeStyle_LineCap._(0, 'LineCap_BUTT'); 32 | static const ShapeEntity_ShapeStyle_LineCap LineCap_ROUND = ShapeEntity_ShapeStyle_LineCap._(1, 'LineCap_ROUND'); 33 | static const ShapeEntity_ShapeStyle_LineCap LineCap_SQUARE = ShapeEntity_ShapeStyle_LineCap._(2, 'LineCap_SQUARE'); 34 | 35 | static const $core.List values = [ 36 | LineCap_BUTT, 37 | LineCap_ROUND, 38 | LineCap_SQUARE, 39 | ]; 40 | 41 | static final $core.Map<$core.int, ShapeEntity_ShapeStyle_LineCap> _byValue = $pb.ProtobufEnum.initByValue(values); 42 | static ShapeEntity_ShapeStyle_LineCap valueOf($core.int value) => _byValue[value]; 43 | 44 | const ShapeEntity_ShapeStyle_LineCap._($core.int v, $core.String n) : super(v, n); 45 | } 46 | 47 | class ShapeEntity_ShapeStyle_LineJoin extends $pb.ProtobufEnum { 48 | static const ShapeEntity_ShapeStyle_LineJoin LineJoin_MITER = ShapeEntity_ShapeStyle_LineJoin._(0, 'LineJoin_MITER'); 49 | static const ShapeEntity_ShapeStyle_LineJoin LineJoin_ROUND = ShapeEntity_ShapeStyle_LineJoin._(1, 'LineJoin_ROUND'); 50 | static const ShapeEntity_ShapeStyle_LineJoin LineJoin_BEVEL = ShapeEntity_ShapeStyle_LineJoin._(2, 'LineJoin_BEVEL'); 51 | 52 | static const $core.List values = [ 53 | LineJoin_MITER, 54 | LineJoin_ROUND, 55 | LineJoin_BEVEL, 56 | ]; 57 | 58 | static final $core.Map<$core.int, ShapeEntity_ShapeStyle_LineJoin> _byValue = $pb.ProtobufEnum.initByValue(values); 59 | static ShapeEntity_ShapeStyle_LineJoin valueOf($core.int value) => _byValue[value]; 60 | 61 | const ShapeEntity_ShapeStyle_LineJoin._($core.int v, $core.String n) : super(v, n); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /proto/dart/svga.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: svga.proto 4 | /// 5 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name 6 | 7 | const MovieParams$json = const { 8 | '1': 'MovieParams', 9 | '2': const [ 10 | const {'1': 'viewBoxWidth', '3': 1, '4': 1, '5': 2, '10': 'viewBoxWidth'}, 11 | const {'1': 'viewBoxHeight', '3': 2, '4': 1, '5': 2, '10': 'viewBoxHeight'}, 12 | const {'1': 'fps', '3': 3, '4': 1, '5': 5, '10': 'fps'}, 13 | const {'1': 'frames', '3': 4, '4': 1, '5': 5, '10': 'frames'}, 14 | ], 15 | }; 16 | 17 | const SpriteEntity$json = const { 18 | '1': 'SpriteEntity', 19 | '2': const [ 20 | const {'1': 'imageKey', '3': 1, '4': 1, '5': 9, '10': 'imageKey'}, 21 | const {'1': 'frames', '3': 2, '4': 3, '5': 11, '6': '.com.opensource.svga.FrameEntity', '10': 'frames'}, 22 | const {'1': 'matteKey', '3': 3, '4': 1, '5': 9, '10': 'matteKey'}, 23 | ], 24 | }; 25 | 26 | const AudioEntity$json = const { 27 | '1': 'AudioEntity', 28 | '2': const [ 29 | const {'1': 'audioKey', '3': 1, '4': 1, '5': 9, '10': 'audioKey'}, 30 | const {'1': 'startFrame', '3': 2, '4': 1, '5': 5, '10': 'startFrame'}, 31 | const {'1': 'endFrame', '3': 3, '4': 1, '5': 5, '10': 'endFrame'}, 32 | const {'1': 'startTime', '3': 4, '4': 1, '5': 5, '10': 'startTime'}, 33 | const {'1': 'totalTime', '3': 5, '4': 1, '5': 5, '10': 'totalTime'}, 34 | ], 35 | }; 36 | 37 | const Layout$json = const { 38 | '1': 'Layout', 39 | '2': const [ 40 | const {'1': 'x', '3': 1, '4': 1, '5': 2, '10': 'x'}, 41 | const {'1': 'y', '3': 2, '4': 1, '5': 2, '10': 'y'}, 42 | const {'1': 'width', '3': 3, '4': 1, '5': 2, '10': 'width'}, 43 | const {'1': 'height', '3': 4, '4': 1, '5': 2, '10': 'height'}, 44 | ], 45 | }; 46 | 47 | const Transform$json = const { 48 | '1': 'Transform', 49 | '2': const [ 50 | const {'1': 'a', '3': 1, '4': 1, '5': 2, '10': 'a'}, 51 | const {'1': 'b', '3': 2, '4': 1, '5': 2, '10': 'b'}, 52 | const {'1': 'c', '3': 3, '4': 1, '5': 2, '10': 'c'}, 53 | const {'1': 'd', '3': 4, '4': 1, '5': 2, '10': 'd'}, 54 | const {'1': 'tx', '3': 5, '4': 1, '5': 2, '10': 'tx'}, 55 | const {'1': 'ty', '3': 6, '4': 1, '5': 2, '10': 'ty'}, 56 | ], 57 | }; 58 | 59 | const ShapeEntity$json = const { 60 | '1': 'ShapeEntity', 61 | '2': const [ 62 | const {'1': 'type', '3': 1, '4': 1, '5': 14, '6': '.com.opensource.svga.ShapeEntity.ShapeType', '10': 'type'}, 63 | const {'1': 'shape', '3': 2, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.ShapeArgs', '9': 0, '10': 'shape'}, 64 | const {'1': 'rect', '3': 3, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.RectArgs', '9': 0, '10': 'rect'}, 65 | const {'1': 'ellipse', '3': 4, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.EllipseArgs', '9': 0, '10': 'ellipse'}, 66 | const {'1': 'styles', '3': 10, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.ShapeStyle', '10': 'styles'}, 67 | const {'1': 'transform', '3': 11, '4': 1, '5': 11, '6': '.com.opensource.svga.Transform', '10': 'transform'}, 68 | ], 69 | '3': const [ShapeEntity_ShapeArgs$json, ShapeEntity_RectArgs$json, ShapeEntity_EllipseArgs$json, ShapeEntity_ShapeStyle$json], 70 | '4': const [ShapeEntity_ShapeType$json], 71 | '8': const [ 72 | const {'1': 'args'}, 73 | ], 74 | }; 75 | 76 | const ShapeEntity_ShapeArgs$json = const { 77 | '1': 'ShapeArgs', 78 | '2': const [ 79 | const {'1': 'd', '3': 1, '4': 1, '5': 9, '10': 'd'}, 80 | ], 81 | }; 82 | 83 | const ShapeEntity_RectArgs$json = const { 84 | '1': 'RectArgs', 85 | '2': const [ 86 | const {'1': 'x', '3': 1, '4': 1, '5': 2, '10': 'x'}, 87 | const {'1': 'y', '3': 2, '4': 1, '5': 2, '10': 'y'}, 88 | const {'1': 'width', '3': 3, '4': 1, '5': 2, '10': 'width'}, 89 | const {'1': 'height', '3': 4, '4': 1, '5': 2, '10': 'height'}, 90 | const {'1': 'cornerRadius', '3': 5, '4': 1, '5': 2, '10': 'cornerRadius'}, 91 | ], 92 | }; 93 | 94 | const ShapeEntity_EllipseArgs$json = const { 95 | '1': 'EllipseArgs', 96 | '2': const [ 97 | const {'1': 'x', '3': 1, '4': 1, '5': 2, '10': 'x'}, 98 | const {'1': 'y', '3': 2, '4': 1, '5': 2, '10': 'y'}, 99 | const {'1': 'radiusX', '3': 3, '4': 1, '5': 2, '10': 'radiusX'}, 100 | const {'1': 'radiusY', '3': 4, '4': 1, '5': 2, '10': 'radiusY'}, 101 | ], 102 | }; 103 | 104 | const ShapeEntity_ShapeStyle$json = const { 105 | '1': 'ShapeStyle', 106 | '2': const [ 107 | const {'1': 'fill', '3': 1, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor', '10': 'fill'}, 108 | const {'1': 'stroke', '3': 2, '4': 1, '5': 11, '6': '.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor', '10': 'stroke'}, 109 | const {'1': 'strokeWidth', '3': 3, '4': 1, '5': 2, '10': 'strokeWidth'}, 110 | const {'1': 'lineCap', '3': 4, '4': 1, '5': 14, '6': '.com.opensource.svga.ShapeEntity.ShapeStyle.LineCap', '10': 'lineCap'}, 111 | const {'1': 'lineJoin', '3': 5, '4': 1, '5': 14, '6': '.com.opensource.svga.ShapeEntity.ShapeStyle.LineJoin', '10': 'lineJoin'}, 112 | const {'1': 'miterLimit', '3': 6, '4': 1, '5': 2, '10': 'miterLimit'}, 113 | const {'1': 'lineDashI', '3': 7, '4': 1, '5': 2, '10': 'lineDashI'}, 114 | const {'1': 'lineDashII', '3': 8, '4': 1, '5': 2, '10': 'lineDashII'}, 115 | const {'1': 'lineDashIII', '3': 9, '4': 1, '5': 2, '10': 'lineDashIII'}, 116 | ], 117 | '3': const [ShapeEntity_ShapeStyle_RGBAColor$json], 118 | '4': const [ShapeEntity_ShapeStyle_LineCap$json, ShapeEntity_ShapeStyle_LineJoin$json], 119 | }; 120 | 121 | const ShapeEntity_ShapeStyle_RGBAColor$json = const { 122 | '1': 'RGBAColor', 123 | '2': const [ 124 | const {'1': 'r', '3': 1, '4': 1, '5': 2, '10': 'r'}, 125 | const {'1': 'g', '3': 2, '4': 1, '5': 2, '10': 'g'}, 126 | const {'1': 'b', '3': 3, '4': 1, '5': 2, '10': 'b'}, 127 | const {'1': 'a', '3': 4, '4': 1, '5': 2, '10': 'a'}, 128 | ], 129 | }; 130 | 131 | const ShapeEntity_ShapeStyle_LineCap$json = const { 132 | '1': 'LineCap', 133 | '2': const [ 134 | const {'1': 'LineCap_BUTT', '2': 0}, 135 | const {'1': 'LineCap_ROUND', '2': 1}, 136 | const {'1': 'LineCap_SQUARE', '2': 2}, 137 | ], 138 | }; 139 | 140 | const ShapeEntity_ShapeStyle_LineJoin$json = const { 141 | '1': 'LineJoin', 142 | '2': const [ 143 | const {'1': 'LineJoin_MITER', '2': 0}, 144 | const {'1': 'LineJoin_ROUND', '2': 1}, 145 | const {'1': 'LineJoin_BEVEL', '2': 2}, 146 | ], 147 | }; 148 | 149 | const ShapeEntity_ShapeType$json = const { 150 | '1': 'ShapeType', 151 | '2': const [ 152 | const {'1': 'SHAPE', '2': 0}, 153 | const {'1': 'RECT', '2': 1}, 154 | const {'1': 'ELLIPSE', '2': 2}, 155 | const {'1': 'KEEP', '2': 3}, 156 | ], 157 | }; 158 | 159 | const FrameEntity$json = const { 160 | '1': 'FrameEntity', 161 | '2': const [ 162 | const {'1': 'alpha', '3': 1, '4': 1, '5': 2, '10': 'alpha'}, 163 | const {'1': 'layout', '3': 2, '4': 1, '5': 11, '6': '.com.opensource.svga.Layout', '10': 'layout'}, 164 | const {'1': 'transform', '3': 3, '4': 1, '5': 11, '6': '.com.opensource.svga.Transform', '10': 'transform'}, 165 | const {'1': 'clipPath', '3': 4, '4': 1, '5': 9, '10': 'clipPath'}, 166 | const {'1': 'shapes', '3': 5, '4': 3, '5': 11, '6': '.com.opensource.svga.ShapeEntity', '10': 'shapes'}, 167 | ], 168 | }; 169 | 170 | const MovieEntity$json = const { 171 | '1': 'MovieEntity', 172 | '2': const [ 173 | const {'1': 'version', '3': 1, '4': 1, '5': 9, '10': 'version'}, 174 | const {'1': 'params', '3': 2, '4': 1, '5': 11, '6': '.com.opensource.svga.MovieParams', '10': 'params'}, 175 | const {'1': 'images', '3': 3, '4': 3, '5': 11, '6': '.com.opensource.svga.MovieEntity.ImagesEntry', '10': 'images'}, 176 | const {'1': 'sprites', '3': 4, '4': 3, '5': 11, '6': '.com.opensource.svga.SpriteEntity', '10': 'sprites'}, 177 | const {'1': 'audios', '3': 5, '4': 3, '5': 11, '6': '.com.opensource.svga.AudioEntity', '10': 'audios'}, 178 | ], 179 | '3': const [MovieEntity_ImagesEntry$json], 180 | }; 181 | 182 | const MovieEntity_ImagesEntry$json = const { 183 | '1': 'ImagesEntry', 184 | '2': const [ 185 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 186 | const {'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'}, 187 | ], 188 | '7': const {'7': true}, 189 | }; 190 | 191 | -------------------------------------------------------------------------------- /proto/dart/svga.pbserver.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: svga.proto 4 | /// 5 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name 6 | 7 | export 'svga.pb.dart'; 8 | 9 | -------------------------------------------------------------------------------- /proto/js/svga.json: -------------------------------------------------------------------------------- 1 | { 2 | "nested": { 3 | "com": { 4 | "nested": { 5 | "opensource": { 6 | "nested": { 7 | "svga": { 8 | "options": { 9 | "objc_class_prefix": "SVGAProto", 10 | "java_package": "com.opensource.svgaplayer.proto" 11 | }, 12 | "nested": { 13 | "MovieParams": { 14 | "fields": { 15 | "viewBoxWidth": { 16 | "type": "float", 17 | "id": 1 18 | }, 19 | "viewBoxHeight": { 20 | "type": "float", 21 | "id": 2 22 | }, 23 | "fps": { 24 | "type": "int32", 25 | "id": 3 26 | }, 27 | "frames": { 28 | "type": "int32", 29 | "id": 4 30 | } 31 | } 32 | }, 33 | "SpriteEntity": { 34 | "fields": { 35 | "imageKey": { 36 | "type": "string", 37 | "id": 1 38 | }, 39 | "frames": { 40 | "rule": "repeated", 41 | "type": "FrameEntity", 42 | "id": 2 43 | }, 44 | "matteKey": { 45 | "type": "string", 46 | "id": 3 47 | } 48 | } 49 | }, 50 | "AudioEntity": { 51 | "fields": { 52 | "audioKey": { 53 | "type": "string", 54 | "id": 1 55 | }, 56 | "startFrame": { 57 | "type": "int32", 58 | "id": 2 59 | }, 60 | "endFrame": { 61 | "type": "int32", 62 | "id": 3 63 | }, 64 | "startTime": { 65 | "type": "int32", 66 | "id": 4 67 | }, 68 | "totalTime": { 69 | "type": "int32", 70 | "id": 5 71 | } 72 | } 73 | }, 74 | "Layout": { 75 | "fields": { 76 | "x": { 77 | "type": "float", 78 | "id": 1 79 | }, 80 | "y": { 81 | "type": "float", 82 | "id": 2 83 | }, 84 | "width": { 85 | "type": "float", 86 | "id": 3 87 | }, 88 | "height": { 89 | "type": "float", 90 | "id": 4 91 | } 92 | } 93 | }, 94 | "Transform": { 95 | "fields": { 96 | "a": { 97 | "type": "float", 98 | "id": 1 99 | }, 100 | "b": { 101 | "type": "float", 102 | "id": 2 103 | }, 104 | "c": { 105 | "type": "float", 106 | "id": 3 107 | }, 108 | "d": { 109 | "type": "float", 110 | "id": 4 111 | }, 112 | "tx": { 113 | "type": "float", 114 | "id": 5 115 | }, 116 | "ty": { 117 | "type": "float", 118 | "id": 6 119 | } 120 | } 121 | }, 122 | "ShapeEntity": { 123 | "oneofs": { 124 | "args": { 125 | "oneof": [ 126 | "shape", 127 | "rect", 128 | "ellipse" 129 | ] 130 | } 131 | }, 132 | "fields": { 133 | "type": { 134 | "type": "ShapeType", 135 | "id": 1 136 | }, 137 | "shape": { 138 | "type": "ShapeArgs", 139 | "id": 2 140 | }, 141 | "rect": { 142 | "type": "RectArgs", 143 | "id": 3 144 | }, 145 | "ellipse": { 146 | "type": "EllipseArgs", 147 | "id": 4 148 | }, 149 | "styles": { 150 | "type": "ShapeStyle", 151 | "id": 10 152 | }, 153 | "transform": { 154 | "type": "Transform", 155 | "id": 11 156 | } 157 | }, 158 | "nested": { 159 | "ShapeType": { 160 | "values": { 161 | "SHAPE": 0, 162 | "RECT": 1, 163 | "ELLIPSE": 2, 164 | "KEEP": 3 165 | } 166 | }, 167 | "ShapeArgs": { 168 | "fields": { 169 | "d": { 170 | "type": "string", 171 | "id": 1 172 | } 173 | } 174 | }, 175 | "RectArgs": { 176 | "fields": { 177 | "x": { 178 | "type": "float", 179 | "id": 1 180 | }, 181 | "y": { 182 | "type": "float", 183 | "id": 2 184 | }, 185 | "width": { 186 | "type": "float", 187 | "id": 3 188 | }, 189 | "height": { 190 | "type": "float", 191 | "id": 4 192 | }, 193 | "cornerRadius": { 194 | "type": "float", 195 | "id": 5 196 | } 197 | } 198 | }, 199 | "EllipseArgs": { 200 | "fields": { 201 | "x": { 202 | "type": "float", 203 | "id": 1 204 | }, 205 | "y": { 206 | "type": "float", 207 | "id": 2 208 | }, 209 | "radiusX": { 210 | "type": "float", 211 | "id": 3 212 | }, 213 | "radiusY": { 214 | "type": "float", 215 | "id": 4 216 | } 217 | } 218 | }, 219 | "ShapeStyle": { 220 | "fields": { 221 | "fill": { 222 | "type": "RGBAColor", 223 | "id": 1 224 | }, 225 | "stroke": { 226 | "type": "RGBAColor", 227 | "id": 2 228 | }, 229 | "strokeWidth": { 230 | "type": "float", 231 | "id": 3 232 | }, 233 | "lineCap": { 234 | "type": "LineCap", 235 | "id": 4 236 | }, 237 | "lineJoin": { 238 | "type": "LineJoin", 239 | "id": 5 240 | }, 241 | "miterLimit": { 242 | "type": "float", 243 | "id": 6 244 | }, 245 | "lineDashI": { 246 | "type": "float", 247 | "id": 7 248 | }, 249 | "lineDashII": { 250 | "type": "float", 251 | "id": 8 252 | }, 253 | "lineDashIII": { 254 | "type": "float", 255 | "id": 9 256 | } 257 | }, 258 | "nested": { 259 | "RGBAColor": { 260 | "fields": { 261 | "r": { 262 | "type": "float", 263 | "id": 1 264 | }, 265 | "g": { 266 | "type": "float", 267 | "id": 2 268 | }, 269 | "b": { 270 | "type": "float", 271 | "id": 3 272 | }, 273 | "a": { 274 | "type": "float", 275 | "id": 4 276 | } 277 | } 278 | }, 279 | "LineCap": { 280 | "values": { 281 | "LineCap_BUTT": 0, 282 | "LineCap_ROUND": 1, 283 | "LineCap_SQUARE": 2 284 | } 285 | }, 286 | "LineJoin": { 287 | "values": { 288 | "LineJoin_MITER": 0, 289 | "LineJoin_ROUND": 1, 290 | "LineJoin_BEVEL": 2 291 | } 292 | } 293 | } 294 | } 295 | } 296 | }, 297 | "FrameEntity": { 298 | "fields": { 299 | "alpha": { 300 | "type": "float", 301 | "id": 1 302 | }, 303 | "layout": { 304 | "type": "Layout", 305 | "id": 2 306 | }, 307 | "transform": { 308 | "type": "Transform", 309 | "id": 3 310 | }, 311 | "clipPath": { 312 | "type": "string", 313 | "id": 4 314 | }, 315 | "shapes": { 316 | "rule": "repeated", 317 | "type": "ShapeEntity", 318 | "id": 5 319 | } 320 | } 321 | }, 322 | "MovieEntity": { 323 | "fields": { 324 | "version": { 325 | "type": "string", 326 | "id": 1 327 | }, 328 | "params": { 329 | "type": "MovieParams", 330 | "id": 2 331 | }, 332 | "images": { 333 | "keyType": "string", 334 | "type": "bytes", 335 | "id": 3 336 | }, 337 | "sprites": { 338 | "rule": "repeated", 339 | "type": "SpriteEntity", 340 | "id": 4 341 | }, 342 | "audios": { 343 | "rule": "repeated", 344 | "type": "AudioEntity", 345 | "id": 5 346 | } 347 | } 348 | } 349 | } 350 | } 351 | } 352 | } 353 | } 354 | } 355 | } 356 | } -------------------------------------------------------------------------------- /proto/oc/Svga.pbobjc.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: svga.proto 3 | 4 | // This CPP symbol can be defined to use imports that match up to the framework 5 | // imports needed when using CocoaPods. 6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) 7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 8 | #endif 9 | 10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 11 | #import 12 | #else 13 | #import "GPBProtocolBuffers.h" 14 | #endif 15 | 16 | #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 17 | #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. 18 | #endif 19 | #if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION 20 | #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. 21 | #endif 22 | 23 | // @@protoc_insertion_point(imports) 24 | 25 | #pragma clang diagnostic push 26 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 27 | 28 | CF_EXTERN_C_BEGIN 29 | 30 | @class SVGAProtoAudioEntity; 31 | @class SVGAProtoFrameEntity; 32 | @class SVGAProtoLayout; 33 | @class SVGAProtoMovieParams; 34 | @class SVGAProtoShapeEntity; 35 | @class SVGAProtoShapeEntity_EllipseArgs; 36 | @class SVGAProtoShapeEntity_RectArgs; 37 | @class SVGAProtoShapeEntity_ShapeArgs; 38 | @class SVGAProtoShapeEntity_ShapeStyle; 39 | @class SVGAProtoShapeEntity_ShapeStyle_RGBAColor; 40 | @class SVGAProtoSpriteEntity; 41 | @class SVGAProtoTransform; 42 | 43 | NS_ASSUME_NONNULL_BEGIN 44 | 45 | #pragma mark - Enum SVGAProtoShapeEntity_ShapeType 46 | 47 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeType) { 48 | /** 49 | * Value used if any message's field encounters a value that is not defined 50 | * by this enum. The message will also have C functions to get/set the rawValue 51 | * of the field. 52 | **/ 53 | SVGAProtoShapeEntity_ShapeType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, 54 | /** 路径 */ 55 | SVGAProtoShapeEntity_ShapeType_Shape = 0, 56 | 57 | /** 矩形 */ 58 | SVGAProtoShapeEntity_ShapeType_Rect = 1, 59 | 60 | /** 圆形 */ 61 | SVGAProtoShapeEntity_ShapeType_Ellipse = 2, 62 | 63 | /** 与前帧一致 */ 64 | SVGAProtoShapeEntity_ShapeType_Keep = 3, 65 | }; 66 | 67 | GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeType_EnumDescriptor(void); 68 | 69 | /** 70 | * Checks to see if the given value is defined by the enum or was not known at 71 | * the time this source was generated. 72 | **/ 73 | BOOL SVGAProtoShapeEntity_ShapeType_IsValidValue(int32_t value); 74 | 75 | #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineCap 76 | 77 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_LineCap) { 78 | /** 79 | * Value used if any message's field encounters a value that is not defined 80 | * by this enum. The message will also have C functions to get/set the rawValue 81 | * of the field. 82 | **/ 83 | SVGAProtoShapeEntity_ShapeStyle_LineCap_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, 84 | SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt = 0, 85 | SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound = 1, 86 | SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare = 2, 87 | }; 88 | 89 | GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineCap_EnumDescriptor(void); 90 | 91 | /** 92 | * Checks to see if the given value is defined by the enum or was not known at 93 | * the time this source was generated. 94 | **/ 95 | BOOL SVGAProtoShapeEntity_ShapeStyle_LineCap_IsValidValue(int32_t value); 96 | 97 | #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineJoin 98 | 99 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_LineJoin) { 100 | /** 101 | * Value used if any message's field encounters a value that is not defined 102 | * by this enum. The message will also have C functions to get/set the rawValue 103 | * of the field. 104 | **/ 105 | SVGAProtoShapeEntity_ShapeStyle_LineJoin_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, 106 | SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter = 0, 107 | SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound = 1, 108 | SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel = 2, 109 | }; 110 | 111 | GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineJoin_EnumDescriptor(void); 112 | 113 | /** 114 | * Checks to see if the given value is defined by the enum or was not known at 115 | * the time this source was generated. 116 | **/ 117 | BOOL SVGAProtoShapeEntity_ShapeStyle_LineJoin_IsValidValue(int32_t value); 118 | 119 | #pragma mark - SVGAProtoSvgaRoot 120 | 121 | /** 122 | * Exposes the extension registry for this file. 123 | * 124 | * The base class provides: 125 | * @code 126 | * + (GPBExtensionRegistry *)extensionRegistry; 127 | * @endcode 128 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by 129 | * this file and all files that it depends on. 130 | **/ 131 | @interface SVGAProtoSvgaRoot : GPBRootObject 132 | @end 133 | 134 | #pragma mark - SVGAProtoMovieParams 135 | 136 | typedef GPB_ENUM(SVGAProtoMovieParams_FieldNumber) { 137 | SVGAProtoMovieParams_FieldNumber_ViewBoxWidth = 1, 138 | SVGAProtoMovieParams_FieldNumber_ViewBoxHeight = 2, 139 | SVGAProtoMovieParams_FieldNumber_Fps = 3, 140 | SVGAProtoMovieParams_FieldNumber_Frames = 4, 141 | }; 142 | 143 | @interface SVGAProtoMovieParams : GPBMessage 144 | 145 | /** 画布宽 */ 146 | @property(nonatomic, readwrite) float viewBoxWidth; 147 | 148 | /** 画布高 */ 149 | @property(nonatomic, readwrite) float viewBoxHeight; 150 | 151 | /** 动画每秒播放帧数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 */ 152 | @property(nonatomic, readwrite) int32_t fps; 153 | 154 | /** 动画总帧数 */ 155 | @property(nonatomic, readwrite) int32_t frames; 156 | 157 | @end 158 | 159 | #pragma mark - SVGAProtoSpriteEntity 160 | 161 | typedef GPB_ENUM(SVGAProtoSpriteEntity_FieldNumber) { 162 | SVGAProtoSpriteEntity_FieldNumber_ImageKey = 1, 163 | SVGAProtoSpriteEntity_FieldNumber_FramesArray = 2, 164 | SVGAProtoSpriteEntity_FieldNumber_MatteKey = 3, 165 | }; 166 | 167 | @interface SVGAProtoSpriteEntity : GPBMessage 168 | 169 | /** 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 */ 170 | @property(nonatomic, readwrite, copy, null_resettable) NSString *imageKey; 171 | 172 | /** 帧列表 */ 173 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *framesArray; 174 | /** The number of items in @c framesArray without causing the array to be created. */ 175 | @property(nonatomic, readonly) NSUInteger framesArray_Count; 176 | 177 | /** 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. */ 178 | @property(nonatomic, readwrite, copy, null_resettable) NSString *matteKey; 179 | 180 | @end 181 | 182 | #pragma mark - SVGAProtoAudioEntity 183 | 184 | typedef GPB_ENUM(SVGAProtoAudioEntity_FieldNumber) { 185 | SVGAProtoAudioEntity_FieldNumber_AudioKey = 1, 186 | SVGAProtoAudioEntity_FieldNumber_StartFrame = 2, 187 | SVGAProtoAudioEntity_FieldNumber_EndFrame = 3, 188 | SVGAProtoAudioEntity_FieldNumber_StartTime = 4, 189 | SVGAProtoAudioEntity_FieldNumber_TotalTime = 5, 190 | }; 191 | 192 | @interface SVGAProtoAudioEntity : GPBMessage 193 | 194 | /** 音频文件名 */ 195 | @property(nonatomic, readwrite, copy, null_resettable) NSString *audioKey; 196 | 197 | /** 音频播放起始帧 */ 198 | @property(nonatomic, readwrite) int32_t startFrame; 199 | 200 | /** 音频播放结束帧 */ 201 | @property(nonatomic, readwrite) int32_t endFrame; 202 | 203 | /** 音频播放起始时间(相对音频长度) */ 204 | @property(nonatomic, readwrite) int32_t startTime; 205 | 206 | /** 音频总长度 */ 207 | @property(nonatomic, readwrite) int32_t totalTime; 208 | 209 | @end 210 | 211 | #pragma mark - SVGAProtoLayout 212 | 213 | typedef GPB_ENUM(SVGAProtoLayout_FieldNumber) { 214 | SVGAProtoLayout_FieldNumber_X = 1, 215 | SVGAProtoLayout_FieldNumber_Y = 2, 216 | SVGAProtoLayout_FieldNumber_Width = 3, 217 | SVGAProtoLayout_FieldNumber_Height = 4, 218 | }; 219 | 220 | @interface SVGAProtoLayout : GPBMessage 221 | 222 | @property(nonatomic, readwrite) float x; 223 | 224 | @property(nonatomic, readwrite) float y; 225 | 226 | @property(nonatomic, readwrite) float width; 227 | 228 | @property(nonatomic, readwrite) float height; 229 | 230 | @end 231 | 232 | #pragma mark - SVGAProtoTransform 233 | 234 | typedef GPB_ENUM(SVGAProtoTransform_FieldNumber) { 235 | SVGAProtoTransform_FieldNumber_A = 1, 236 | SVGAProtoTransform_FieldNumber_B = 2, 237 | SVGAProtoTransform_FieldNumber_C = 3, 238 | SVGAProtoTransform_FieldNumber_D = 4, 239 | SVGAProtoTransform_FieldNumber_Tx = 5, 240 | SVGAProtoTransform_FieldNumber_Ty = 6, 241 | }; 242 | 243 | @interface SVGAProtoTransform : GPBMessage 244 | 245 | @property(nonatomic, readwrite) float a; 246 | 247 | @property(nonatomic, readwrite) float b; 248 | 249 | @property(nonatomic, readwrite) float c; 250 | 251 | @property(nonatomic, readwrite) float d; 252 | 253 | @property(nonatomic, readwrite) float tx; 254 | 255 | @property(nonatomic, readwrite) float ty; 256 | 257 | @end 258 | 259 | #pragma mark - SVGAProtoShapeEntity 260 | 261 | typedef GPB_ENUM(SVGAProtoShapeEntity_FieldNumber) { 262 | SVGAProtoShapeEntity_FieldNumber_Type = 1, 263 | SVGAProtoShapeEntity_FieldNumber_Shape = 2, 264 | SVGAProtoShapeEntity_FieldNumber_Rect = 3, 265 | SVGAProtoShapeEntity_FieldNumber_Ellipse = 4, 266 | SVGAProtoShapeEntity_FieldNumber_Styles = 10, 267 | SVGAProtoShapeEntity_FieldNumber_Transform = 11, 268 | }; 269 | 270 | typedef GPB_ENUM(SVGAProtoShapeEntity_Args_OneOfCase) { 271 | SVGAProtoShapeEntity_Args_OneOfCase_GPBUnsetOneOfCase = 0, 272 | SVGAProtoShapeEntity_Args_OneOfCase_Shape = 2, 273 | SVGAProtoShapeEntity_Args_OneOfCase_Rect = 3, 274 | SVGAProtoShapeEntity_Args_OneOfCase_Ellipse = 4, 275 | }; 276 | 277 | @interface SVGAProtoShapeEntity : GPBMessage 278 | 279 | /** 矢量类型 */ 280 | @property(nonatomic, readwrite) SVGAProtoShapeEntity_ShapeType type; 281 | 282 | @property(nonatomic, readonly) SVGAProtoShapeEntity_Args_OneOfCase argsOneOfCase; 283 | 284 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_ShapeArgs *shape; 285 | 286 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_RectArgs *rect; 287 | 288 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_EllipseArgs *ellipse; 289 | 290 | /** 渲染参数 */ 291 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_ShapeStyle *styles; 292 | /** Test to see if @c styles has been set. */ 293 | @property(nonatomic, readwrite) BOOL hasStyles; 294 | 295 | /** 矢量图层 2D 变换矩阵 */ 296 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoTransform *transform; 297 | /** Test to see if @c transform has been set. */ 298 | @property(nonatomic, readwrite) BOOL hasTransform; 299 | 300 | @end 301 | 302 | /** 303 | * Fetches the raw value of a @c SVGAProtoShapeEntity's @c type property, even 304 | * if the value was not defined by the enum at the time the code was generated. 305 | **/ 306 | int32_t SVGAProtoShapeEntity_Type_RawValue(SVGAProtoShapeEntity *message); 307 | /** 308 | * Sets the raw value of an @c SVGAProtoShapeEntity's @c type property, allowing 309 | * it to be set to a value that was not defined by the enum at the time the code 310 | * was generated. 311 | **/ 312 | void SetSVGAProtoShapeEntity_Type_RawValue(SVGAProtoShapeEntity *message, int32_t value); 313 | 314 | /** 315 | * Clears whatever value was set for the oneof 'args'. 316 | **/ 317 | void SVGAProtoShapeEntity_ClearArgsOneOfCase(SVGAProtoShapeEntity *message); 318 | 319 | #pragma mark - SVGAProtoShapeEntity_ShapeArgs 320 | 321 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeArgs_FieldNumber) { 322 | SVGAProtoShapeEntity_ShapeArgs_FieldNumber_D = 1, 323 | }; 324 | 325 | @interface SVGAProtoShapeEntity_ShapeArgs : GPBMessage 326 | 327 | /** SVG 路径 */ 328 | @property(nonatomic, readwrite, copy, null_resettable) NSString *d; 329 | 330 | @end 331 | 332 | #pragma mark - SVGAProtoShapeEntity_RectArgs 333 | 334 | typedef GPB_ENUM(SVGAProtoShapeEntity_RectArgs_FieldNumber) { 335 | SVGAProtoShapeEntity_RectArgs_FieldNumber_X = 1, 336 | SVGAProtoShapeEntity_RectArgs_FieldNumber_Y = 2, 337 | SVGAProtoShapeEntity_RectArgs_FieldNumber_Width = 3, 338 | SVGAProtoShapeEntity_RectArgs_FieldNumber_Height = 4, 339 | SVGAProtoShapeEntity_RectArgs_FieldNumber_CornerRadius = 5, 340 | }; 341 | 342 | @interface SVGAProtoShapeEntity_RectArgs : GPBMessage 343 | 344 | @property(nonatomic, readwrite) float x; 345 | 346 | @property(nonatomic, readwrite) float y; 347 | 348 | @property(nonatomic, readwrite) float width; 349 | 350 | @property(nonatomic, readwrite) float height; 351 | 352 | /** 圆角半径 */ 353 | @property(nonatomic, readwrite) float cornerRadius; 354 | 355 | @end 356 | 357 | #pragma mark - SVGAProtoShapeEntity_EllipseArgs 358 | 359 | typedef GPB_ENUM(SVGAProtoShapeEntity_EllipseArgs_FieldNumber) { 360 | SVGAProtoShapeEntity_EllipseArgs_FieldNumber_X = 1, 361 | SVGAProtoShapeEntity_EllipseArgs_FieldNumber_Y = 2, 362 | SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusX = 3, 363 | SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusY = 4, 364 | }; 365 | 366 | @interface SVGAProtoShapeEntity_EllipseArgs : GPBMessage 367 | 368 | /** 圆中心点 X */ 369 | @property(nonatomic, readwrite) float x; 370 | 371 | /** 圆中心点 Y */ 372 | @property(nonatomic, readwrite) float y; 373 | 374 | /** 横向半径 */ 375 | @property(nonatomic, readwrite) float radiusX; 376 | 377 | /** 纵向半径 */ 378 | @property(nonatomic, readwrite) float radiusY; 379 | 380 | @end 381 | 382 | #pragma mark - SVGAProtoShapeEntity_ShapeStyle 383 | 384 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_FieldNumber) { 385 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Fill = 1, 386 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Stroke = 2, 387 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_StrokeWidth = 3, 388 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap = 4, 389 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin = 5, 390 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_MiterLimit = 6, 391 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashI = 7, 392 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIi = 8, 393 | SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIii = 9, 394 | }; 395 | 396 | @interface SVGAProtoShapeEntity_ShapeStyle : GPBMessage 397 | 398 | /** 填充色 */ 399 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_ShapeStyle_RGBAColor *fill; 400 | /** Test to see if @c fill has been set. */ 401 | @property(nonatomic, readwrite) BOOL hasFill; 402 | 403 | /** 描边色 */ 404 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoShapeEntity_ShapeStyle_RGBAColor *stroke; 405 | /** Test to see if @c stroke has been set. */ 406 | @property(nonatomic, readwrite) BOOL hasStroke; 407 | 408 | /** 描边宽 */ 409 | @property(nonatomic, readwrite) float strokeWidth; 410 | 411 | /** 线段端点样式 */ 412 | @property(nonatomic, readwrite) SVGAProtoShapeEntity_ShapeStyle_LineCap lineCap; 413 | 414 | /** 线段连接样式 */ 415 | @property(nonatomic, readwrite) SVGAProtoShapeEntity_ShapeStyle_LineJoin lineJoin; 416 | 417 | /** 尖角限制 */ 418 | @property(nonatomic, readwrite) float miterLimit; 419 | 420 | /** 虚线参数 Dash */ 421 | @property(nonatomic, readwrite) float lineDashI; 422 | 423 | /** 虚线参数 Gap */ 424 | @property(nonatomic, readwrite) float lineDashIi; 425 | 426 | /** 虚线参数 Offset */ 427 | @property(nonatomic, readwrite) float lineDashIii; 428 | 429 | @end 430 | 431 | /** 432 | * Fetches the raw value of a @c SVGAProtoShapeEntity_ShapeStyle's @c lineCap property, even 433 | * if the value was not defined by the enum at the time the code was generated. 434 | **/ 435 | int32_t SVGAProtoShapeEntity_ShapeStyle_LineCap_RawValue(SVGAProtoShapeEntity_ShapeStyle *message); 436 | /** 437 | * Sets the raw value of an @c SVGAProtoShapeEntity_ShapeStyle's @c lineCap property, allowing 438 | * it to be set to a value that was not defined by the enum at the time the code 439 | * was generated. 440 | **/ 441 | void SetSVGAProtoShapeEntity_ShapeStyle_LineCap_RawValue(SVGAProtoShapeEntity_ShapeStyle *message, int32_t value); 442 | 443 | /** 444 | * Fetches the raw value of a @c SVGAProtoShapeEntity_ShapeStyle's @c lineJoin property, even 445 | * if the value was not defined by the enum at the time the code was generated. 446 | **/ 447 | int32_t SVGAProtoShapeEntity_ShapeStyle_LineJoin_RawValue(SVGAProtoShapeEntity_ShapeStyle *message); 448 | /** 449 | * Sets the raw value of an @c SVGAProtoShapeEntity_ShapeStyle's @c lineJoin property, allowing 450 | * it to be set to a value that was not defined by the enum at the time the code 451 | * was generated. 452 | **/ 453 | void SetSVGAProtoShapeEntity_ShapeStyle_LineJoin_RawValue(SVGAProtoShapeEntity_ShapeStyle *message, int32_t value); 454 | 455 | #pragma mark - SVGAProtoShapeEntity_ShapeStyle_RGBAColor 456 | 457 | typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber) { 458 | SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_R = 1, 459 | SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_G = 2, 460 | SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_B = 3, 461 | SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_A = 4, 462 | }; 463 | 464 | @interface SVGAProtoShapeEntity_ShapeStyle_RGBAColor : GPBMessage 465 | 466 | @property(nonatomic, readwrite) float r; 467 | 468 | @property(nonatomic, readwrite) float g; 469 | 470 | @property(nonatomic, readwrite) float b; 471 | 472 | @property(nonatomic, readwrite) float a; 473 | 474 | @end 475 | 476 | #pragma mark - SVGAProtoFrameEntity 477 | 478 | typedef GPB_ENUM(SVGAProtoFrameEntity_FieldNumber) { 479 | SVGAProtoFrameEntity_FieldNumber_Alpha = 1, 480 | SVGAProtoFrameEntity_FieldNumber_Layout = 2, 481 | SVGAProtoFrameEntity_FieldNumber_Transform = 3, 482 | SVGAProtoFrameEntity_FieldNumber_ClipPath = 4, 483 | SVGAProtoFrameEntity_FieldNumber_ShapesArray = 5, 484 | }; 485 | 486 | @interface SVGAProtoFrameEntity : GPBMessage 487 | 488 | /** 透明度 */ 489 | @property(nonatomic, readwrite) float alpha; 490 | 491 | /** 初始约束大小 */ 492 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoLayout *layout; 493 | /** Test to see if @c layout has been set. */ 494 | @property(nonatomic, readwrite) BOOL hasLayout; 495 | 496 | /** 2D 变换矩阵 */ 497 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoTransform *transform; 498 | /** Test to see if @c transform has been set. */ 499 | @property(nonatomic, readwrite) BOOL hasTransform; 500 | 501 | /** 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 */ 502 | @property(nonatomic, readwrite, copy, null_resettable) NSString *clipPath; 503 | 504 | /** 矢量元素列表 */ 505 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *shapesArray; 506 | /** The number of items in @c shapesArray without causing the array to be created. */ 507 | @property(nonatomic, readonly) NSUInteger shapesArray_Count; 508 | 509 | @end 510 | 511 | #pragma mark - SVGAProtoMovieEntity 512 | 513 | typedef GPB_ENUM(SVGAProtoMovieEntity_FieldNumber) { 514 | SVGAProtoMovieEntity_FieldNumber_Version = 1, 515 | SVGAProtoMovieEntity_FieldNumber_Params = 2, 516 | SVGAProtoMovieEntity_FieldNumber_Images = 3, 517 | SVGAProtoMovieEntity_FieldNumber_SpritesArray = 4, 518 | SVGAProtoMovieEntity_FieldNumber_AudiosArray = 5, 519 | }; 520 | 521 | @interface SVGAProtoMovieEntity : GPBMessage 522 | 523 | /** SVGA 格式版本号 */ 524 | @property(nonatomic, readwrite, copy, null_resettable) NSString *version; 525 | 526 | /** 动画参数 */ 527 | @property(nonatomic, readwrite, strong, null_resettable) SVGAProtoMovieParams *params; 528 | /** Test to see if @c params has been set. */ 529 | @property(nonatomic, readwrite) BOOL hasParams; 530 | 531 | /** Key 是位图键名,Value 是位图文件名或二进制 PNG 数据。 */ 532 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary *images; 533 | /** The number of items in @c images without causing the array to be created. */ 534 | @property(nonatomic, readonly) NSUInteger images_Count; 535 | 536 | /** 元素列表 */ 537 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *spritesArray; 538 | /** The number of items in @c spritesArray without causing the array to be created. */ 539 | @property(nonatomic, readonly) NSUInteger spritesArray_Count; 540 | 541 | /** 音频列表 */ 542 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *audiosArray; 543 | /** The number of items in @c audiosArray without causing the array to be created. */ 544 | @property(nonatomic, readonly) NSUInteger audiosArray_Count; 545 | 546 | @end 547 | 548 | NS_ASSUME_NONNULL_END 549 | 550 | CF_EXTERN_C_END 551 | 552 | #pragma clang diagnostic pop 553 | 554 | // @@protoc_insertion_point(global_scope) 555 | -------------------------------------------------------------------------------- /proto/svga.pb.sh: -------------------------------------------------------------------------------- 1 | protoc --objc_out="./" svga.proto 2 | protoc --java_out="./" svga.proto 3 | protoc --js_out=import_style=commonjs,binary:. svga.proto 4 | pbjs -t json svga.proto > svga.json 5 | java -jar wire-compiler-2.2.0-jar-with-dependencies.jar --proto_path=./ --java_out=wire220 svga.proto -------------------------------------------------------------------------------- /proto/svga.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.opensource.svga; 3 | option objc_class_prefix = "SVGAProto"; 4 | option java_package = "com.opensource.svgaplayer.proto"; 5 | 6 | message MovieParams { 7 | float viewBoxWidth = 1; // 画布宽 8 | float viewBoxHeight = 2; // 画布高 9 | int32 fps = 3; // 动画每秒播放帧数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 10 | int32 frames = 4; // 动画总帧数 11 | } 12 | 13 | message SpriteEntity { 14 | string imageKey = 1; // 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 15 | repeated FrameEntity frames = 2; // 帧列表 16 | string matteKey = 3; // 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. 17 | } 18 | 19 | message AudioEntity { 20 | string audioKey = 1; // 音频文件名 21 | int32 startFrame = 2; // 音频播放起始帧 22 | int32 endFrame = 3; // 音频播放结束帧 23 | int32 startTime = 4; // 音频播放起始时间(相对音频长度) 24 | int32 totalTime = 5; // 音频总长度 25 | } 26 | 27 | message Layout { 28 | float x = 1; 29 | float y = 2; 30 | float width = 3; 31 | float height = 4; 32 | } 33 | 34 | message Transform { 35 | float a = 1; 36 | float b = 2; 37 | float c = 3; 38 | float d = 4; 39 | float tx = 5; 40 | float ty = 6; 41 | } 42 | 43 | message ShapeEntity { 44 | 45 | enum ShapeType { 46 | SHAPE = 0; // 路径 47 | RECT = 1; // 矩形 48 | ELLIPSE = 2; // 圆形 49 | KEEP = 3; // 与前帧一致 50 | } 51 | 52 | message ShapeArgs { 53 | string d = 1; // SVG 路径 54 | } 55 | 56 | message RectArgs { 57 | float x = 1; 58 | float y = 2; 59 | float width = 3; 60 | float height = 4; 61 | float cornerRadius = 5; // 圆角半径 62 | } 63 | 64 | message EllipseArgs { 65 | float x = 1; // 圆中心点 X 66 | float y = 2; // 圆中心点 Y 67 | float radiusX = 3; // 横向半径 68 | float radiusY = 4; // 纵向半径 69 | } 70 | 71 | message ShapeStyle { 72 | 73 | message RGBAColor { 74 | float r = 1; 75 | float g = 2; 76 | float b = 3; 77 | float a = 4; 78 | } 79 | 80 | enum LineCap { 81 | LineCap_BUTT = 0; 82 | LineCap_ROUND = 1; 83 | LineCap_SQUARE = 2; 84 | } 85 | 86 | enum LineJoin { 87 | LineJoin_MITER = 0; 88 | LineJoin_ROUND = 1; 89 | LineJoin_BEVEL = 2; 90 | } 91 | 92 | RGBAColor fill = 1; // 填充色 93 | RGBAColor stroke = 2; // 描边色 94 | float strokeWidth = 3; // 描边宽 95 | LineCap lineCap = 4; // 线段端点样式 96 | LineJoin lineJoin = 5; // 线段连接样式 97 | float miterLimit = 6; // 尖角限制 98 | float lineDashI = 7; // 虚线参数 Dash 99 | float lineDashII = 8; // 虚线参数 Gap 100 | float lineDashIII = 9; // 虚线参数 Offset 101 | 102 | } 103 | 104 | ShapeType type = 1; // 矢量类型 105 | oneof args { 106 | ShapeArgs shape = 2; 107 | RectArgs rect = 3; 108 | EllipseArgs ellipse = 4; 109 | } // 矢量参数 110 | ShapeStyle styles = 10; // 渲染参数 111 | Transform transform = 11; // 矢量图层 2D 变换矩阵 112 | 113 | } 114 | 115 | message FrameEntity { 116 | float alpha = 1; // 透明度 117 | Layout layout = 2; // 初始约束大小 118 | Transform transform = 3; // 2D 变换矩阵 119 | string clipPath = 4; // 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 120 | repeated ShapeEntity shapes = 5; // 矢量元素列表 121 | } 122 | 123 | message MovieEntity { 124 | 125 | string version = 1; // SVGA 格式版本号 126 | MovieParams params = 2; // 动画参数 127 | map images = 3; // Key 是位图键名,Value 是位图文件名或二进制 PNG 数据。 128 | repeated SpriteEntity sprites = 4; // 元素列表 129 | repeated AudioEntity audios = 5; // 音频列表 130 | 131 | } 132 | -------------------------------------------------------------------------------- /proto/wire-compiler-2.2.0-jar-with-dependencies.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svga/SVGA-Format/a2e311655c6b6698cad1922bec466cb43369ac4d/proto/wire-compiler-2.2.0-jar-with-dependencies.jar -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/AudioEntity.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 19:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Integer; 14 | import java.lang.Object; 15 | import java.lang.Override; 16 | import java.lang.String; 17 | import java.lang.StringBuilder; 18 | import okio.ByteString; 19 | 20 | public final class AudioEntity extends Message { 21 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_AudioEntity(); 22 | 23 | private static final long serialVersionUID = 0L; 24 | 25 | public static final String DEFAULT_AUDIOKEY = ""; 26 | 27 | public static final Integer DEFAULT_STARTFRAME = 0; 28 | 29 | public static final Integer DEFAULT_ENDFRAME = 0; 30 | 31 | public static final Integer DEFAULT_STARTTIME = 0; 32 | 33 | public static final Integer DEFAULT_TOTALTIME = 0; 34 | 35 | /** 36 | * 音频文件名 37 | */ 38 | @WireField( 39 | tag = 1, 40 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 41 | ) 42 | public final String audioKey; 43 | 44 | /** 45 | * 音频播放起始帧 46 | */ 47 | @WireField( 48 | tag = 2, 49 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 50 | ) 51 | public final Integer startFrame; 52 | 53 | /** 54 | * 音频播放结束帧 55 | */ 56 | @WireField( 57 | tag = 3, 58 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 59 | ) 60 | public final Integer endFrame; 61 | 62 | /** 63 | * 音频播放起始时间(相对音频长度) 64 | */ 65 | @WireField( 66 | tag = 4, 67 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 68 | ) 69 | public final Integer startTime; 70 | 71 | /** 72 | * 音频总长度 73 | */ 74 | @WireField( 75 | tag = 5, 76 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 77 | ) 78 | public final Integer totalTime; 79 | 80 | public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, Integer totalTime) { 81 | this(audioKey, startFrame, endFrame, startTime, totalTime, ByteString.EMPTY); 82 | } 83 | 84 | public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, Integer totalTime, ByteString unknownFields) { 85 | super(ADAPTER, unknownFields); 86 | this.audioKey = audioKey; 87 | this.startFrame = startFrame; 88 | this.endFrame = endFrame; 89 | this.startTime = startTime; 90 | this.totalTime = totalTime; 91 | } 92 | 93 | @Override 94 | public Builder newBuilder() { 95 | Builder builder = new Builder(); 96 | builder.audioKey = audioKey; 97 | builder.startFrame = startFrame; 98 | builder.endFrame = endFrame; 99 | builder.startTime = startTime; 100 | builder.totalTime = totalTime; 101 | builder.addUnknownFields(unknownFields()); 102 | return builder; 103 | } 104 | 105 | @Override 106 | public boolean equals(Object other) { 107 | if (other == this) return true; 108 | if (!(other instanceof AudioEntity)) return false; 109 | AudioEntity o = (AudioEntity) other; 110 | return unknownFields().equals(o.unknownFields()) 111 | && Internal.equals(audioKey, o.audioKey) 112 | && Internal.equals(startFrame, o.startFrame) 113 | && Internal.equals(endFrame, o.endFrame) 114 | && Internal.equals(startTime, o.startTime) 115 | && Internal.equals(totalTime, o.totalTime); 116 | } 117 | 118 | @Override 119 | public int hashCode() { 120 | int result = super.hashCode; 121 | if (result == 0) { 122 | result = unknownFields().hashCode(); 123 | result = result * 37 + (audioKey != null ? audioKey.hashCode() : 0); 124 | result = result * 37 + (startFrame != null ? startFrame.hashCode() : 0); 125 | result = result * 37 + (endFrame != null ? endFrame.hashCode() : 0); 126 | result = result * 37 + (startTime != null ? startTime.hashCode() : 0); 127 | result = result * 37 + (totalTime != null ? totalTime.hashCode() : 0); 128 | super.hashCode = result; 129 | } 130 | return result; 131 | } 132 | 133 | @Override 134 | public String toString() { 135 | StringBuilder builder = new StringBuilder(); 136 | if (audioKey != null) builder.append(", audioKey=").append(audioKey); 137 | if (startFrame != null) builder.append(", startFrame=").append(startFrame); 138 | if (endFrame != null) builder.append(", endFrame=").append(endFrame); 139 | if (startTime != null) builder.append(", startTime=").append(startTime); 140 | if (totalTime != null) builder.append(", totalTime=").append(totalTime); 141 | return builder.replace(0, 2, "AudioEntity{").append('}').toString(); 142 | } 143 | 144 | public static final class Builder extends Message.Builder { 145 | public String audioKey; 146 | 147 | public Integer startFrame; 148 | 149 | public Integer endFrame; 150 | 151 | public Integer startTime; 152 | 153 | public Integer totalTime; 154 | 155 | public Builder() { 156 | } 157 | 158 | /** 159 | * 音频文件名 160 | */ 161 | public Builder audioKey(String audioKey) { 162 | this.audioKey = audioKey; 163 | return this; 164 | } 165 | 166 | /** 167 | * 音频播放起始帧 168 | */ 169 | public Builder startFrame(Integer startFrame) { 170 | this.startFrame = startFrame; 171 | return this; 172 | } 173 | 174 | /** 175 | * 音频播放结束帧 176 | */ 177 | public Builder endFrame(Integer endFrame) { 178 | this.endFrame = endFrame; 179 | return this; 180 | } 181 | 182 | /** 183 | * 音频播放起始时间(相对音频长度) 184 | */ 185 | public Builder startTime(Integer startTime) { 186 | this.startTime = startTime; 187 | return this; 188 | } 189 | 190 | /** 191 | * 音频总长度 192 | */ 193 | public Builder totalTime(Integer totalTime) { 194 | this.totalTime = totalTime; 195 | return this; 196 | } 197 | 198 | @Override 199 | public AudioEntity build() { 200 | return new AudioEntity(audioKey, startFrame, endFrame, startTime, totalTime, super.buildUnknownFields()); 201 | } 202 | } 203 | 204 | private static final class ProtoAdapter_AudioEntity extends ProtoAdapter { 205 | ProtoAdapter_AudioEntity() { 206 | super(FieldEncoding.LENGTH_DELIMITED, AudioEntity.class); 207 | } 208 | 209 | @Override 210 | public int encodedSize(AudioEntity value) { 211 | return (value.audioKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.audioKey) : 0) 212 | + (value.startFrame != null ? ProtoAdapter.INT32.encodedSizeWithTag(2, value.startFrame) : 0) 213 | + (value.endFrame != null ? ProtoAdapter.INT32.encodedSizeWithTag(3, value.endFrame) : 0) 214 | + (value.startTime != null ? ProtoAdapter.INT32.encodedSizeWithTag(4, value.startTime) : 0) 215 | + (value.totalTime != null ? ProtoAdapter.INT32.encodedSizeWithTag(5, value.totalTime) : 0) 216 | + value.unknownFields().size(); 217 | } 218 | 219 | @Override 220 | public void encode(ProtoWriter writer, AudioEntity value) throws IOException { 221 | if (value.audioKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.audioKey); 222 | if (value.startFrame != null) ProtoAdapter.INT32.encodeWithTag(writer, 2, value.startFrame); 223 | if (value.endFrame != null) ProtoAdapter.INT32.encodeWithTag(writer, 3, value.endFrame); 224 | if (value.startTime != null) ProtoAdapter.INT32.encodeWithTag(writer, 4, value.startTime); 225 | if (value.totalTime != null) ProtoAdapter.INT32.encodeWithTag(writer, 5, value.totalTime); 226 | writer.writeBytes(value.unknownFields()); 227 | } 228 | 229 | @Override 230 | public AudioEntity decode(ProtoReader reader) throws IOException { 231 | Builder builder = new Builder(); 232 | long token = reader.beginMessage(); 233 | for (int tag; (tag = reader.nextTag()) != -1;) { 234 | switch (tag) { 235 | case 1: builder.audioKey(ProtoAdapter.STRING.decode(reader)); break; 236 | case 2: builder.startFrame(ProtoAdapter.INT32.decode(reader)); break; 237 | case 3: builder.endFrame(ProtoAdapter.INT32.decode(reader)); break; 238 | case 4: builder.startTime(ProtoAdapter.INT32.decode(reader)); break; 239 | case 5: builder.totalTime(ProtoAdapter.INT32.decode(reader)); break; 240 | default: { 241 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 242 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 243 | builder.addUnknownField(tag, fieldEncoding, value); 244 | } 245 | } 246 | } 247 | reader.endMessage(token); 248 | return builder.build(); 249 | } 250 | 251 | @Override 252 | public AudioEntity redact(AudioEntity value) { 253 | Builder builder = value.newBuilder(); 254 | builder.clearUnknownFields(); 255 | return builder.build(); 256 | } 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/FrameEntity.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 115:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Float; 14 | import java.lang.Object; 15 | import java.lang.Override; 16 | import java.lang.String; 17 | import java.lang.StringBuilder; 18 | import java.util.List; 19 | import okio.ByteString; 20 | 21 | public final class FrameEntity extends Message { 22 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_FrameEntity(); 23 | 24 | private static final long serialVersionUID = 0L; 25 | 26 | public static final Float DEFAULT_ALPHA = 0.0f; 27 | 28 | public static final String DEFAULT_CLIPPATH = ""; 29 | 30 | /** 31 | * 透明度 32 | */ 33 | @WireField( 34 | tag = 1, 35 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 36 | ) 37 | public final Float alpha; 38 | 39 | /** 40 | * 初始约束大小 41 | */ 42 | @WireField( 43 | tag = 2, 44 | adapter = "com.opensource.svgaplayer.proto.Layout#ADAPTER" 45 | ) 46 | public final Layout layout; 47 | 48 | /** 49 | * 2D 变换矩阵 50 | */ 51 | @WireField( 52 | tag = 3, 53 | adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER" 54 | ) 55 | public final Transform transform; 56 | 57 | /** 58 | * 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 59 | */ 60 | @WireField( 61 | tag = 4, 62 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 63 | ) 64 | public final String clipPath; 65 | 66 | /** 67 | * 矢量元素列表 68 | */ 69 | @WireField( 70 | tag = 5, 71 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity#ADAPTER", 72 | label = WireField.Label.REPEATED 73 | ) 74 | public final List shapes; 75 | 76 | public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, List shapes) { 77 | this(alpha, layout, transform, clipPath, shapes, ByteString.EMPTY); 78 | } 79 | 80 | public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, List shapes, ByteString unknownFields) { 81 | super(ADAPTER, unknownFields); 82 | this.alpha = alpha; 83 | this.layout = layout; 84 | this.transform = transform; 85 | this.clipPath = clipPath; 86 | this.shapes = Internal.immutableCopyOf("shapes", shapes); 87 | } 88 | 89 | @Override 90 | public Builder newBuilder() { 91 | Builder builder = new Builder(); 92 | builder.alpha = alpha; 93 | builder.layout = layout; 94 | builder.transform = transform; 95 | builder.clipPath = clipPath; 96 | builder.shapes = Internal.copyOf("shapes", shapes); 97 | builder.addUnknownFields(unknownFields()); 98 | return builder; 99 | } 100 | 101 | @Override 102 | public boolean equals(Object other) { 103 | if (other == this) return true; 104 | if (!(other instanceof FrameEntity)) return false; 105 | FrameEntity o = (FrameEntity) other; 106 | return unknownFields().equals(o.unknownFields()) 107 | && Internal.equals(alpha, o.alpha) 108 | && Internal.equals(layout, o.layout) 109 | && Internal.equals(transform, o.transform) 110 | && Internal.equals(clipPath, o.clipPath) 111 | && shapes.equals(o.shapes); 112 | } 113 | 114 | @Override 115 | public int hashCode() { 116 | int result = super.hashCode; 117 | if (result == 0) { 118 | result = unknownFields().hashCode(); 119 | result = result * 37 + (alpha != null ? alpha.hashCode() : 0); 120 | result = result * 37 + (layout != null ? layout.hashCode() : 0); 121 | result = result * 37 + (transform != null ? transform.hashCode() : 0); 122 | result = result * 37 + (clipPath != null ? clipPath.hashCode() : 0); 123 | result = result * 37 + shapes.hashCode(); 124 | super.hashCode = result; 125 | } 126 | return result; 127 | } 128 | 129 | @Override 130 | public String toString() { 131 | StringBuilder builder = new StringBuilder(); 132 | if (alpha != null) builder.append(", alpha=").append(alpha); 133 | if (layout != null) builder.append(", layout=").append(layout); 134 | if (transform != null) builder.append(", transform=").append(transform); 135 | if (clipPath != null) builder.append(", clipPath=").append(clipPath); 136 | if (!shapes.isEmpty()) builder.append(", shapes=").append(shapes); 137 | return builder.replace(0, 2, "FrameEntity{").append('}').toString(); 138 | } 139 | 140 | public static final class Builder extends Message.Builder { 141 | public Float alpha; 142 | 143 | public Layout layout; 144 | 145 | public Transform transform; 146 | 147 | public String clipPath; 148 | 149 | public List shapes; 150 | 151 | public Builder() { 152 | shapes = Internal.newMutableList(); 153 | } 154 | 155 | /** 156 | * 透明度 157 | */ 158 | public Builder alpha(Float alpha) { 159 | this.alpha = alpha; 160 | return this; 161 | } 162 | 163 | /** 164 | * 初始约束大小 165 | */ 166 | public Builder layout(Layout layout) { 167 | this.layout = layout; 168 | return this; 169 | } 170 | 171 | /** 172 | * 2D 变换矩阵 173 | */ 174 | public Builder transform(Transform transform) { 175 | this.transform = transform; 176 | return this; 177 | } 178 | 179 | /** 180 | * 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 181 | */ 182 | public Builder clipPath(String clipPath) { 183 | this.clipPath = clipPath; 184 | return this; 185 | } 186 | 187 | /** 188 | * 矢量元素列表 189 | */ 190 | public Builder shapes(List shapes) { 191 | Internal.checkElementsNotNull(shapes); 192 | this.shapes = shapes; 193 | return this; 194 | } 195 | 196 | @Override 197 | public FrameEntity build() { 198 | return new FrameEntity(alpha, layout, transform, clipPath, shapes, super.buildUnknownFields()); 199 | } 200 | } 201 | 202 | private static final class ProtoAdapter_FrameEntity extends ProtoAdapter { 203 | ProtoAdapter_FrameEntity() { 204 | super(FieldEncoding.LENGTH_DELIMITED, FrameEntity.class); 205 | } 206 | 207 | @Override 208 | public int encodedSize(FrameEntity value) { 209 | return (value.alpha != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.alpha) : 0) 210 | + (value.layout != null ? Layout.ADAPTER.encodedSizeWithTag(2, value.layout) : 0) 211 | + (value.transform != null ? Transform.ADAPTER.encodedSizeWithTag(3, value.transform) : 0) 212 | + (value.clipPath != null ? ProtoAdapter.STRING.encodedSizeWithTag(4, value.clipPath) : 0) 213 | + ShapeEntity.ADAPTER.asRepeated().encodedSizeWithTag(5, value.shapes) 214 | + value.unknownFields().size(); 215 | } 216 | 217 | @Override 218 | public void encode(ProtoWriter writer, FrameEntity value) throws IOException { 219 | if (value.alpha != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.alpha); 220 | if (value.layout != null) Layout.ADAPTER.encodeWithTag(writer, 2, value.layout); 221 | if (value.transform != null) Transform.ADAPTER.encodeWithTag(writer, 3, value.transform); 222 | if (value.clipPath != null) ProtoAdapter.STRING.encodeWithTag(writer, 4, value.clipPath); 223 | ShapeEntity.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.shapes); 224 | writer.writeBytes(value.unknownFields()); 225 | } 226 | 227 | @Override 228 | public FrameEntity decode(ProtoReader reader) throws IOException { 229 | Builder builder = new Builder(); 230 | long token = reader.beginMessage(); 231 | for (int tag; (tag = reader.nextTag()) != -1;) { 232 | switch (tag) { 233 | case 1: builder.alpha(ProtoAdapter.FLOAT.decode(reader)); break; 234 | case 2: builder.layout(Layout.ADAPTER.decode(reader)); break; 235 | case 3: builder.transform(Transform.ADAPTER.decode(reader)); break; 236 | case 4: builder.clipPath(ProtoAdapter.STRING.decode(reader)); break; 237 | case 5: builder.shapes.add(ShapeEntity.ADAPTER.decode(reader)); break; 238 | default: { 239 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 240 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 241 | builder.addUnknownField(tag, fieldEncoding, value); 242 | } 243 | } 244 | } 245 | reader.endMessage(token); 246 | return builder.build(); 247 | } 248 | 249 | @Override 250 | public FrameEntity redact(FrameEntity value) { 251 | Builder builder = value.newBuilder(); 252 | if (builder.layout != null) builder.layout = Layout.ADAPTER.redact(builder.layout); 253 | if (builder.transform != null) builder.transform = Transform.ADAPTER.redact(builder.transform); 254 | Internal.redactElements(builder.shapes, ShapeEntity.ADAPTER); 255 | builder.clearUnknownFields(); 256 | return builder.build(); 257 | } 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/Layout.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 27:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Float; 14 | import java.lang.Object; 15 | import java.lang.Override; 16 | import java.lang.String; 17 | import java.lang.StringBuilder; 18 | import okio.ByteString; 19 | 20 | public final class Layout extends Message { 21 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_Layout(); 22 | 23 | private static final long serialVersionUID = 0L; 24 | 25 | public static final Float DEFAULT_X = 0.0f; 26 | 27 | public static final Float DEFAULT_Y = 0.0f; 28 | 29 | public static final Float DEFAULT_WIDTH = 0.0f; 30 | 31 | public static final Float DEFAULT_HEIGHT = 0.0f; 32 | 33 | @WireField( 34 | tag = 1, 35 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 36 | ) 37 | public final Float x; 38 | 39 | @WireField( 40 | tag = 2, 41 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 42 | ) 43 | public final Float y; 44 | 45 | @WireField( 46 | tag = 3, 47 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 48 | ) 49 | public final Float width; 50 | 51 | @WireField( 52 | tag = 4, 53 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 54 | ) 55 | public final Float height; 56 | 57 | public Layout(Float x, Float y, Float width, Float height) { 58 | this(x, y, width, height, ByteString.EMPTY); 59 | } 60 | 61 | public Layout(Float x, Float y, Float width, Float height, ByteString unknownFields) { 62 | super(ADAPTER, unknownFields); 63 | this.x = x; 64 | this.y = y; 65 | this.width = width; 66 | this.height = height; 67 | } 68 | 69 | @Override 70 | public Builder newBuilder() { 71 | Builder builder = new Builder(); 72 | builder.x = x; 73 | builder.y = y; 74 | builder.width = width; 75 | builder.height = height; 76 | builder.addUnknownFields(unknownFields()); 77 | return builder; 78 | } 79 | 80 | @Override 81 | public boolean equals(Object other) { 82 | if (other == this) return true; 83 | if (!(other instanceof Layout)) return false; 84 | Layout o = (Layout) other; 85 | return unknownFields().equals(o.unknownFields()) 86 | && Internal.equals(x, o.x) 87 | && Internal.equals(y, o.y) 88 | && Internal.equals(width, o.width) 89 | && Internal.equals(height, o.height); 90 | } 91 | 92 | @Override 93 | public int hashCode() { 94 | int result = super.hashCode; 95 | if (result == 0) { 96 | result = unknownFields().hashCode(); 97 | result = result * 37 + (x != null ? x.hashCode() : 0); 98 | result = result * 37 + (y != null ? y.hashCode() : 0); 99 | result = result * 37 + (width != null ? width.hashCode() : 0); 100 | result = result * 37 + (height != null ? height.hashCode() : 0); 101 | super.hashCode = result; 102 | } 103 | return result; 104 | } 105 | 106 | @Override 107 | public String toString() { 108 | StringBuilder builder = new StringBuilder(); 109 | if (x != null) builder.append(", x=").append(x); 110 | if (y != null) builder.append(", y=").append(y); 111 | if (width != null) builder.append(", width=").append(width); 112 | if (height != null) builder.append(", height=").append(height); 113 | return builder.replace(0, 2, "Layout{").append('}').toString(); 114 | } 115 | 116 | public static final class Builder extends Message.Builder { 117 | public Float x; 118 | 119 | public Float y; 120 | 121 | public Float width; 122 | 123 | public Float height; 124 | 125 | public Builder() { 126 | } 127 | 128 | public Builder x(Float x) { 129 | this.x = x; 130 | return this; 131 | } 132 | 133 | public Builder y(Float y) { 134 | this.y = y; 135 | return this; 136 | } 137 | 138 | public Builder width(Float width) { 139 | this.width = width; 140 | return this; 141 | } 142 | 143 | public Builder height(Float height) { 144 | this.height = height; 145 | return this; 146 | } 147 | 148 | @Override 149 | public Layout build() { 150 | return new Layout(x, y, width, height, super.buildUnknownFields()); 151 | } 152 | } 153 | 154 | private static final class ProtoAdapter_Layout extends ProtoAdapter { 155 | ProtoAdapter_Layout() { 156 | super(FieldEncoding.LENGTH_DELIMITED, Layout.class); 157 | } 158 | 159 | @Override 160 | public int encodedSize(Layout value) { 161 | return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) 162 | + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) 163 | + (value.width != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.width) : 0) 164 | + (value.height != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.height) : 0) 165 | + value.unknownFields().size(); 166 | } 167 | 168 | @Override 169 | public void encode(ProtoWriter writer, Layout value) throws IOException { 170 | if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); 171 | if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); 172 | if (value.width != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width); 173 | if (value.height != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height); 174 | writer.writeBytes(value.unknownFields()); 175 | } 176 | 177 | @Override 178 | public Layout decode(ProtoReader reader) throws IOException { 179 | Builder builder = new Builder(); 180 | long token = reader.beginMessage(); 181 | for (int tag; (tag = reader.nextTag()) != -1;) { 182 | switch (tag) { 183 | case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; 184 | case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; 185 | case 3: builder.width(ProtoAdapter.FLOAT.decode(reader)); break; 186 | case 4: builder.height(ProtoAdapter.FLOAT.decode(reader)); break; 187 | default: { 188 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 189 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 190 | builder.addUnknownField(tag, fieldEncoding, value); 191 | } 192 | } 193 | } 194 | reader.endMessage(token); 195 | return builder.build(); 196 | } 197 | 198 | @Override 199 | public Layout redact(Layout value) { 200 | Builder builder = value.newBuilder(); 201 | builder.clearUnknownFields(); 202 | return builder.build(); 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/MovieEntity.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 123:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Object; 14 | import java.lang.Override; 15 | import java.lang.String; 16 | import java.lang.StringBuilder; 17 | import java.util.List; 18 | import java.util.Map; 19 | import okio.ByteString; 20 | 21 | public final class MovieEntity extends Message { 22 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_MovieEntity(); 23 | 24 | private static final long serialVersionUID = 0L; 25 | 26 | public static final String DEFAULT_VERSION = ""; 27 | 28 | /** 29 | * SVGA 格式版本号 30 | */ 31 | @WireField( 32 | tag = 1, 33 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 34 | ) 35 | public final String version; 36 | 37 | /** 38 | * 动画参数 39 | */ 40 | @WireField( 41 | tag = 2, 42 | adapter = "com.opensource.svgaplayer.proto.MovieParams#ADAPTER" 43 | ) 44 | public final MovieParams params; 45 | 46 | /** 47 | * Key 是位图键名,Value 是位图文件名或二进制 PNG 数据。 48 | */ 49 | @WireField( 50 | tag = 3, 51 | keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", 52 | adapter = "com.squareup.wire.ProtoAdapter#BYTES" 53 | ) 54 | public final Map images; 55 | 56 | /** 57 | * 元素列表 58 | */ 59 | @WireField( 60 | tag = 4, 61 | adapter = "com.opensource.svgaplayer.proto.SpriteEntity#ADAPTER", 62 | label = WireField.Label.REPEATED 63 | ) 64 | public final List sprites; 65 | 66 | /** 67 | * 音频列表 68 | */ 69 | @WireField( 70 | tag = 5, 71 | adapter = "com.opensource.svgaplayer.proto.AudioEntity#ADAPTER", 72 | label = WireField.Label.REPEATED 73 | ) 74 | public final List audios; 75 | 76 | public MovieEntity(String version, MovieParams params, Map images, List sprites, List audios) { 77 | this(version, params, images, sprites, audios, ByteString.EMPTY); 78 | } 79 | 80 | public MovieEntity(String version, MovieParams params, Map images, List sprites, List audios, ByteString unknownFields) { 81 | super(ADAPTER, unknownFields); 82 | this.version = version; 83 | this.params = params; 84 | this.images = Internal.immutableCopyOf("images", images); 85 | this.sprites = Internal.immutableCopyOf("sprites", sprites); 86 | this.audios = Internal.immutableCopyOf("audios", audios); 87 | } 88 | 89 | @Override 90 | public Builder newBuilder() { 91 | Builder builder = new Builder(); 92 | builder.version = version; 93 | builder.params = params; 94 | builder.images = Internal.copyOf("images", images); 95 | builder.sprites = Internal.copyOf("sprites", sprites); 96 | builder.audios = Internal.copyOf("audios", audios); 97 | builder.addUnknownFields(unknownFields()); 98 | return builder; 99 | } 100 | 101 | @Override 102 | public boolean equals(Object other) { 103 | if (other == this) return true; 104 | if (!(other instanceof MovieEntity)) return false; 105 | MovieEntity o = (MovieEntity) other; 106 | return unknownFields().equals(o.unknownFields()) 107 | && Internal.equals(version, o.version) 108 | && Internal.equals(params, o.params) 109 | && images.equals(o.images) 110 | && sprites.equals(o.sprites) 111 | && audios.equals(o.audios); 112 | } 113 | 114 | @Override 115 | public int hashCode() { 116 | int result = super.hashCode; 117 | if (result == 0) { 118 | result = unknownFields().hashCode(); 119 | result = result * 37 + (version != null ? version.hashCode() : 0); 120 | result = result * 37 + (params != null ? params.hashCode() : 0); 121 | result = result * 37 + images.hashCode(); 122 | result = result * 37 + sprites.hashCode(); 123 | result = result * 37 + audios.hashCode(); 124 | super.hashCode = result; 125 | } 126 | return result; 127 | } 128 | 129 | @Override 130 | public String toString() { 131 | StringBuilder builder = new StringBuilder(); 132 | if (version != null) builder.append(", version=").append(version); 133 | if (params != null) builder.append(", params=").append(params); 134 | if (!images.isEmpty()) builder.append(", images=").append(images); 135 | if (!sprites.isEmpty()) builder.append(", sprites=").append(sprites); 136 | if (!audios.isEmpty()) builder.append(", audios=").append(audios); 137 | return builder.replace(0, 2, "MovieEntity{").append('}').toString(); 138 | } 139 | 140 | public static final class Builder extends Message.Builder { 141 | public String version; 142 | 143 | public MovieParams params; 144 | 145 | public Map images; 146 | 147 | public List sprites; 148 | 149 | public List audios; 150 | 151 | public Builder() { 152 | images = Internal.newMutableMap(); 153 | sprites = Internal.newMutableList(); 154 | audios = Internal.newMutableList(); 155 | } 156 | 157 | /** 158 | * SVGA 格式版本号 159 | */ 160 | public Builder version(String version) { 161 | this.version = version; 162 | return this; 163 | } 164 | 165 | /** 166 | * 动画参数 167 | */ 168 | public Builder params(MovieParams params) { 169 | this.params = params; 170 | return this; 171 | } 172 | 173 | /** 174 | * Key 是位图键名,Value 是位图文件名或二进制 PNG 数据。 175 | */ 176 | public Builder images(Map images) { 177 | Internal.checkElementsNotNull(images); 178 | this.images = images; 179 | return this; 180 | } 181 | 182 | /** 183 | * 元素列表 184 | */ 185 | public Builder sprites(List sprites) { 186 | Internal.checkElementsNotNull(sprites); 187 | this.sprites = sprites; 188 | return this; 189 | } 190 | 191 | /** 192 | * 音频列表 193 | */ 194 | public Builder audios(List audios) { 195 | Internal.checkElementsNotNull(audios); 196 | this.audios = audios; 197 | return this; 198 | } 199 | 200 | @Override 201 | public MovieEntity build() { 202 | return new MovieEntity(version, params, images, sprites, audios, super.buildUnknownFields()); 203 | } 204 | } 205 | 206 | private static final class ProtoAdapter_MovieEntity extends ProtoAdapter { 207 | private final ProtoAdapter> images = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.BYTES); 208 | 209 | ProtoAdapter_MovieEntity() { 210 | super(FieldEncoding.LENGTH_DELIMITED, MovieEntity.class); 211 | } 212 | 213 | @Override 214 | public int encodedSize(MovieEntity value) { 215 | return (value.version != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.version) : 0) 216 | + (value.params != null ? MovieParams.ADAPTER.encodedSizeWithTag(2, value.params) : 0) 217 | + images.encodedSizeWithTag(3, value.images) 218 | + SpriteEntity.ADAPTER.asRepeated().encodedSizeWithTag(4, value.sprites) 219 | + AudioEntity.ADAPTER.asRepeated().encodedSizeWithTag(5, value.audios) 220 | + value.unknownFields().size(); 221 | } 222 | 223 | @Override 224 | public void encode(ProtoWriter writer, MovieEntity value) throws IOException { 225 | if (value.version != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.version); 226 | if (value.params != null) MovieParams.ADAPTER.encodeWithTag(writer, 2, value.params); 227 | images.encodeWithTag(writer, 3, value.images); 228 | SpriteEntity.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.sprites); 229 | AudioEntity.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.audios); 230 | writer.writeBytes(value.unknownFields()); 231 | } 232 | 233 | @Override 234 | public MovieEntity decode(ProtoReader reader) throws IOException { 235 | Builder builder = new Builder(); 236 | long token = reader.beginMessage(); 237 | for (int tag; (tag = reader.nextTag()) != -1;) { 238 | switch (tag) { 239 | case 1: builder.version(ProtoAdapter.STRING.decode(reader)); break; 240 | case 2: builder.params(MovieParams.ADAPTER.decode(reader)); break; 241 | case 3: builder.images.putAll(images.decode(reader)); break; 242 | case 4: builder.sprites.add(SpriteEntity.ADAPTER.decode(reader)); break; 243 | case 5: builder.audios.add(AudioEntity.ADAPTER.decode(reader)); break; 244 | default: { 245 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 246 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 247 | builder.addUnknownField(tag, fieldEncoding, value); 248 | } 249 | } 250 | } 251 | reader.endMessage(token); 252 | return builder.build(); 253 | } 254 | 255 | @Override 256 | public MovieEntity redact(MovieEntity value) { 257 | Builder builder = value.newBuilder(); 258 | if (builder.params != null) builder.params = MovieParams.ADAPTER.redact(builder.params); 259 | Internal.redactElements(builder.sprites, SpriteEntity.ADAPTER); 260 | Internal.redactElements(builder.audios, AudioEntity.ADAPTER); 261 | builder.clearUnknownFields(); 262 | return builder.build(); 263 | } 264 | } 265 | } 266 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/MovieParams.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 6:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Float; 14 | import java.lang.Integer; 15 | import java.lang.Object; 16 | import java.lang.Override; 17 | import java.lang.String; 18 | import java.lang.StringBuilder; 19 | import okio.ByteString; 20 | 21 | public final class MovieParams extends Message { 22 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_MovieParams(); 23 | 24 | private static final long serialVersionUID = 0L; 25 | 26 | public static final Float DEFAULT_VIEWBOXWIDTH = 0.0f; 27 | 28 | public static final Float DEFAULT_VIEWBOXHEIGHT = 0.0f; 29 | 30 | public static final Integer DEFAULT_FPS = 0; 31 | 32 | public static final Integer DEFAULT_FRAMES = 0; 33 | 34 | /** 35 | * 画布宽 36 | */ 37 | @WireField( 38 | tag = 1, 39 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 40 | ) 41 | public final Float viewBoxWidth; 42 | 43 | /** 44 | * 画布高 45 | */ 46 | @WireField( 47 | tag = 2, 48 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 49 | ) 50 | public final Float viewBoxHeight; 51 | 52 | /** 53 | * 动画每秒播放帧数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 54 | */ 55 | @WireField( 56 | tag = 3, 57 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 58 | ) 59 | public final Integer fps; 60 | 61 | /** 62 | * 动画总帧数 63 | */ 64 | @WireField( 65 | tag = 4, 66 | adapter = "com.squareup.wire.ProtoAdapter#INT32" 67 | ) 68 | public final Integer frames; 69 | 70 | public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames) { 71 | this(viewBoxWidth, viewBoxHeight, fps, frames, ByteString.EMPTY); 72 | } 73 | 74 | public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames, ByteString unknownFields) { 75 | super(ADAPTER, unknownFields); 76 | this.viewBoxWidth = viewBoxWidth; 77 | this.viewBoxHeight = viewBoxHeight; 78 | this.fps = fps; 79 | this.frames = frames; 80 | } 81 | 82 | @Override 83 | public Builder newBuilder() { 84 | Builder builder = new Builder(); 85 | builder.viewBoxWidth = viewBoxWidth; 86 | builder.viewBoxHeight = viewBoxHeight; 87 | builder.fps = fps; 88 | builder.frames = frames; 89 | builder.addUnknownFields(unknownFields()); 90 | return builder; 91 | } 92 | 93 | @Override 94 | public boolean equals(Object other) { 95 | if (other == this) return true; 96 | if (!(other instanceof MovieParams)) return false; 97 | MovieParams o = (MovieParams) other; 98 | return unknownFields().equals(o.unknownFields()) 99 | && Internal.equals(viewBoxWidth, o.viewBoxWidth) 100 | && Internal.equals(viewBoxHeight, o.viewBoxHeight) 101 | && Internal.equals(fps, o.fps) 102 | && Internal.equals(frames, o.frames); 103 | } 104 | 105 | @Override 106 | public int hashCode() { 107 | int result = super.hashCode; 108 | if (result == 0) { 109 | result = unknownFields().hashCode(); 110 | result = result * 37 + (viewBoxWidth != null ? viewBoxWidth.hashCode() : 0); 111 | result = result * 37 + (viewBoxHeight != null ? viewBoxHeight.hashCode() : 0); 112 | result = result * 37 + (fps != null ? fps.hashCode() : 0); 113 | result = result * 37 + (frames != null ? frames.hashCode() : 0); 114 | super.hashCode = result; 115 | } 116 | return result; 117 | } 118 | 119 | @Override 120 | public String toString() { 121 | StringBuilder builder = new StringBuilder(); 122 | if (viewBoxWidth != null) builder.append(", viewBoxWidth=").append(viewBoxWidth); 123 | if (viewBoxHeight != null) builder.append(", viewBoxHeight=").append(viewBoxHeight); 124 | if (fps != null) builder.append(", fps=").append(fps); 125 | if (frames != null) builder.append(", frames=").append(frames); 126 | return builder.replace(0, 2, "MovieParams{").append('}').toString(); 127 | } 128 | 129 | public static final class Builder extends Message.Builder { 130 | public Float viewBoxWidth; 131 | 132 | public Float viewBoxHeight; 133 | 134 | public Integer fps; 135 | 136 | public Integer frames; 137 | 138 | public Builder() { 139 | } 140 | 141 | /** 142 | * 画布宽 143 | */ 144 | public Builder viewBoxWidth(Float viewBoxWidth) { 145 | this.viewBoxWidth = viewBoxWidth; 146 | return this; 147 | } 148 | 149 | /** 150 | * 画布高 151 | */ 152 | public Builder viewBoxHeight(Float viewBoxHeight) { 153 | this.viewBoxHeight = viewBoxHeight; 154 | return this; 155 | } 156 | 157 | /** 158 | * 动画每秒播放帧数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 159 | */ 160 | public Builder fps(Integer fps) { 161 | this.fps = fps; 162 | return this; 163 | } 164 | 165 | /** 166 | * 动画总帧数 167 | */ 168 | public Builder frames(Integer frames) { 169 | this.frames = frames; 170 | return this; 171 | } 172 | 173 | @Override 174 | public MovieParams build() { 175 | return new MovieParams(viewBoxWidth, viewBoxHeight, fps, frames, super.buildUnknownFields()); 176 | } 177 | } 178 | 179 | private static final class ProtoAdapter_MovieParams extends ProtoAdapter { 180 | ProtoAdapter_MovieParams() { 181 | super(FieldEncoding.LENGTH_DELIMITED, MovieParams.class); 182 | } 183 | 184 | @Override 185 | public int encodedSize(MovieParams value) { 186 | return (value.viewBoxWidth != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.viewBoxWidth) : 0) 187 | + (value.viewBoxHeight != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.viewBoxHeight) : 0) 188 | + (value.fps != null ? ProtoAdapter.INT32.encodedSizeWithTag(3, value.fps) : 0) 189 | + (value.frames != null ? ProtoAdapter.INT32.encodedSizeWithTag(4, value.frames) : 0) 190 | + value.unknownFields().size(); 191 | } 192 | 193 | @Override 194 | public void encode(ProtoWriter writer, MovieParams value) throws IOException { 195 | if (value.viewBoxWidth != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.viewBoxWidth); 196 | if (value.viewBoxHeight != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.viewBoxHeight); 197 | if (value.fps != null) ProtoAdapter.INT32.encodeWithTag(writer, 3, value.fps); 198 | if (value.frames != null) ProtoAdapter.INT32.encodeWithTag(writer, 4, value.frames); 199 | writer.writeBytes(value.unknownFields()); 200 | } 201 | 202 | @Override 203 | public MovieParams decode(ProtoReader reader) throws IOException { 204 | Builder builder = new Builder(); 205 | long token = reader.beginMessage(); 206 | for (int tag; (tag = reader.nextTag()) != -1;) { 207 | switch (tag) { 208 | case 1: builder.viewBoxWidth(ProtoAdapter.FLOAT.decode(reader)); break; 209 | case 2: builder.viewBoxHeight(ProtoAdapter.FLOAT.decode(reader)); break; 210 | case 3: builder.fps(ProtoAdapter.INT32.decode(reader)); break; 211 | case 4: builder.frames(ProtoAdapter.INT32.decode(reader)); break; 212 | default: { 213 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 214 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 215 | builder.addUnknownField(tag, fieldEncoding, value); 216 | } 217 | } 218 | } 219 | reader.endMessage(token); 220 | return builder.build(); 221 | } 222 | 223 | @Override 224 | public MovieParams redact(MovieParams value) { 225 | Builder builder = value.newBuilder(); 226 | builder.clearUnknownFields(); 227 | return builder.build(); 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/ShapeEntity.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 43:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireEnum; 11 | import com.squareup.wire.WireField; 12 | import com.squareup.wire.internal.Internal; 13 | import java.io.IOException; 14 | import java.lang.Float; 15 | import java.lang.Object; 16 | import java.lang.Override; 17 | import java.lang.String; 18 | import java.lang.StringBuilder; 19 | import okio.ByteString; 20 | 21 | public final class ShapeEntity extends Message { 22 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeEntity(); 23 | 24 | private static final long serialVersionUID = 0L; 25 | 26 | public static final ShapeType DEFAULT_TYPE = ShapeType.SHAPE; 27 | 28 | /** 29 | * 矢量类型 30 | */ 31 | @WireField( 32 | tag = 1, 33 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeType#ADAPTER" 34 | ) 35 | public final ShapeType type; 36 | 37 | /** 38 | * 矢量参数 39 | * 渲染参数 40 | */ 41 | @WireField( 42 | tag = 10, 43 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle#ADAPTER" 44 | ) 45 | public final ShapeStyle styles; 46 | 47 | /** 48 | * 矢量图层 2D 变换矩阵 49 | */ 50 | @WireField( 51 | tag = 11, 52 | adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER" 53 | ) 54 | public final Transform transform; 55 | 56 | @WireField( 57 | tag = 2, 58 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeArgs#ADAPTER" 59 | ) 60 | public final ShapeArgs shape; 61 | 62 | @WireField( 63 | tag = 3, 64 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$RectArgs#ADAPTER" 65 | ) 66 | public final RectArgs rect; 67 | 68 | @WireField( 69 | tag = 4, 70 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$EllipseArgs#ADAPTER" 71 | ) 72 | public final EllipseArgs ellipse; 73 | 74 | public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse) { 75 | this(type, styles, transform, shape, rect, ellipse, ByteString.EMPTY); 76 | } 77 | 78 | public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse, ByteString unknownFields) { 79 | super(ADAPTER, unknownFields); 80 | if (Internal.countNonNull(shape, rect, ellipse) > 1) { 81 | throw new IllegalArgumentException("at most one of shape, rect, ellipse may be non-null"); 82 | } 83 | this.type = type; 84 | this.styles = styles; 85 | this.transform = transform; 86 | this.shape = shape; 87 | this.rect = rect; 88 | this.ellipse = ellipse; 89 | } 90 | 91 | @Override 92 | public Builder newBuilder() { 93 | Builder builder = new Builder(); 94 | builder.type = type; 95 | builder.styles = styles; 96 | builder.transform = transform; 97 | builder.shape = shape; 98 | builder.rect = rect; 99 | builder.ellipse = ellipse; 100 | builder.addUnknownFields(unknownFields()); 101 | return builder; 102 | } 103 | 104 | @Override 105 | public boolean equals(Object other) { 106 | if (other == this) return true; 107 | if (!(other instanceof ShapeEntity)) return false; 108 | ShapeEntity o = (ShapeEntity) other; 109 | return unknownFields().equals(o.unknownFields()) 110 | && Internal.equals(type, o.type) 111 | && Internal.equals(styles, o.styles) 112 | && Internal.equals(transform, o.transform) 113 | && Internal.equals(shape, o.shape) 114 | && Internal.equals(rect, o.rect) 115 | && Internal.equals(ellipse, o.ellipse); 116 | } 117 | 118 | @Override 119 | public int hashCode() { 120 | int result = super.hashCode; 121 | if (result == 0) { 122 | result = unknownFields().hashCode(); 123 | result = result * 37 + (type != null ? type.hashCode() : 0); 124 | result = result * 37 + (styles != null ? styles.hashCode() : 0); 125 | result = result * 37 + (transform != null ? transform.hashCode() : 0); 126 | result = result * 37 + (shape != null ? shape.hashCode() : 0); 127 | result = result * 37 + (rect != null ? rect.hashCode() : 0); 128 | result = result * 37 + (ellipse != null ? ellipse.hashCode() : 0); 129 | super.hashCode = result; 130 | } 131 | return result; 132 | } 133 | 134 | @Override 135 | public String toString() { 136 | StringBuilder builder = new StringBuilder(); 137 | if (type != null) builder.append(", type=").append(type); 138 | if (styles != null) builder.append(", styles=").append(styles); 139 | if (transform != null) builder.append(", transform=").append(transform); 140 | if (shape != null) builder.append(", shape=").append(shape); 141 | if (rect != null) builder.append(", rect=").append(rect); 142 | if (ellipse != null) builder.append(", ellipse=").append(ellipse); 143 | return builder.replace(0, 2, "ShapeEntity{").append('}').toString(); 144 | } 145 | 146 | public static final class Builder extends Message.Builder { 147 | public ShapeType type; 148 | 149 | public ShapeStyle styles; 150 | 151 | public Transform transform; 152 | 153 | public ShapeArgs shape; 154 | 155 | public RectArgs rect; 156 | 157 | public EllipseArgs ellipse; 158 | 159 | public Builder() { 160 | } 161 | 162 | /** 163 | * 矢量类型 164 | */ 165 | public Builder type(ShapeType type) { 166 | this.type = type; 167 | return this; 168 | } 169 | 170 | /** 171 | * 矢量参数 172 | * 渲染参数 173 | */ 174 | public Builder styles(ShapeStyle styles) { 175 | this.styles = styles; 176 | return this; 177 | } 178 | 179 | /** 180 | * 矢量图层 2D 变换矩阵 181 | */ 182 | public Builder transform(Transform transform) { 183 | this.transform = transform; 184 | return this; 185 | } 186 | 187 | public Builder shape(ShapeArgs shape) { 188 | this.shape = shape; 189 | this.rect = null; 190 | this.ellipse = null; 191 | return this; 192 | } 193 | 194 | public Builder rect(RectArgs rect) { 195 | this.rect = rect; 196 | this.shape = null; 197 | this.ellipse = null; 198 | return this; 199 | } 200 | 201 | public Builder ellipse(EllipseArgs ellipse) { 202 | this.ellipse = ellipse; 203 | this.shape = null; 204 | this.rect = null; 205 | return this; 206 | } 207 | 208 | @Override 209 | public ShapeEntity build() { 210 | return new ShapeEntity(type, styles, transform, shape, rect, ellipse, super.buildUnknownFields()); 211 | } 212 | } 213 | 214 | public enum ShapeType implements WireEnum { 215 | /** 216 | * 路径 217 | */ 218 | SHAPE(0), 219 | 220 | /** 221 | * 矩形 222 | */ 223 | RECT(1), 224 | 225 | /** 226 | * 圆形 227 | */ 228 | ELLIPSE(2), 229 | 230 | /** 231 | * 与前帧一致 232 | */ 233 | KEEP(3); 234 | 235 | public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(ShapeType.class); 236 | 237 | private final int value; 238 | 239 | ShapeType(int value) { 240 | this.value = value; 241 | } 242 | 243 | /** 244 | * Return the constant for {@code value} or null. 245 | */ 246 | public static ShapeType fromValue(int value) { 247 | switch (value) { 248 | case 0: return SHAPE; 249 | case 1: return RECT; 250 | case 2: return ELLIPSE; 251 | case 3: return KEEP; 252 | default: return null; 253 | } 254 | } 255 | 256 | @Override 257 | public int getValue() { 258 | return value; 259 | } 260 | } 261 | 262 | public static final class ShapeArgs extends Message { 263 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeArgs(); 264 | 265 | private static final long serialVersionUID = 0L; 266 | 267 | public static final String DEFAULT_D = ""; 268 | 269 | /** 270 | * SVG 路径 271 | */ 272 | @WireField( 273 | tag = 1, 274 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 275 | ) 276 | public final String d; 277 | 278 | public ShapeArgs(String d) { 279 | this(d, ByteString.EMPTY); 280 | } 281 | 282 | public ShapeArgs(String d, ByteString unknownFields) { 283 | super(ADAPTER, unknownFields); 284 | this.d = d; 285 | } 286 | 287 | @Override 288 | public Builder newBuilder() { 289 | Builder builder = new Builder(); 290 | builder.d = d; 291 | builder.addUnknownFields(unknownFields()); 292 | return builder; 293 | } 294 | 295 | @Override 296 | public boolean equals(Object other) { 297 | if (other == this) return true; 298 | if (!(other instanceof ShapeArgs)) return false; 299 | ShapeArgs o = (ShapeArgs) other; 300 | return unknownFields().equals(o.unknownFields()) 301 | && Internal.equals(d, o.d); 302 | } 303 | 304 | @Override 305 | public int hashCode() { 306 | int result = super.hashCode; 307 | if (result == 0) { 308 | result = unknownFields().hashCode(); 309 | result = result * 37 + (d != null ? d.hashCode() : 0); 310 | super.hashCode = result; 311 | } 312 | return result; 313 | } 314 | 315 | @Override 316 | public String toString() { 317 | StringBuilder builder = new StringBuilder(); 318 | if (d != null) builder.append(", d=").append(d); 319 | return builder.replace(0, 2, "ShapeArgs{").append('}').toString(); 320 | } 321 | 322 | public static final class Builder extends Message.Builder { 323 | public String d; 324 | 325 | public Builder() { 326 | } 327 | 328 | /** 329 | * SVG 路径 330 | */ 331 | public Builder d(String d) { 332 | this.d = d; 333 | return this; 334 | } 335 | 336 | @Override 337 | public ShapeArgs build() { 338 | return new ShapeArgs(d, super.buildUnknownFields()); 339 | } 340 | } 341 | 342 | private static final class ProtoAdapter_ShapeArgs extends ProtoAdapter { 343 | ProtoAdapter_ShapeArgs() { 344 | super(FieldEncoding.LENGTH_DELIMITED, ShapeArgs.class); 345 | } 346 | 347 | @Override 348 | public int encodedSize(ShapeArgs value) { 349 | return (value.d != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.d) : 0) 350 | + value.unknownFields().size(); 351 | } 352 | 353 | @Override 354 | public void encode(ProtoWriter writer, ShapeArgs value) throws IOException { 355 | if (value.d != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.d); 356 | writer.writeBytes(value.unknownFields()); 357 | } 358 | 359 | @Override 360 | public ShapeArgs decode(ProtoReader reader) throws IOException { 361 | Builder builder = new Builder(); 362 | long token = reader.beginMessage(); 363 | for (int tag; (tag = reader.nextTag()) != -1;) { 364 | switch (tag) { 365 | case 1: builder.d(ProtoAdapter.STRING.decode(reader)); break; 366 | default: { 367 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 368 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 369 | builder.addUnknownField(tag, fieldEncoding, value); 370 | } 371 | } 372 | } 373 | reader.endMessage(token); 374 | return builder.build(); 375 | } 376 | 377 | @Override 378 | public ShapeArgs redact(ShapeArgs value) { 379 | Builder builder = value.newBuilder(); 380 | builder.clearUnknownFields(); 381 | return builder.build(); 382 | } 383 | } 384 | } 385 | 386 | public static final class RectArgs extends Message { 387 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_RectArgs(); 388 | 389 | private static final long serialVersionUID = 0L; 390 | 391 | public static final Float DEFAULT_X = 0.0f; 392 | 393 | public static final Float DEFAULT_Y = 0.0f; 394 | 395 | public static final Float DEFAULT_WIDTH = 0.0f; 396 | 397 | public static final Float DEFAULT_HEIGHT = 0.0f; 398 | 399 | public static final Float DEFAULT_CORNERRADIUS = 0.0f; 400 | 401 | @WireField( 402 | tag = 1, 403 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 404 | ) 405 | public final Float x; 406 | 407 | @WireField( 408 | tag = 2, 409 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 410 | ) 411 | public final Float y; 412 | 413 | @WireField( 414 | tag = 3, 415 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 416 | ) 417 | public final Float width; 418 | 419 | @WireField( 420 | tag = 4, 421 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 422 | ) 423 | public final Float height; 424 | 425 | /** 426 | * 圆角半径 427 | */ 428 | @WireField( 429 | tag = 5, 430 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 431 | ) 432 | public final Float cornerRadius; 433 | 434 | public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius) { 435 | this(x, y, width, height, cornerRadius, ByteString.EMPTY); 436 | } 437 | 438 | public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius, ByteString unknownFields) { 439 | super(ADAPTER, unknownFields); 440 | this.x = x; 441 | this.y = y; 442 | this.width = width; 443 | this.height = height; 444 | this.cornerRadius = cornerRadius; 445 | } 446 | 447 | @Override 448 | public Builder newBuilder() { 449 | Builder builder = new Builder(); 450 | builder.x = x; 451 | builder.y = y; 452 | builder.width = width; 453 | builder.height = height; 454 | builder.cornerRadius = cornerRadius; 455 | builder.addUnknownFields(unknownFields()); 456 | return builder; 457 | } 458 | 459 | @Override 460 | public boolean equals(Object other) { 461 | if (other == this) return true; 462 | if (!(other instanceof RectArgs)) return false; 463 | RectArgs o = (RectArgs) other; 464 | return unknownFields().equals(o.unknownFields()) 465 | && Internal.equals(x, o.x) 466 | && Internal.equals(y, o.y) 467 | && Internal.equals(width, o.width) 468 | && Internal.equals(height, o.height) 469 | && Internal.equals(cornerRadius, o.cornerRadius); 470 | } 471 | 472 | @Override 473 | public int hashCode() { 474 | int result = super.hashCode; 475 | if (result == 0) { 476 | result = unknownFields().hashCode(); 477 | result = result * 37 + (x != null ? x.hashCode() : 0); 478 | result = result * 37 + (y != null ? y.hashCode() : 0); 479 | result = result * 37 + (width != null ? width.hashCode() : 0); 480 | result = result * 37 + (height != null ? height.hashCode() : 0); 481 | result = result * 37 + (cornerRadius != null ? cornerRadius.hashCode() : 0); 482 | super.hashCode = result; 483 | } 484 | return result; 485 | } 486 | 487 | @Override 488 | public String toString() { 489 | StringBuilder builder = new StringBuilder(); 490 | if (x != null) builder.append(", x=").append(x); 491 | if (y != null) builder.append(", y=").append(y); 492 | if (width != null) builder.append(", width=").append(width); 493 | if (height != null) builder.append(", height=").append(height); 494 | if (cornerRadius != null) builder.append(", cornerRadius=").append(cornerRadius); 495 | return builder.replace(0, 2, "RectArgs{").append('}').toString(); 496 | } 497 | 498 | public static final class Builder extends Message.Builder { 499 | public Float x; 500 | 501 | public Float y; 502 | 503 | public Float width; 504 | 505 | public Float height; 506 | 507 | public Float cornerRadius; 508 | 509 | public Builder() { 510 | } 511 | 512 | public Builder x(Float x) { 513 | this.x = x; 514 | return this; 515 | } 516 | 517 | public Builder y(Float y) { 518 | this.y = y; 519 | return this; 520 | } 521 | 522 | public Builder width(Float width) { 523 | this.width = width; 524 | return this; 525 | } 526 | 527 | public Builder height(Float height) { 528 | this.height = height; 529 | return this; 530 | } 531 | 532 | /** 533 | * 圆角半径 534 | */ 535 | public Builder cornerRadius(Float cornerRadius) { 536 | this.cornerRadius = cornerRadius; 537 | return this; 538 | } 539 | 540 | @Override 541 | public RectArgs build() { 542 | return new RectArgs(x, y, width, height, cornerRadius, super.buildUnknownFields()); 543 | } 544 | } 545 | 546 | private static final class ProtoAdapter_RectArgs extends ProtoAdapter { 547 | ProtoAdapter_RectArgs() { 548 | super(FieldEncoding.LENGTH_DELIMITED, RectArgs.class); 549 | } 550 | 551 | @Override 552 | public int encodedSize(RectArgs value) { 553 | return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) 554 | + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) 555 | + (value.width != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.width) : 0) 556 | + (value.height != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.height) : 0) 557 | + (value.cornerRadius != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(5, value.cornerRadius) : 0) 558 | + value.unknownFields().size(); 559 | } 560 | 561 | @Override 562 | public void encode(ProtoWriter writer, RectArgs value) throws IOException { 563 | if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); 564 | if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); 565 | if (value.width != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width); 566 | if (value.height != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height); 567 | if (value.cornerRadius != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.cornerRadius); 568 | writer.writeBytes(value.unknownFields()); 569 | } 570 | 571 | @Override 572 | public RectArgs decode(ProtoReader reader) throws IOException { 573 | Builder builder = new Builder(); 574 | long token = reader.beginMessage(); 575 | for (int tag; (tag = reader.nextTag()) != -1;) { 576 | switch (tag) { 577 | case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; 578 | case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; 579 | case 3: builder.width(ProtoAdapter.FLOAT.decode(reader)); break; 580 | case 4: builder.height(ProtoAdapter.FLOAT.decode(reader)); break; 581 | case 5: builder.cornerRadius(ProtoAdapter.FLOAT.decode(reader)); break; 582 | default: { 583 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 584 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 585 | builder.addUnknownField(tag, fieldEncoding, value); 586 | } 587 | } 588 | } 589 | reader.endMessage(token); 590 | return builder.build(); 591 | } 592 | 593 | @Override 594 | public RectArgs redact(RectArgs value) { 595 | Builder builder = value.newBuilder(); 596 | builder.clearUnknownFields(); 597 | return builder.build(); 598 | } 599 | } 600 | } 601 | 602 | public static final class EllipseArgs extends Message { 603 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_EllipseArgs(); 604 | 605 | private static final long serialVersionUID = 0L; 606 | 607 | public static final Float DEFAULT_X = 0.0f; 608 | 609 | public static final Float DEFAULT_Y = 0.0f; 610 | 611 | public static final Float DEFAULT_RADIUSX = 0.0f; 612 | 613 | public static final Float DEFAULT_RADIUSY = 0.0f; 614 | 615 | /** 616 | * 圆中心点 X 617 | */ 618 | @WireField( 619 | tag = 1, 620 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 621 | ) 622 | public final Float x; 623 | 624 | /** 625 | * 圆中心点 Y 626 | */ 627 | @WireField( 628 | tag = 2, 629 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 630 | ) 631 | public final Float y; 632 | 633 | /** 634 | * 横向半径 635 | */ 636 | @WireField( 637 | tag = 3, 638 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 639 | ) 640 | public final Float radiusX; 641 | 642 | /** 643 | * 纵向半径 644 | */ 645 | @WireField( 646 | tag = 4, 647 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 648 | ) 649 | public final Float radiusY; 650 | 651 | public EllipseArgs(Float x, Float y, Float radiusX, Float radiusY) { 652 | this(x, y, radiusX, radiusY, ByteString.EMPTY); 653 | } 654 | 655 | public EllipseArgs(Float x, Float y, Float radiusX, Float radiusY, ByteString unknownFields) { 656 | super(ADAPTER, unknownFields); 657 | this.x = x; 658 | this.y = y; 659 | this.radiusX = radiusX; 660 | this.radiusY = radiusY; 661 | } 662 | 663 | @Override 664 | public Builder newBuilder() { 665 | Builder builder = new Builder(); 666 | builder.x = x; 667 | builder.y = y; 668 | builder.radiusX = radiusX; 669 | builder.radiusY = radiusY; 670 | builder.addUnknownFields(unknownFields()); 671 | return builder; 672 | } 673 | 674 | @Override 675 | public boolean equals(Object other) { 676 | if (other == this) return true; 677 | if (!(other instanceof EllipseArgs)) return false; 678 | EllipseArgs o = (EllipseArgs) other; 679 | return unknownFields().equals(o.unknownFields()) 680 | && Internal.equals(x, o.x) 681 | && Internal.equals(y, o.y) 682 | && Internal.equals(radiusX, o.radiusX) 683 | && Internal.equals(radiusY, o.radiusY); 684 | } 685 | 686 | @Override 687 | public int hashCode() { 688 | int result = super.hashCode; 689 | if (result == 0) { 690 | result = unknownFields().hashCode(); 691 | result = result * 37 + (x != null ? x.hashCode() : 0); 692 | result = result * 37 + (y != null ? y.hashCode() : 0); 693 | result = result * 37 + (radiusX != null ? radiusX.hashCode() : 0); 694 | result = result * 37 + (radiusY != null ? radiusY.hashCode() : 0); 695 | super.hashCode = result; 696 | } 697 | return result; 698 | } 699 | 700 | @Override 701 | public String toString() { 702 | StringBuilder builder = new StringBuilder(); 703 | if (x != null) builder.append(", x=").append(x); 704 | if (y != null) builder.append(", y=").append(y); 705 | if (radiusX != null) builder.append(", radiusX=").append(radiusX); 706 | if (radiusY != null) builder.append(", radiusY=").append(radiusY); 707 | return builder.replace(0, 2, "EllipseArgs{").append('}').toString(); 708 | } 709 | 710 | public static final class Builder extends Message.Builder { 711 | public Float x; 712 | 713 | public Float y; 714 | 715 | public Float radiusX; 716 | 717 | public Float radiusY; 718 | 719 | public Builder() { 720 | } 721 | 722 | /** 723 | * 圆中心点 X 724 | */ 725 | public Builder x(Float x) { 726 | this.x = x; 727 | return this; 728 | } 729 | 730 | /** 731 | * 圆中心点 Y 732 | */ 733 | public Builder y(Float y) { 734 | this.y = y; 735 | return this; 736 | } 737 | 738 | /** 739 | * 横向半径 740 | */ 741 | public Builder radiusX(Float radiusX) { 742 | this.radiusX = radiusX; 743 | return this; 744 | } 745 | 746 | /** 747 | * 纵向半径 748 | */ 749 | public Builder radiusY(Float radiusY) { 750 | this.radiusY = radiusY; 751 | return this; 752 | } 753 | 754 | @Override 755 | public EllipseArgs build() { 756 | return new EllipseArgs(x, y, radiusX, radiusY, super.buildUnknownFields()); 757 | } 758 | } 759 | 760 | private static final class ProtoAdapter_EllipseArgs extends ProtoAdapter { 761 | ProtoAdapter_EllipseArgs() { 762 | super(FieldEncoding.LENGTH_DELIMITED, EllipseArgs.class); 763 | } 764 | 765 | @Override 766 | public int encodedSize(EllipseArgs value) { 767 | return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) 768 | + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) 769 | + (value.radiusX != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.radiusX) : 0) 770 | + (value.radiusY != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.radiusY) : 0) 771 | + value.unknownFields().size(); 772 | } 773 | 774 | @Override 775 | public void encode(ProtoWriter writer, EllipseArgs value) throws IOException { 776 | if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); 777 | if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); 778 | if (value.radiusX != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.radiusX); 779 | if (value.radiusY != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.radiusY); 780 | writer.writeBytes(value.unknownFields()); 781 | } 782 | 783 | @Override 784 | public EllipseArgs decode(ProtoReader reader) throws IOException { 785 | Builder builder = new Builder(); 786 | long token = reader.beginMessage(); 787 | for (int tag; (tag = reader.nextTag()) != -1;) { 788 | switch (tag) { 789 | case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; 790 | case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; 791 | case 3: builder.radiusX(ProtoAdapter.FLOAT.decode(reader)); break; 792 | case 4: builder.radiusY(ProtoAdapter.FLOAT.decode(reader)); break; 793 | default: { 794 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 795 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 796 | builder.addUnknownField(tag, fieldEncoding, value); 797 | } 798 | } 799 | } 800 | reader.endMessage(token); 801 | return builder.build(); 802 | } 803 | 804 | @Override 805 | public EllipseArgs redact(EllipseArgs value) { 806 | Builder builder = value.newBuilder(); 807 | builder.clearUnknownFields(); 808 | return builder.build(); 809 | } 810 | } 811 | } 812 | 813 | public static final class ShapeStyle extends Message { 814 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeStyle(); 815 | 816 | private static final long serialVersionUID = 0L; 817 | 818 | public static final Float DEFAULT_STROKEWIDTH = 0.0f; 819 | 820 | public static final LineCap DEFAULT_LINECAP = LineCap.LineCap_BUTT; 821 | 822 | public static final LineJoin DEFAULT_LINEJOIN = LineJoin.LineJoin_MITER; 823 | 824 | public static final Float DEFAULT_MITERLIMIT = 0.0f; 825 | 826 | public static final Float DEFAULT_LINEDASHI = 0.0f; 827 | 828 | public static final Float DEFAULT_LINEDASHII = 0.0f; 829 | 830 | public static final Float DEFAULT_LINEDASHIII = 0.0f; 831 | 832 | /** 833 | * 填充色 834 | */ 835 | @WireField( 836 | tag = 1, 837 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$RGBAColor#ADAPTER" 838 | ) 839 | public final RGBAColor fill; 840 | 841 | /** 842 | * 描边色 843 | */ 844 | @WireField( 845 | tag = 2, 846 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$RGBAColor#ADAPTER" 847 | ) 848 | public final RGBAColor stroke; 849 | 850 | /** 851 | * 描边宽 852 | */ 853 | @WireField( 854 | tag = 3, 855 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 856 | ) 857 | public final Float strokeWidth; 858 | 859 | /** 860 | * 线段端点样式 861 | */ 862 | @WireField( 863 | tag = 4, 864 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$LineCap#ADAPTER" 865 | ) 866 | public final LineCap lineCap; 867 | 868 | /** 869 | * 线段连接样式 870 | */ 871 | @WireField( 872 | tag = 5, 873 | adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$LineJoin#ADAPTER" 874 | ) 875 | public final LineJoin lineJoin; 876 | 877 | /** 878 | * 尖角限制 879 | */ 880 | @WireField( 881 | tag = 6, 882 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 883 | ) 884 | public final Float miterLimit; 885 | 886 | /** 887 | * 虚线参数 Dash 888 | */ 889 | @WireField( 890 | tag = 7, 891 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 892 | ) 893 | public final Float lineDashI; 894 | 895 | /** 896 | * 虚线参数 Gap 897 | */ 898 | @WireField( 899 | tag = 8, 900 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 901 | ) 902 | public final Float lineDashII; 903 | 904 | /** 905 | * 虚线参数 Offset 906 | */ 907 | @WireField( 908 | tag = 9, 909 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 910 | ) 911 | public final Float lineDashIII; 912 | 913 | public ShapeStyle(RGBAColor fill, RGBAColor stroke, Float strokeWidth, LineCap lineCap, LineJoin lineJoin, Float miterLimit, Float lineDashI, Float lineDashII, Float lineDashIII) { 914 | this(fill, stroke, strokeWidth, lineCap, lineJoin, miterLimit, lineDashI, lineDashII, lineDashIII, ByteString.EMPTY); 915 | } 916 | 917 | public ShapeStyle(RGBAColor fill, RGBAColor stroke, Float strokeWidth, LineCap lineCap, LineJoin lineJoin, Float miterLimit, Float lineDashI, Float lineDashII, Float lineDashIII, ByteString unknownFields) { 918 | super(ADAPTER, unknownFields); 919 | this.fill = fill; 920 | this.stroke = stroke; 921 | this.strokeWidth = strokeWidth; 922 | this.lineCap = lineCap; 923 | this.lineJoin = lineJoin; 924 | this.miterLimit = miterLimit; 925 | this.lineDashI = lineDashI; 926 | this.lineDashII = lineDashII; 927 | this.lineDashIII = lineDashIII; 928 | } 929 | 930 | @Override 931 | public Builder newBuilder() { 932 | Builder builder = new Builder(); 933 | builder.fill = fill; 934 | builder.stroke = stroke; 935 | builder.strokeWidth = strokeWidth; 936 | builder.lineCap = lineCap; 937 | builder.lineJoin = lineJoin; 938 | builder.miterLimit = miterLimit; 939 | builder.lineDashI = lineDashI; 940 | builder.lineDashII = lineDashII; 941 | builder.lineDashIII = lineDashIII; 942 | builder.addUnknownFields(unknownFields()); 943 | return builder; 944 | } 945 | 946 | @Override 947 | public boolean equals(Object other) { 948 | if (other == this) return true; 949 | if (!(other instanceof ShapeStyle)) return false; 950 | ShapeStyle o = (ShapeStyle) other; 951 | return unknownFields().equals(o.unknownFields()) 952 | && Internal.equals(fill, o.fill) 953 | && Internal.equals(stroke, o.stroke) 954 | && Internal.equals(strokeWidth, o.strokeWidth) 955 | && Internal.equals(lineCap, o.lineCap) 956 | && Internal.equals(lineJoin, o.lineJoin) 957 | && Internal.equals(miterLimit, o.miterLimit) 958 | && Internal.equals(lineDashI, o.lineDashI) 959 | && Internal.equals(lineDashII, o.lineDashII) 960 | && Internal.equals(lineDashIII, o.lineDashIII); 961 | } 962 | 963 | @Override 964 | public int hashCode() { 965 | int result = super.hashCode; 966 | if (result == 0) { 967 | result = unknownFields().hashCode(); 968 | result = result * 37 + (fill != null ? fill.hashCode() : 0); 969 | result = result * 37 + (stroke != null ? stroke.hashCode() : 0); 970 | result = result * 37 + (strokeWidth != null ? strokeWidth.hashCode() : 0); 971 | result = result * 37 + (lineCap != null ? lineCap.hashCode() : 0); 972 | result = result * 37 + (lineJoin != null ? lineJoin.hashCode() : 0); 973 | result = result * 37 + (miterLimit != null ? miterLimit.hashCode() : 0); 974 | result = result * 37 + (lineDashI != null ? lineDashI.hashCode() : 0); 975 | result = result * 37 + (lineDashII != null ? lineDashII.hashCode() : 0); 976 | result = result * 37 + (lineDashIII != null ? lineDashIII.hashCode() : 0); 977 | super.hashCode = result; 978 | } 979 | return result; 980 | } 981 | 982 | @Override 983 | public String toString() { 984 | StringBuilder builder = new StringBuilder(); 985 | if (fill != null) builder.append(", fill=").append(fill); 986 | if (stroke != null) builder.append(", stroke=").append(stroke); 987 | if (strokeWidth != null) builder.append(", strokeWidth=").append(strokeWidth); 988 | if (lineCap != null) builder.append(", lineCap=").append(lineCap); 989 | if (lineJoin != null) builder.append(", lineJoin=").append(lineJoin); 990 | if (miterLimit != null) builder.append(", miterLimit=").append(miterLimit); 991 | if (lineDashI != null) builder.append(", lineDashI=").append(lineDashI); 992 | if (lineDashII != null) builder.append(", lineDashII=").append(lineDashII); 993 | if (lineDashIII != null) builder.append(", lineDashIII=").append(lineDashIII); 994 | return builder.replace(0, 2, "ShapeStyle{").append('}').toString(); 995 | } 996 | 997 | public static final class Builder extends Message.Builder { 998 | public RGBAColor fill; 999 | 1000 | public RGBAColor stroke; 1001 | 1002 | public Float strokeWidth; 1003 | 1004 | public LineCap lineCap; 1005 | 1006 | public LineJoin lineJoin; 1007 | 1008 | public Float miterLimit; 1009 | 1010 | public Float lineDashI; 1011 | 1012 | public Float lineDashII; 1013 | 1014 | public Float lineDashIII; 1015 | 1016 | public Builder() { 1017 | } 1018 | 1019 | /** 1020 | * 填充色 1021 | */ 1022 | public Builder fill(RGBAColor fill) { 1023 | this.fill = fill; 1024 | return this; 1025 | } 1026 | 1027 | /** 1028 | * 描边色 1029 | */ 1030 | public Builder stroke(RGBAColor stroke) { 1031 | this.stroke = stroke; 1032 | return this; 1033 | } 1034 | 1035 | /** 1036 | * 描边宽 1037 | */ 1038 | public Builder strokeWidth(Float strokeWidth) { 1039 | this.strokeWidth = strokeWidth; 1040 | return this; 1041 | } 1042 | 1043 | /** 1044 | * 线段端点样式 1045 | */ 1046 | public Builder lineCap(LineCap lineCap) { 1047 | this.lineCap = lineCap; 1048 | return this; 1049 | } 1050 | 1051 | /** 1052 | * 线段连接样式 1053 | */ 1054 | public Builder lineJoin(LineJoin lineJoin) { 1055 | this.lineJoin = lineJoin; 1056 | return this; 1057 | } 1058 | 1059 | /** 1060 | * 尖角限制 1061 | */ 1062 | public Builder miterLimit(Float miterLimit) { 1063 | this.miterLimit = miterLimit; 1064 | return this; 1065 | } 1066 | 1067 | /** 1068 | * 虚线参数 Dash 1069 | */ 1070 | public Builder lineDashI(Float lineDashI) { 1071 | this.lineDashI = lineDashI; 1072 | return this; 1073 | } 1074 | 1075 | /** 1076 | * 虚线参数 Gap 1077 | */ 1078 | public Builder lineDashII(Float lineDashII) { 1079 | this.lineDashII = lineDashII; 1080 | return this; 1081 | } 1082 | 1083 | /** 1084 | * 虚线参数 Offset 1085 | */ 1086 | public Builder lineDashIII(Float lineDashIII) { 1087 | this.lineDashIII = lineDashIII; 1088 | return this; 1089 | } 1090 | 1091 | @Override 1092 | public ShapeStyle build() { 1093 | return new ShapeStyle(fill, stroke, strokeWidth, lineCap, lineJoin, miterLimit, lineDashI, lineDashII, lineDashIII, super.buildUnknownFields()); 1094 | } 1095 | } 1096 | 1097 | public static final class RGBAColor extends Message { 1098 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_RGBAColor(); 1099 | 1100 | private static final long serialVersionUID = 0L; 1101 | 1102 | public static final Float DEFAULT_R = 0.0f; 1103 | 1104 | public static final Float DEFAULT_G = 0.0f; 1105 | 1106 | public static final Float DEFAULT_B = 0.0f; 1107 | 1108 | public static final Float DEFAULT_A = 0.0f; 1109 | 1110 | @WireField( 1111 | tag = 1, 1112 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 1113 | ) 1114 | public final Float r; 1115 | 1116 | @WireField( 1117 | tag = 2, 1118 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 1119 | ) 1120 | public final Float g; 1121 | 1122 | @WireField( 1123 | tag = 3, 1124 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 1125 | ) 1126 | public final Float b; 1127 | 1128 | @WireField( 1129 | tag = 4, 1130 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 1131 | ) 1132 | public final Float a; 1133 | 1134 | public RGBAColor(Float r, Float g, Float b, Float a) { 1135 | this(r, g, b, a, ByteString.EMPTY); 1136 | } 1137 | 1138 | public RGBAColor(Float r, Float g, Float b, Float a, ByteString unknownFields) { 1139 | super(ADAPTER, unknownFields); 1140 | this.r = r; 1141 | this.g = g; 1142 | this.b = b; 1143 | this.a = a; 1144 | } 1145 | 1146 | @Override 1147 | public Builder newBuilder() { 1148 | Builder builder = new Builder(); 1149 | builder.r = r; 1150 | builder.g = g; 1151 | builder.b = b; 1152 | builder.a = a; 1153 | builder.addUnknownFields(unknownFields()); 1154 | return builder; 1155 | } 1156 | 1157 | @Override 1158 | public boolean equals(Object other) { 1159 | if (other == this) return true; 1160 | if (!(other instanceof RGBAColor)) return false; 1161 | RGBAColor o = (RGBAColor) other; 1162 | return unknownFields().equals(o.unknownFields()) 1163 | && Internal.equals(r, o.r) 1164 | && Internal.equals(g, o.g) 1165 | && Internal.equals(b, o.b) 1166 | && Internal.equals(a, o.a); 1167 | } 1168 | 1169 | @Override 1170 | public int hashCode() { 1171 | int result = super.hashCode; 1172 | if (result == 0) { 1173 | result = unknownFields().hashCode(); 1174 | result = result * 37 + (r != null ? r.hashCode() : 0); 1175 | result = result * 37 + (g != null ? g.hashCode() : 0); 1176 | result = result * 37 + (b != null ? b.hashCode() : 0); 1177 | result = result * 37 + (a != null ? a.hashCode() : 0); 1178 | super.hashCode = result; 1179 | } 1180 | return result; 1181 | } 1182 | 1183 | @Override 1184 | public String toString() { 1185 | StringBuilder builder = new StringBuilder(); 1186 | if (r != null) builder.append(", r=").append(r); 1187 | if (g != null) builder.append(", g=").append(g); 1188 | if (b != null) builder.append(", b=").append(b); 1189 | if (a != null) builder.append(", a=").append(a); 1190 | return builder.replace(0, 2, "RGBAColor{").append('}').toString(); 1191 | } 1192 | 1193 | public static final class Builder extends Message.Builder { 1194 | public Float r; 1195 | 1196 | public Float g; 1197 | 1198 | public Float b; 1199 | 1200 | public Float a; 1201 | 1202 | public Builder() { 1203 | } 1204 | 1205 | public Builder r(Float r) { 1206 | this.r = r; 1207 | return this; 1208 | } 1209 | 1210 | public Builder g(Float g) { 1211 | this.g = g; 1212 | return this; 1213 | } 1214 | 1215 | public Builder b(Float b) { 1216 | this.b = b; 1217 | return this; 1218 | } 1219 | 1220 | public Builder a(Float a) { 1221 | this.a = a; 1222 | return this; 1223 | } 1224 | 1225 | @Override 1226 | public RGBAColor build() { 1227 | return new RGBAColor(r, g, b, a, super.buildUnknownFields()); 1228 | } 1229 | } 1230 | 1231 | private static final class ProtoAdapter_RGBAColor extends ProtoAdapter { 1232 | ProtoAdapter_RGBAColor() { 1233 | super(FieldEncoding.LENGTH_DELIMITED, RGBAColor.class); 1234 | } 1235 | 1236 | @Override 1237 | public int encodedSize(RGBAColor value) { 1238 | return (value.r != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.r) : 0) 1239 | + (value.g != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.g) : 0) 1240 | + (value.b != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.b) : 0) 1241 | + (value.a != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.a) : 0) 1242 | + value.unknownFields().size(); 1243 | } 1244 | 1245 | @Override 1246 | public void encode(ProtoWriter writer, RGBAColor value) throws IOException { 1247 | if (value.r != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.r); 1248 | if (value.g != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.g); 1249 | if (value.b != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.b); 1250 | if (value.a != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.a); 1251 | writer.writeBytes(value.unknownFields()); 1252 | } 1253 | 1254 | @Override 1255 | public RGBAColor decode(ProtoReader reader) throws IOException { 1256 | Builder builder = new Builder(); 1257 | long token = reader.beginMessage(); 1258 | for (int tag; (tag = reader.nextTag()) != -1;) { 1259 | switch (tag) { 1260 | case 1: builder.r(ProtoAdapter.FLOAT.decode(reader)); break; 1261 | case 2: builder.g(ProtoAdapter.FLOAT.decode(reader)); break; 1262 | case 3: builder.b(ProtoAdapter.FLOAT.decode(reader)); break; 1263 | case 4: builder.a(ProtoAdapter.FLOAT.decode(reader)); break; 1264 | default: { 1265 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 1266 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 1267 | builder.addUnknownField(tag, fieldEncoding, value); 1268 | } 1269 | } 1270 | } 1271 | reader.endMessage(token); 1272 | return builder.build(); 1273 | } 1274 | 1275 | @Override 1276 | public RGBAColor redact(RGBAColor value) { 1277 | Builder builder = value.newBuilder(); 1278 | builder.clearUnknownFields(); 1279 | return builder.build(); 1280 | } 1281 | } 1282 | } 1283 | 1284 | public enum LineCap implements WireEnum { 1285 | LineCap_BUTT(0), 1286 | 1287 | LineCap_ROUND(1), 1288 | 1289 | LineCap_SQUARE(2); 1290 | 1291 | public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(LineCap.class); 1292 | 1293 | private final int value; 1294 | 1295 | LineCap(int value) { 1296 | this.value = value; 1297 | } 1298 | 1299 | /** 1300 | * Return the constant for {@code value} or null. 1301 | */ 1302 | public static LineCap fromValue(int value) { 1303 | switch (value) { 1304 | case 0: return LineCap_BUTT; 1305 | case 1: return LineCap_ROUND; 1306 | case 2: return LineCap_SQUARE; 1307 | default: return null; 1308 | } 1309 | } 1310 | 1311 | @Override 1312 | public int getValue() { 1313 | return value; 1314 | } 1315 | } 1316 | 1317 | public enum LineJoin implements WireEnum { 1318 | LineJoin_MITER(0), 1319 | 1320 | LineJoin_ROUND(1), 1321 | 1322 | LineJoin_BEVEL(2); 1323 | 1324 | public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(LineJoin.class); 1325 | 1326 | private final int value; 1327 | 1328 | LineJoin(int value) { 1329 | this.value = value; 1330 | } 1331 | 1332 | /** 1333 | * Return the constant for {@code value} or null. 1334 | */ 1335 | public static LineJoin fromValue(int value) { 1336 | switch (value) { 1337 | case 0: return LineJoin_MITER; 1338 | case 1: return LineJoin_ROUND; 1339 | case 2: return LineJoin_BEVEL; 1340 | default: return null; 1341 | } 1342 | } 1343 | 1344 | @Override 1345 | public int getValue() { 1346 | return value; 1347 | } 1348 | } 1349 | 1350 | private static final class ProtoAdapter_ShapeStyle extends ProtoAdapter { 1351 | ProtoAdapter_ShapeStyle() { 1352 | super(FieldEncoding.LENGTH_DELIMITED, ShapeStyle.class); 1353 | } 1354 | 1355 | @Override 1356 | public int encodedSize(ShapeStyle value) { 1357 | return (value.fill != null ? RGBAColor.ADAPTER.encodedSizeWithTag(1, value.fill) : 0) 1358 | + (value.stroke != null ? RGBAColor.ADAPTER.encodedSizeWithTag(2, value.stroke) : 0) 1359 | + (value.strokeWidth != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.strokeWidth) : 0) 1360 | + (value.lineCap != null ? LineCap.ADAPTER.encodedSizeWithTag(4, value.lineCap) : 0) 1361 | + (value.lineJoin != null ? LineJoin.ADAPTER.encodedSizeWithTag(5, value.lineJoin) : 0) 1362 | + (value.miterLimit != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(6, value.miterLimit) : 0) 1363 | + (value.lineDashI != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(7, value.lineDashI) : 0) 1364 | + (value.lineDashII != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(8, value.lineDashII) : 0) 1365 | + (value.lineDashIII != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(9, value.lineDashIII) : 0) 1366 | + value.unknownFields().size(); 1367 | } 1368 | 1369 | @Override 1370 | public void encode(ProtoWriter writer, ShapeStyle value) throws IOException { 1371 | if (value.fill != null) RGBAColor.ADAPTER.encodeWithTag(writer, 1, value.fill); 1372 | if (value.stroke != null) RGBAColor.ADAPTER.encodeWithTag(writer, 2, value.stroke); 1373 | if (value.strokeWidth != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.strokeWidth); 1374 | if (value.lineCap != null) LineCap.ADAPTER.encodeWithTag(writer, 4, value.lineCap); 1375 | if (value.lineJoin != null) LineJoin.ADAPTER.encodeWithTag(writer, 5, value.lineJoin); 1376 | if (value.miterLimit != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.miterLimit); 1377 | if (value.lineDashI != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 7, value.lineDashI); 1378 | if (value.lineDashII != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 8, value.lineDashII); 1379 | if (value.lineDashIII != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 9, value.lineDashIII); 1380 | writer.writeBytes(value.unknownFields()); 1381 | } 1382 | 1383 | @Override 1384 | public ShapeStyle decode(ProtoReader reader) throws IOException { 1385 | Builder builder = new Builder(); 1386 | long token = reader.beginMessage(); 1387 | for (int tag; (tag = reader.nextTag()) != -1;) { 1388 | switch (tag) { 1389 | case 1: builder.fill(RGBAColor.ADAPTER.decode(reader)); break; 1390 | case 2: builder.stroke(RGBAColor.ADAPTER.decode(reader)); break; 1391 | case 3: builder.strokeWidth(ProtoAdapter.FLOAT.decode(reader)); break; 1392 | case 4: { 1393 | try { 1394 | builder.lineCap(LineCap.ADAPTER.decode(reader)); 1395 | } catch (ProtoAdapter.EnumConstantNotFoundException e) { 1396 | builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); 1397 | } 1398 | break; 1399 | } 1400 | case 5: { 1401 | try { 1402 | builder.lineJoin(LineJoin.ADAPTER.decode(reader)); 1403 | } catch (ProtoAdapter.EnumConstantNotFoundException e) { 1404 | builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); 1405 | } 1406 | break; 1407 | } 1408 | case 6: builder.miterLimit(ProtoAdapter.FLOAT.decode(reader)); break; 1409 | case 7: builder.lineDashI(ProtoAdapter.FLOAT.decode(reader)); break; 1410 | case 8: builder.lineDashII(ProtoAdapter.FLOAT.decode(reader)); break; 1411 | case 9: builder.lineDashIII(ProtoAdapter.FLOAT.decode(reader)); break; 1412 | default: { 1413 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 1414 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 1415 | builder.addUnknownField(tag, fieldEncoding, value); 1416 | } 1417 | } 1418 | } 1419 | reader.endMessage(token); 1420 | return builder.build(); 1421 | } 1422 | 1423 | @Override 1424 | public ShapeStyle redact(ShapeStyle value) { 1425 | Builder builder = value.newBuilder(); 1426 | if (builder.fill != null) builder.fill = RGBAColor.ADAPTER.redact(builder.fill); 1427 | if (builder.stroke != null) builder.stroke = RGBAColor.ADAPTER.redact(builder.stroke); 1428 | builder.clearUnknownFields(); 1429 | return builder.build(); 1430 | } 1431 | } 1432 | } 1433 | 1434 | private static final class ProtoAdapter_ShapeEntity extends ProtoAdapter { 1435 | ProtoAdapter_ShapeEntity() { 1436 | super(FieldEncoding.LENGTH_DELIMITED, ShapeEntity.class); 1437 | } 1438 | 1439 | @Override 1440 | public int encodedSize(ShapeEntity value) { 1441 | return (value.type != null ? ShapeType.ADAPTER.encodedSizeWithTag(1, value.type) : 0) 1442 | + (value.styles != null ? ShapeStyle.ADAPTER.encodedSizeWithTag(10, value.styles) : 0) 1443 | + (value.transform != null ? Transform.ADAPTER.encodedSizeWithTag(11, value.transform) : 0) 1444 | + (value.shape != null ? ShapeArgs.ADAPTER.encodedSizeWithTag(2, value.shape) : 0) 1445 | + (value.rect != null ? RectArgs.ADAPTER.encodedSizeWithTag(3, value.rect) : 0) 1446 | + (value.ellipse != null ? EllipseArgs.ADAPTER.encodedSizeWithTag(4, value.ellipse) : 0) 1447 | + value.unknownFields().size(); 1448 | } 1449 | 1450 | @Override 1451 | public void encode(ProtoWriter writer, ShapeEntity value) throws IOException { 1452 | if (value.type != null) ShapeType.ADAPTER.encodeWithTag(writer, 1, value.type); 1453 | if (value.styles != null) ShapeStyle.ADAPTER.encodeWithTag(writer, 10, value.styles); 1454 | if (value.transform != null) Transform.ADAPTER.encodeWithTag(writer, 11, value.transform); 1455 | if (value.shape != null) ShapeArgs.ADAPTER.encodeWithTag(writer, 2, value.shape); 1456 | if (value.rect != null) RectArgs.ADAPTER.encodeWithTag(writer, 3, value.rect); 1457 | if (value.ellipse != null) EllipseArgs.ADAPTER.encodeWithTag(writer, 4, value.ellipse); 1458 | writer.writeBytes(value.unknownFields()); 1459 | } 1460 | 1461 | @Override 1462 | public ShapeEntity decode(ProtoReader reader) throws IOException { 1463 | Builder builder = new Builder(); 1464 | long token = reader.beginMessage(); 1465 | for (int tag; (tag = reader.nextTag()) != -1;) { 1466 | switch (tag) { 1467 | case 1: { 1468 | try { 1469 | builder.type(ShapeType.ADAPTER.decode(reader)); 1470 | } catch (ProtoAdapter.EnumConstantNotFoundException e) { 1471 | builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); 1472 | } 1473 | break; 1474 | } 1475 | case 10: builder.styles(ShapeStyle.ADAPTER.decode(reader)); break; 1476 | case 11: builder.transform(Transform.ADAPTER.decode(reader)); break; 1477 | case 2: builder.shape(ShapeArgs.ADAPTER.decode(reader)); break; 1478 | case 3: builder.rect(RectArgs.ADAPTER.decode(reader)); break; 1479 | case 4: builder.ellipse(EllipseArgs.ADAPTER.decode(reader)); break; 1480 | default: { 1481 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 1482 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 1483 | builder.addUnknownField(tag, fieldEncoding, value); 1484 | } 1485 | } 1486 | } 1487 | reader.endMessage(token); 1488 | return builder.build(); 1489 | } 1490 | 1491 | @Override 1492 | public ShapeEntity redact(ShapeEntity value) { 1493 | Builder builder = value.newBuilder(); 1494 | if (builder.styles != null) builder.styles = ShapeStyle.ADAPTER.redact(builder.styles); 1495 | if (builder.transform != null) builder.transform = Transform.ADAPTER.redact(builder.transform); 1496 | if (builder.shape != null) builder.shape = ShapeArgs.ADAPTER.redact(builder.shape); 1497 | if (builder.rect != null) builder.rect = RectArgs.ADAPTER.redact(builder.rect); 1498 | if (builder.ellipse != null) builder.ellipse = EllipseArgs.ADAPTER.redact(builder.ellipse); 1499 | builder.clearUnknownFields(); 1500 | return builder.build(); 1501 | } 1502 | } 1503 | } 1504 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/SpriteEntity.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 13:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Object; 14 | import java.lang.Override; 15 | import java.lang.String; 16 | import java.lang.StringBuilder; 17 | import java.util.List; 18 | import okio.ByteString; 19 | 20 | public final class SpriteEntity extends Message { 21 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_SpriteEntity(); 22 | 23 | private static final long serialVersionUID = 0L; 24 | 25 | public static final String DEFAULT_IMAGEKEY = ""; 26 | 27 | public static final String DEFAULT_MATTEKEY = ""; 28 | 29 | /** 30 | * 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 31 | */ 32 | @WireField( 33 | tag = 1, 34 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 35 | ) 36 | public final String imageKey; 37 | 38 | /** 39 | * 帧列表 40 | */ 41 | @WireField( 42 | tag = 2, 43 | adapter = "com.opensource.svgaplayer.proto.FrameEntity#ADAPTER", 44 | label = WireField.Label.REPEATED 45 | ) 46 | public final List frames; 47 | 48 | /** 49 | * 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. 50 | */ 51 | @WireField( 52 | tag = 3, 53 | adapter = "com.squareup.wire.ProtoAdapter#STRING" 54 | ) 55 | public final String matteKey; 56 | 57 | public SpriteEntity(String imageKey, List frames, String matteKey) { 58 | this(imageKey, frames, matteKey, ByteString.EMPTY); 59 | } 60 | 61 | public SpriteEntity(String imageKey, List frames, String matteKey, ByteString unknownFields) { 62 | super(ADAPTER, unknownFields); 63 | this.imageKey = imageKey; 64 | this.frames = Internal.immutableCopyOf("frames", frames); 65 | this.matteKey = matteKey; 66 | } 67 | 68 | @Override 69 | public Builder newBuilder() { 70 | Builder builder = new Builder(); 71 | builder.imageKey = imageKey; 72 | builder.frames = Internal.copyOf("frames", frames); 73 | builder.matteKey = matteKey; 74 | builder.addUnknownFields(unknownFields()); 75 | return builder; 76 | } 77 | 78 | @Override 79 | public boolean equals(Object other) { 80 | if (other == this) return true; 81 | if (!(other instanceof SpriteEntity)) return false; 82 | SpriteEntity o = (SpriteEntity) other; 83 | return unknownFields().equals(o.unknownFields()) 84 | && Internal.equals(imageKey, o.imageKey) 85 | && frames.equals(o.frames) 86 | && Internal.equals(matteKey, o.matteKey); 87 | } 88 | 89 | @Override 90 | public int hashCode() { 91 | int result = super.hashCode; 92 | if (result == 0) { 93 | result = unknownFields().hashCode(); 94 | result = result * 37 + (imageKey != null ? imageKey.hashCode() : 0); 95 | result = result * 37 + frames.hashCode(); 96 | result = result * 37 + (matteKey != null ? matteKey.hashCode() : 0); 97 | super.hashCode = result; 98 | } 99 | return result; 100 | } 101 | 102 | @Override 103 | public String toString() { 104 | StringBuilder builder = new StringBuilder(); 105 | if (imageKey != null) builder.append(", imageKey=").append(imageKey); 106 | if (!frames.isEmpty()) builder.append(", frames=").append(frames); 107 | if (matteKey != null) builder.append(", matteKey=").append(matteKey); 108 | return builder.replace(0, 2, "SpriteEntity{").append('}').toString(); 109 | } 110 | 111 | public static final class Builder extends Message.Builder { 112 | public String imageKey; 113 | 114 | public List frames; 115 | 116 | public String matteKey; 117 | 118 | public Builder() { 119 | frames = Internal.newMutableList(); 120 | } 121 | 122 | /** 123 | * 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 124 | */ 125 | public Builder imageKey(String imageKey) { 126 | this.imageKey = imageKey; 127 | return this; 128 | } 129 | 130 | /** 131 | * 帧列表 132 | */ 133 | public Builder frames(List frames) { 134 | Internal.checkElementsNotNull(frames); 135 | this.frames = frames; 136 | return this; 137 | } 138 | 139 | /** 140 | * 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. 141 | */ 142 | public Builder matteKey(String matteKey) { 143 | this.matteKey = matteKey; 144 | return this; 145 | } 146 | 147 | @Override 148 | public SpriteEntity build() { 149 | return new SpriteEntity(imageKey, frames, matteKey, super.buildUnknownFields()); 150 | } 151 | } 152 | 153 | private static final class ProtoAdapter_SpriteEntity extends ProtoAdapter { 154 | ProtoAdapter_SpriteEntity() { 155 | super(FieldEncoding.LENGTH_DELIMITED, SpriteEntity.class); 156 | } 157 | 158 | @Override 159 | public int encodedSize(SpriteEntity value) { 160 | return (value.imageKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.imageKey) : 0) 161 | + FrameEntity.ADAPTER.asRepeated().encodedSizeWithTag(2, value.frames) 162 | + (value.matteKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(3, value.matteKey) : 0) 163 | + value.unknownFields().size(); 164 | } 165 | 166 | @Override 167 | public void encode(ProtoWriter writer, SpriteEntity value) throws IOException { 168 | if (value.imageKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.imageKey); 169 | FrameEntity.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.frames); 170 | if (value.matteKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 3, value.matteKey); 171 | writer.writeBytes(value.unknownFields()); 172 | } 173 | 174 | @Override 175 | public SpriteEntity decode(ProtoReader reader) throws IOException { 176 | Builder builder = new Builder(); 177 | long token = reader.beginMessage(); 178 | for (int tag; (tag = reader.nextTag()) != -1;) { 179 | switch (tag) { 180 | case 1: builder.imageKey(ProtoAdapter.STRING.decode(reader)); break; 181 | case 2: builder.frames.add(FrameEntity.ADAPTER.decode(reader)); break; 182 | case 3: builder.matteKey(ProtoAdapter.STRING.decode(reader)); break; 183 | default: { 184 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 185 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 186 | builder.addUnknownField(tag, fieldEncoding, value); 187 | } 188 | } 189 | } 190 | reader.endMessage(token); 191 | return builder.build(); 192 | } 193 | 194 | @Override 195 | public SpriteEntity redact(SpriteEntity value) { 196 | Builder builder = value.newBuilder(); 197 | Internal.redactElements(builder.frames, FrameEntity.ADAPTER); 198 | builder.clearUnknownFields(); 199 | return builder.build(); 200 | } 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /proto/wire220/com/opensource/svgaplayer/proto/Transform.java: -------------------------------------------------------------------------------- 1 | // Code generated by Wire protocol buffer compiler, do not edit. 2 | // Source file: svga.proto at 34:1 3 | package com.opensource.svgaplayer.proto; 4 | 5 | import com.squareup.wire.FieldEncoding; 6 | import com.squareup.wire.Message; 7 | import com.squareup.wire.ProtoAdapter; 8 | import com.squareup.wire.ProtoReader; 9 | import com.squareup.wire.ProtoWriter; 10 | import com.squareup.wire.WireField; 11 | import com.squareup.wire.internal.Internal; 12 | import java.io.IOException; 13 | import java.lang.Float; 14 | import java.lang.Object; 15 | import java.lang.Override; 16 | import java.lang.String; 17 | import java.lang.StringBuilder; 18 | import okio.ByteString; 19 | 20 | public final class Transform extends Message { 21 | public static final ProtoAdapter ADAPTER = new ProtoAdapter_Transform(); 22 | 23 | private static final long serialVersionUID = 0L; 24 | 25 | public static final Float DEFAULT_A = 0.0f; 26 | 27 | public static final Float DEFAULT_B = 0.0f; 28 | 29 | public static final Float DEFAULT_C = 0.0f; 30 | 31 | public static final Float DEFAULT_D = 0.0f; 32 | 33 | public static final Float DEFAULT_TX = 0.0f; 34 | 35 | public static final Float DEFAULT_TY = 0.0f; 36 | 37 | @WireField( 38 | tag = 1, 39 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 40 | ) 41 | public final Float a; 42 | 43 | @WireField( 44 | tag = 2, 45 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 46 | ) 47 | public final Float b; 48 | 49 | @WireField( 50 | tag = 3, 51 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 52 | ) 53 | public final Float c; 54 | 55 | @WireField( 56 | tag = 4, 57 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 58 | ) 59 | public final Float d; 60 | 61 | @WireField( 62 | tag = 5, 63 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 64 | ) 65 | public final Float tx; 66 | 67 | @WireField( 68 | tag = 6, 69 | adapter = "com.squareup.wire.ProtoAdapter#FLOAT" 70 | ) 71 | public final Float ty; 72 | 73 | public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty) { 74 | this(a, b, c, d, tx, ty, ByteString.EMPTY); 75 | } 76 | 77 | public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty, ByteString unknownFields) { 78 | super(ADAPTER, unknownFields); 79 | this.a = a; 80 | this.b = b; 81 | this.c = c; 82 | this.d = d; 83 | this.tx = tx; 84 | this.ty = ty; 85 | } 86 | 87 | @Override 88 | public Builder newBuilder() { 89 | Builder builder = new Builder(); 90 | builder.a = a; 91 | builder.b = b; 92 | builder.c = c; 93 | builder.d = d; 94 | builder.tx = tx; 95 | builder.ty = ty; 96 | builder.addUnknownFields(unknownFields()); 97 | return builder; 98 | } 99 | 100 | @Override 101 | public boolean equals(Object other) { 102 | if (other == this) return true; 103 | if (!(other instanceof Transform)) return false; 104 | Transform o = (Transform) other; 105 | return unknownFields().equals(o.unknownFields()) 106 | && Internal.equals(a, o.a) 107 | && Internal.equals(b, o.b) 108 | && Internal.equals(c, o.c) 109 | && Internal.equals(d, o.d) 110 | && Internal.equals(tx, o.tx) 111 | && Internal.equals(ty, o.ty); 112 | } 113 | 114 | @Override 115 | public int hashCode() { 116 | int result = super.hashCode; 117 | if (result == 0) { 118 | result = unknownFields().hashCode(); 119 | result = result * 37 + (a != null ? a.hashCode() : 0); 120 | result = result * 37 + (b != null ? b.hashCode() : 0); 121 | result = result * 37 + (c != null ? c.hashCode() : 0); 122 | result = result * 37 + (d != null ? d.hashCode() : 0); 123 | result = result * 37 + (tx != null ? tx.hashCode() : 0); 124 | result = result * 37 + (ty != null ? ty.hashCode() : 0); 125 | super.hashCode = result; 126 | } 127 | return result; 128 | } 129 | 130 | @Override 131 | public String toString() { 132 | StringBuilder builder = new StringBuilder(); 133 | if (a != null) builder.append(", a=").append(a); 134 | if (b != null) builder.append(", b=").append(b); 135 | if (c != null) builder.append(", c=").append(c); 136 | if (d != null) builder.append(", d=").append(d); 137 | if (tx != null) builder.append(", tx=").append(tx); 138 | if (ty != null) builder.append(", ty=").append(ty); 139 | return builder.replace(0, 2, "Transform{").append('}').toString(); 140 | } 141 | 142 | public static final class Builder extends Message.Builder { 143 | public Float a; 144 | 145 | public Float b; 146 | 147 | public Float c; 148 | 149 | public Float d; 150 | 151 | public Float tx; 152 | 153 | public Float ty; 154 | 155 | public Builder() { 156 | } 157 | 158 | public Builder a(Float a) { 159 | this.a = a; 160 | return this; 161 | } 162 | 163 | public Builder b(Float b) { 164 | this.b = b; 165 | return this; 166 | } 167 | 168 | public Builder c(Float c) { 169 | this.c = c; 170 | return this; 171 | } 172 | 173 | public Builder d(Float d) { 174 | this.d = d; 175 | return this; 176 | } 177 | 178 | public Builder tx(Float tx) { 179 | this.tx = tx; 180 | return this; 181 | } 182 | 183 | public Builder ty(Float ty) { 184 | this.ty = ty; 185 | return this; 186 | } 187 | 188 | @Override 189 | public Transform build() { 190 | return new Transform(a, b, c, d, tx, ty, super.buildUnknownFields()); 191 | } 192 | } 193 | 194 | private static final class ProtoAdapter_Transform extends ProtoAdapter { 195 | ProtoAdapter_Transform() { 196 | super(FieldEncoding.LENGTH_DELIMITED, Transform.class); 197 | } 198 | 199 | @Override 200 | public int encodedSize(Transform value) { 201 | return (value.a != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.a) : 0) 202 | + (value.b != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.b) : 0) 203 | + (value.c != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.c) : 0) 204 | + (value.d != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.d) : 0) 205 | + (value.tx != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(5, value.tx) : 0) 206 | + (value.ty != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(6, value.ty) : 0) 207 | + value.unknownFields().size(); 208 | } 209 | 210 | @Override 211 | public void encode(ProtoWriter writer, Transform value) throws IOException { 212 | if (value.a != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.a); 213 | if (value.b != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.b); 214 | if (value.c != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.c); 215 | if (value.d != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.d); 216 | if (value.tx != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.tx); 217 | if (value.ty != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.ty); 218 | writer.writeBytes(value.unknownFields()); 219 | } 220 | 221 | @Override 222 | public Transform decode(ProtoReader reader) throws IOException { 223 | Builder builder = new Builder(); 224 | long token = reader.beginMessage(); 225 | for (int tag; (tag = reader.nextTag()) != -1;) { 226 | switch (tag) { 227 | case 1: builder.a(ProtoAdapter.FLOAT.decode(reader)); break; 228 | case 2: builder.b(ProtoAdapter.FLOAT.decode(reader)); break; 229 | case 3: builder.c(ProtoAdapter.FLOAT.decode(reader)); break; 230 | case 4: builder.d(ProtoAdapter.FLOAT.decode(reader)); break; 231 | case 5: builder.tx(ProtoAdapter.FLOAT.decode(reader)); break; 232 | case 6: builder.ty(ProtoAdapter.FLOAT.decode(reader)); break; 233 | default: { 234 | FieldEncoding fieldEncoding = reader.peekFieldEncoding(); 235 | Object value = fieldEncoding.rawProtoAdapter().decode(reader); 236 | builder.addUnknownField(tag, fieldEncoding, value); 237 | } 238 | } 239 | } 240 | reader.endMessage(token); 241 | return builder.build(); 242 | } 243 | 244 | @Override 245 | public Transform redact(Transform value) { 246 | Builder builder = value.newBuilder(); 247 | builder.clearUnknownFields(); 248 | return builder.build(); 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # SVGA-Format 2 | 3 | ## 介绍 4 | 5 | * SVGA 是一种动画格式 6 | * SVGA 类似于 Dragonbones / CreateJS 7 | 8 | ## 格式规范 9 | 10 | ### 1.x 11 | 12 | 1.x 使用 JSON 描述动画,JSON 是一种易于扩展的、强大的描述语言,但是,JSON 也有一个致命的缺点,当动画极度复杂时,JSON 文件会变得非常大,解析耗时以及内存开销会增大。 13 | 14 | 因此,JSON 方案已于 2.0 开始,被弃用。 15 | 16 | 点此了解 [1.x 的格式规范](JSON/readme.md) 17 | 18 | ### 2.x 19 | 20 | 2.x 使用 ProtoBuf 描述动画,相关的 [Proto 协议可以在此获取](proto/svga.proto) 21 | 22 | 2.x SVGA 文件是使用 ProtoBuf 编写的二进制文件,并使用 zlib 压缩后得到。 23 | 24 | ## Player 规范 25 | 26 | ### 2.0.0 27 | 28 | 2.0.0 的 Player 理应播放 2.x 的格式文件,并向下兼容 1.x 格式文件。 29 | 30 | ### 1.x 31 | 32 | 1.x 的 Player 只能播放 1.x 的格式文件,不能播放 2.x 的格式文件。 33 | 34 | ## Roadmap 35 | 36 | ## 2.0.0 37 | 38 | * Audio feature 39 | * Bitmap Mask support 40 | 41 | ## 1.x 42 | 43 | * 只保证稳定性 44 | --------------------------------------------------------------------------------