939 |
939 |
940 ) |
940 ) |
941 |
941 |
942 _STYLE = """""" |
942 _STYLE = """""" |
943 _STYLE_CONTENT_TYPE = """""" |
943 _STYLE_CONTENT_TYPE = """""" |
944 |
944 class CompositeImageOptions(ProtocolBuffer.ProtocolMessage): |
945 __all__ = ['ImagesServiceError','ImagesServiceTransform','Transform','ImageData','OutputSettings','ImagesTransformRequest','ImagesTransformResponse'] |
945 |
|
946 TOP_LEFT = 0 |
|
947 TOP = 1 |
|
948 TOP_RIGHT = 2 |
|
949 LEFT = 3 |
|
950 CENTER = 4 |
|
951 RIGHT = 5 |
|
952 BOTTOM_LEFT = 6 |
|
953 BOTTOM = 7 |
|
954 BOTTOM_RIGHT = 8 |
|
955 |
|
956 _ANCHOR_NAMES = { |
|
957 0: "TOP_LEFT", |
|
958 1: "TOP", |
|
959 2: "TOP_RIGHT", |
|
960 3: "LEFT", |
|
961 4: "CENTER", |
|
962 5: "RIGHT", |
|
963 6: "BOTTOM_LEFT", |
|
964 7: "BOTTOM", |
|
965 8: "BOTTOM_RIGHT", |
|
966 } |
|
967 |
|
968 def ANCHOR_Name(cls, x): return cls._ANCHOR_NAMES.get(x, "") |
|
969 ANCHOR_Name = classmethod(ANCHOR_Name) |
|
970 |
|
971 has_source_index_ = 0 |
|
972 source_index_ = 0 |
|
973 has_x_offset_ = 0 |
|
974 x_offset_ = 0 |
|
975 has_y_offset_ = 0 |
|
976 y_offset_ = 0 |
|
977 has_opacity_ = 0 |
|
978 opacity_ = 0.0 |
|
979 has_anchor_ = 0 |
|
980 anchor_ = 0 |
|
981 |
|
982 def __init__(self, contents=None): |
|
983 if contents is not None: self.MergeFromString(contents) |
|
984 |
|
985 def source_index(self): return self.source_index_ |
|
986 |
|
987 def set_source_index(self, x): |
|
988 self.has_source_index_ = 1 |
|
989 self.source_index_ = x |
|
990 |
|
991 def clear_source_index(self): |
|
992 if self.has_source_index_: |
|
993 self.has_source_index_ = 0 |
|
994 self.source_index_ = 0 |
|
995 |
|
996 def has_source_index(self): return self.has_source_index_ |
|
997 |
|
998 def x_offset(self): return self.x_offset_ |
|
999 |
|
1000 def set_x_offset(self, x): |
|
1001 self.has_x_offset_ = 1 |
|
1002 self.x_offset_ = x |
|
1003 |
|
1004 def clear_x_offset(self): |
|
1005 if self.has_x_offset_: |
|
1006 self.has_x_offset_ = 0 |
|
1007 self.x_offset_ = 0 |
|
1008 |
|
1009 def has_x_offset(self): return self.has_x_offset_ |
|
1010 |
|
1011 def y_offset(self): return self.y_offset_ |
|
1012 |
|
1013 def set_y_offset(self, x): |
|
1014 self.has_y_offset_ = 1 |
|
1015 self.y_offset_ = x |
|
1016 |
|
1017 def clear_y_offset(self): |
|
1018 if self.has_y_offset_: |
|
1019 self.has_y_offset_ = 0 |
|
1020 self.y_offset_ = 0 |
|
1021 |
|
1022 def has_y_offset(self): return self.has_y_offset_ |
|
1023 |
|
1024 def opacity(self): return self.opacity_ |
|
1025 |
|
1026 def set_opacity(self, x): |
|
1027 self.has_opacity_ = 1 |
|
1028 self.opacity_ = x |
|
1029 |
|
1030 def clear_opacity(self): |
|
1031 if self.has_opacity_: |
|
1032 self.has_opacity_ = 0 |
|
1033 self.opacity_ = 0.0 |
|
1034 |
|
1035 def has_opacity(self): return self.has_opacity_ |
|
1036 |
|
1037 def anchor(self): return self.anchor_ |
|
1038 |
|
1039 def set_anchor(self, x): |
|
1040 self.has_anchor_ = 1 |
|
1041 self.anchor_ = x |
|
1042 |
|
1043 def clear_anchor(self): |
|
1044 if self.has_anchor_: |
|
1045 self.has_anchor_ = 0 |
|
1046 self.anchor_ = 0 |
|
1047 |
|
1048 def has_anchor(self): return self.has_anchor_ |
|
1049 |
|
1050 |
|
1051 def MergeFrom(self, x): |
|
1052 assert x is not self |
|
1053 if (x.has_source_index()): self.set_source_index(x.source_index()) |
|
1054 if (x.has_x_offset()): self.set_x_offset(x.x_offset()) |
|
1055 if (x.has_y_offset()): self.set_y_offset(x.y_offset()) |
|
1056 if (x.has_opacity()): self.set_opacity(x.opacity()) |
|
1057 if (x.has_anchor()): self.set_anchor(x.anchor()) |
|
1058 |
|
1059 def Equals(self, x): |
|
1060 if x is self: return 1 |
|
1061 if self.has_source_index_ != x.has_source_index_: return 0 |
|
1062 if self.has_source_index_ and self.source_index_ != x.source_index_: return 0 |
|
1063 if self.has_x_offset_ != x.has_x_offset_: return 0 |
|
1064 if self.has_x_offset_ and self.x_offset_ != x.x_offset_: return 0 |
|
1065 if self.has_y_offset_ != x.has_y_offset_: return 0 |
|
1066 if self.has_y_offset_ and self.y_offset_ != x.y_offset_: return 0 |
|
1067 if self.has_opacity_ != x.has_opacity_: return 0 |
|
1068 if self.has_opacity_ and self.opacity_ != x.opacity_: return 0 |
|
1069 if self.has_anchor_ != x.has_anchor_: return 0 |
|
1070 if self.has_anchor_ and self.anchor_ != x.anchor_: return 0 |
|
1071 return 1 |
|
1072 |
|
1073 def IsInitialized(self, debug_strs=None): |
|
1074 initialized = 1 |
|
1075 if (not self.has_source_index_): |
|
1076 initialized = 0 |
|
1077 if debug_strs is not None: |
|
1078 debug_strs.append('Required field: source_index not set.') |
|
1079 if (not self.has_x_offset_): |
|
1080 initialized = 0 |
|
1081 if debug_strs is not None: |
|
1082 debug_strs.append('Required field: x_offset not set.') |
|
1083 if (not self.has_y_offset_): |
|
1084 initialized = 0 |
|
1085 if debug_strs is not None: |
|
1086 debug_strs.append('Required field: y_offset not set.') |
|
1087 if (not self.has_opacity_): |
|
1088 initialized = 0 |
|
1089 if debug_strs is not None: |
|
1090 debug_strs.append('Required field: opacity not set.') |
|
1091 if (not self.has_anchor_): |
|
1092 initialized = 0 |
|
1093 if debug_strs is not None: |
|
1094 debug_strs.append('Required field: anchor not set.') |
|
1095 return initialized |
|
1096 |
|
1097 def ByteSize(self): |
|
1098 n = 0 |
|
1099 n += self.lengthVarInt64(self.source_index_) |
|
1100 n += self.lengthVarInt64(self.x_offset_) |
|
1101 n += self.lengthVarInt64(self.y_offset_) |
|
1102 n += self.lengthVarInt64(self.anchor_) |
|
1103 return n + 9 |
|
1104 |
|
1105 def Clear(self): |
|
1106 self.clear_source_index() |
|
1107 self.clear_x_offset() |
|
1108 self.clear_y_offset() |
|
1109 self.clear_opacity() |
|
1110 self.clear_anchor() |
|
1111 |
|
1112 def OutputUnchecked(self, out): |
|
1113 out.putVarInt32(8) |
|
1114 out.putVarInt32(self.source_index_) |
|
1115 out.putVarInt32(16) |
|
1116 out.putVarInt32(self.x_offset_) |
|
1117 out.putVarInt32(24) |
|
1118 out.putVarInt32(self.y_offset_) |
|
1119 out.putVarInt32(37) |
|
1120 out.putFloat(self.opacity_) |
|
1121 out.putVarInt32(40) |
|
1122 out.putVarInt32(self.anchor_) |
|
1123 |
|
1124 def TryMerge(self, d): |
|
1125 while d.avail() > 0: |
|
1126 tt = d.getVarInt32() |
|
1127 if tt == 8: |
|
1128 self.set_source_index(d.getVarInt32()) |
|
1129 continue |
|
1130 if tt == 16: |
|
1131 self.set_x_offset(d.getVarInt32()) |
|
1132 continue |
|
1133 if tt == 24: |
|
1134 self.set_y_offset(d.getVarInt32()) |
|
1135 continue |
|
1136 if tt == 37: |
|
1137 self.set_opacity(d.getFloat()) |
|
1138 continue |
|
1139 if tt == 40: |
|
1140 self.set_anchor(d.getVarInt32()) |
|
1141 continue |
|
1142 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1143 d.skipData(tt) |
|
1144 |
|
1145 |
|
1146 def __str__(self, prefix="", printElemNumber=0): |
|
1147 res="" |
|
1148 if self.has_source_index_: res+=prefix+("source_index: %s\n" % self.DebugFormatInt32(self.source_index_)) |
|
1149 if self.has_x_offset_: res+=prefix+("x_offset: %s\n" % self.DebugFormatInt32(self.x_offset_)) |
|
1150 if self.has_y_offset_: res+=prefix+("y_offset: %s\n" % self.DebugFormatInt32(self.y_offset_)) |
|
1151 if self.has_opacity_: res+=prefix+("opacity: %s\n" % self.DebugFormatFloat(self.opacity_)) |
|
1152 if self.has_anchor_: res+=prefix+("anchor: %s\n" % self.DebugFormatInt32(self.anchor_)) |
|
1153 return res |
|
1154 |
|
1155 ksource_index = 1 |
|
1156 kx_offset = 2 |
|
1157 ky_offset = 3 |
|
1158 kopacity = 4 |
|
1159 kanchor = 5 |
|
1160 |
|
1161 _TEXT = ( |
|
1162 "ErrorCode", |
|
1163 "source_index", |
|
1164 "x_offset", |
|
1165 "y_offset", |
|
1166 "opacity", |
|
1167 "anchor", |
|
1168 ) |
|
1169 |
|
1170 _TYPES = ( |
|
1171 ProtocolBuffer.Encoder.NUMERIC, |
|
1172 ProtocolBuffer.Encoder.NUMERIC, |
|
1173 |
|
1174 ProtocolBuffer.Encoder.NUMERIC, |
|
1175 |
|
1176 ProtocolBuffer.Encoder.NUMERIC, |
|
1177 |
|
1178 ProtocolBuffer.Encoder.FLOAT, |
|
1179 |
|
1180 ProtocolBuffer.Encoder.NUMERIC, |
|
1181 |
|
1182 ) |
|
1183 |
|
1184 _STYLE = """""" |
|
1185 _STYLE_CONTENT_TYPE = """""" |
|
1186 class ImagesCanvas(ProtocolBuffer.ProtocolMessage): |
|
1187 has_width_ = 0 |
|
1188 width_ = 0 |
|
1189 has_height_ = 0 |
|
1190 height_ = 0 |
|
1191 has_output_ = 0 |
|
1192 has_color_ = 0 |
|
1193 color_ = -1 |
|
1194 |
|
1195 def __init__(self, contents=None): |
|
1196 self.output_ = OutputSettings() |
|
1197 if contents is not None: self.MergeFromString(contents) |
|
1198 |
|
1199 def width(self): return self.width_ |
|
1200 |
|
1201 def set_width(self, x): |
|
1202 self.has_width_ = 1 |
|
1203 self.width_ = x |
|
1204 |
|
1205 def clear_width(self): |
|
1206 if self.has_width_: |
|
1207 self.has_width_ = 0 |
|
1208 self.width_ = 0 |
|
1209 |
|
1210 def has_width(self): return self.has_width_ |
|
1211 |
|
1212 def height(self): return self.height_ |
|
1213 |
|
1214 def set_height(self, x): |
|
1215 self.has_height_ = 1 |
|
1216 self.height_ = x |
|
1217 |
|
1218 def clear_height(self): |
|
1219 if self.has_height_: |
|
1220 self.has_height_ = 0 |
|
1221 self.height_ = 0 |
|
1222 |
|
1223 def has_height(self): return self.has_height_ |
|
1224 |
|
1225 def output(self): return self.output_ |
|
1226 |
|
1227 def mutable_output(self): self.has_output_ = 1; return self.output_ |
|
1228 |
|
1229 def clear_output(self):self.has_output_ = 0; self.output_.Clear() |
|
1230 |
|
1231 def has_output(self): return self.has_output_ |
|
1232 |
|
1233 def color(self): return self.color_ |
|
1234 |
|
1235 def set_color(self, x): |
|
1236 self.has_color_ = 1 |
|
1237 self.color_ = x |
|
1238 |
|
1239 def clear_color(self): |
|
1240 if self.has_color_: |
|
1241 self.has_color_ = 0 |
|
1242 self.color_ = -1 |
|
1243 |
|
1244 def has_color(self): return self.has_color_ |
|
1245 |
|
1246 |
|
1247 def MergeFrom(self, x): |
|
1248 assert x is not self |
|
1249 if (x.has_width()): self.set_width(x.width()) |
|
1250 if (x.has_height()): self.set_height(x.height()) |
|
1251 if (x.has_output()): self.mutable_output().MergeFrom(x.output()) |
|
1252 if (x.has_color()): self.set_color(x.color()) |
|
1253 |
|
1254 def Equals(self, x): |
|
1255 if x is self: return 1 |
|
1256 if self.has_width_ != x.has_width_: return 0 |
|
1257 if self.has_width_ and self.width_ != x.width_: return 0 |
|
1258 if self.has_height_ != x.has_height_: return 0 |
|
1259 if self.has_height_ and self.height_ != x.height_: return 0 |
|
1260 if self.has_output_ != x.has_output_: return 0 |
|
1261 if self.has_output_ and self.output_ != x.output_: return 0 |
|
1262 if self.has_color_ != x.has_color_: return 0 |
|
1263 if self.has_color_ and self.color_ != x.color_: return 0 |
|
1264 return 1 |
|
1265 |
|
1266 def IsInitialized(self, debug_strs=None): |
|
1267 initialized = 1 |
|
1268 if (not self.has_width_): |
|
1269 initialized = 0 |
|
1270 if debug_strs is not None: |
|
1271 debug_strs.append('Required field: width not set.') |
|
1272 if (not self.has_height_): |
|
1273 initialized = 0 |
|
1274 if debug_strs is not None: |
|
1275 debug_strs.append('Required field: height not set.') |
|
1276 if (not self.has_output_): |
|
1277 initialized = 0 |
|
1278 if debug_strs is not None: |
|
1279 debug_strs.append('Required field: output not set.') |
|
1280 elif not self.output_.IsInitialized(debug_strs): initialized = 0 |
|
1281 return initialized |
|
1282 |
|
1283 def ByteSize(self): |
|
1284 n = 0 |
|
1285 n += self.lengthVarInt64(self.width_) |
|
1286 n += self.lengthVarInt64(self.height_) |
|
1287 n += self.lengthString(self.output_.ByteSize()) |
|
1288 if (self.has_color_): n += 1 + self.lengthVarInt64(self.color_) |
|
1289 return n + 3 |
|
1290 |
|
1291 def Clear(self): |
|
1292 self.clear_width() |
|
1293 self.clear_height() |
|
1294 self.clear_output() |
|
1295 self.clear_color() |
|
1296 |
|
1297 def OutputUnchecked(self, out): |
|
1298 out.putVarInt32(8) |
|
1299 out.putVarInt32(self.width_) |
|
1300 out.putVarInt32(16) |
|
1301 out.putVarInt32(self.height_) |
|
1302 out.putVarInt32(26) |
|
1303 out.putVarInt32(self.output_.ByteSize()) |
|
1304 self.output_.OutputUnchecked(out) |
|
1305 if (self.has_color_): |
|
1306 out.putVarInt32(32) |
|
1307 out.putVarInt32(self.color_) |
|
1308 |
|
1309 def TryMerge(self, d): |
|
1310 while d.avail() > 0: |
|
1311 tt = d.getVarInt32() |
|
1312 if tt == 8: |
|
1313 self.set_width(d.getVarInt32()) |
|
1314 continue |
|
1315 if tt == 16: |
|
1316 self.set_height(d.getVarInt32()) |
|
1317 continue |
|
1318 if tt == 26: |
|
1319 length = d.getVarInt32() |
|
1320 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1321 d.skip(length) |
|
1322 self.mutable_output().TryMerge(tmp) |
|
1323 continue |
|
1324 if tt == 32: |
|
1325 self.set_color(d.getVarInt32()) |
|
1326 continue |
|
1327 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1328 d.skipData(tt) |
|
1329 |
|
1330 |
|
1331 def __str__(self, prefix="", printElemNumber=0): |
|
1332 res="" |
|
1333 if self.has_width_: res+=prefix+("width: %s\n" % self.DebugFormatInt32(self.width_)) |
|
1334 if self.has_height_: res+=prefix+("height: %s\n" % self.DebugFormatInt32(self.height_)) |
|
1335 if self.has_output_: |
|
1336 res+=prefix+"output <\n" |
|
1337 res+=self.output_.__str__(prefix + " ", printElemNumber) |
|
1338 res+=prefix+">\n" |
|
1339 if self.has_color_: res+=prefix+("color: %s\n" % self.DebugFormatInt32(self.color_)) |
|
1340 return res |
|
1341 |
|
1342 kwidth = 1 |
|
1343 kheight = 2 |
|
1344 koutput = 3 |
|
1345 kcolor = 4 |
|
1346 |
|
1347 _TEXT = ( |
|
1348 "ErrorCode", |
|
1349 "width", |
|
1350 "height", |
|
1351 "output", |
|
1352 "color", |
|
1353 ) |
|
1354 |
|
1355 _TYPES = ( |
|
1356 ProtocolBuffer.Encoder.NUMERIC, |
|
1357 ProtocolBuffer.Encoder.NUMERIC, |
|
1358 |
|
1359 ProtocolBuffer.Encoder.NUMERIC, |
|
1360 |
|
1361 ProtocolBuffer.Encoder.STRING, |
|
1362 |
|
1363 ProtocolBuffer.Encoder.NUMERIC, |
|
1364 |
|
1365 ) |
|
1366 |
|
1367 _STYLE = """""" |
|
1368 _STYLE_CONTENT_TYPE = """""" |
|
1369 class ImagesCompositeRequest(ProtocolBuffer.ProtocolMessage): |
|
1370 has_canvas_ = 0 |
|
1371 |
|
1372 def __init__(self, contents=None): |
|
1373 self.image_ = [] |
|
1374 self.options_ = [] |
|
1375 self.canvas_ = ImagesCanvas() |
|
1376 if contents is not None: self.MergeFromString(contents) |
|
1377 |
|
1378 def image_size(self): return len(self.image_) |
|
1379 def image_list(self): return self.image_ |
|
1380 |
|
1381 def image(self, i): |
|
1382 return self.image_[i] |
|
1383 |
|
1384 def mutable_image(self, i): |
|
1385 return self.image_[i] |
|
1386 |
|
1387 def add_image(self): |
|
1388 x = ImageData() |
|
1389 self.image_.append(x) |
|
1390 return x |
|
1391 |
|
1392 def clear_image(self): |
|
1393 self.image_ = [] |
|
1394 def options_size(self): return len(self.options_) |
|
1395 def options_list(self): return self.options_ |
|
1396 |
|
1397 def options(self, i): |
|
1398 return self.options_[i] |
|
1399 |
|
1400 def mutable_options(self, i): |
|
1401 return self.options_[i] |
|
1402 |
|
1403 def add_options(self): |
|
1404 x = CompositeImageOptions() |
|
1405 self.options_.append(x) |
|
1406 return x |
|
1407 |
|
1408 def clear_options(self): |
|
1409 self.options_ = [] |
|
1410 def canvas(self): return self.canvas_ |
|
1411 |
|
1412 def mutable_canvas(self): self.has_canvas_ = 1; return self.canvas_ |
|
1413 |
|
1414 def clear_canvas(self):self.has_canvas_ = 0; self.canvas_.Clear() |
|
1415 |
|
1416 def has_canvas(self): return self.has_canvas_ |
|
1417 |
|
1418 |
|
1419 def MergeFrom(self, x): |
|
1420 assert x is not self |
|
1421 for i in xrange(x.image_size()): self.add_image().CopyFrom(x.image(i)) |
|
1422 for i in xrange(x.options_size()): self.add_options().CopyFrom(x.options(i)) |
|
1423 if (x.has_canvas()): self.mutable_canvas().MergeFrom(x.canvas()) |
|
1424 |
|
1425 def Equals(self, x): |
|
1426 if x is self: return 1 |
|
1427 if len(self.image_) != len(x.image_): return 0 |
|
1428 for e1, e2 in zip(self.image_, x.image_): |
|
1429 if e1 != e2: return 0 |
|
1430 if len(self.options_) != len(x.options_): return 0 |
|
1431 for e1, e2 in zip(self.options_, x.options_): |
|
1432 if e1 != e2: return 0 |
|
1433 if self.has_canvas_ != x.has_canvas_: return 0 |
|
1434 if self.has_canvas_ and self.canvas_ != x.canvas_: return 0 |
|
1435 return 1 |
|
1436 |
|
1437 def IsInitialized(self, debug_strs=None): |
|
1438 initialized = 1 |
|
1439 for p in self.image_: |
|
1440 if not p.IsInitialized(debug_strs): initialized=0 |
|
1441 for p in self.options_: |
|
1442 if not p.IsInitialized(debug_strs): initialized=0 |
|
1443 if (not self.has_canvas_): |
|
1444 initialized = 0 |
|
1445 if debug_strs is not None: |
|
1446 debug_strs.append('Required field: canvas not set.') |
|
1447 elif not self.canvas_.IsInitialized(debug_strs): initialized = 0 |
|
1448 return initialized |
|
1449 |
|
1450 def ByteSize(self): |
|
1451 n = 0 |
|
1452 n += 1 * len(self.image_) |
|
1453 for i in xrange(len(self.image_)): n += self.lengthString(self.image_[i].ByteSize()) |
|
1454 n += 1 * len(self.options_) |
|
1455 for i in xrange(len(self.options_)): n += self.lengthString(self.options_[i].ByteSize()) |
|
1456 n += self.lengthString(self.canvas_.ByteSize()) |
|
1457 return n + 1 |
|
1458 |
|
1459 def Clear(self): |
|
1460 self.clear_image() |
|
1461 self.clear_options() |
|
1462 self.clear_canvas() |
|
1463 |
|
1464 def OutputUnchecked(self, out): |
|
1465 for i in xrange(len(self.image_)): |
|
1466 out.putVarInt32(10) |
|
1467 out.putVarInt32(self.image_[i].ByteSize()) |
|
1468 self.image_[i].OutputUnchecked(out) |
|
1469 for i in xrange(len(self.options_)): |
|
1470 out.putVarInt32(18) |
|
1471 out.putVarInt32(self.options_[i].ByteSize()) |
|
1472 self.options_[i].OutputUnchecked(out) |
|
1473 out.putVarInt32(26) |
|
1474 out.putVarInt32(self.canvas_.ByteSize()) |
|
1475 self.canvas_.OutputUnchecked(out) |
|
1476 |
|
1477 def TryMerge(self, d): |
|
1478 while d.avail() > 0: |
|
1479 tt = d.getVarInt32() |
|
1480 if tt == 10: |
|
1481 length = d.getVarInt32() |
|
1482 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1483 d.skip(length) |
|
1484 self.add_image().TryMerge(tmp) |
|
1485 continue |
|
1486 if tt == 18: |
|
1487 length = d.getVarInt32() |
|
1488 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1489 d.skip(length) |
|
1490 self.add_options().TryMerge(tmp) |
|
1491 continue |
|
1492 if tt == 26: |
|
1493 length = d.getVarInt32() |
|
1494 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1495 d.skip(length) |
|
1496 self.mutable_canvas().TryMerge(tmp) |
|
1497 continue |
|
1498 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1499 d.skipData(tt) |
|
1500 |
|
1501 |
|
1502 def __str__(self, prefix="", printElemNumber=0): |
|
1503 res="" |
|
1504 cnt=0 |
|
1505 for e in self.image_: |
|
1506 elm="" |
|
1507 if printElemNumber: elm="(%d)" % cnt |
|
1508 res+=prefix+("image%s <\n" % elm) |
|
1509 res+=e.__str__(prefix + " ", printElemNumber) |
|
1510 res+=prefix+">\n" |
|
1511 cnt+=1 |
|
1512 cnt=0 |
|
1513 for e in self.options_: |
|
1514 elm="" |
|
1515 if printElemNumber: elm="(%d)" % cnt |
|
1516 res+=prefix+("options%s <\n" % elm) |
|
1517 res+=e.__str__(prefix + " ", printElemNumber) |
|
1518 res+=prefix+">\n" |
|
1519 cnt+=1 |
|
1520 if self.has_canvas_: |
|
1521 res+=prefix+"canvas <\n" |
|
1522 res+=self.canvas_.__str__(prefix + " ", printElemNumber) |
|
1523 res+=prefix+">\n" |
|
1524 return res |
|
1525 |
|
1526 kimage = 1 |
|
1527 koptions = 2 |
|
1528 kcanvas = 3 |
|
1529 |
|
1530 _TEXT = ( |
|
1531 "ErrorCode", |
|
1532 "image", |
|
1533 "options", |
|
1534 "canvas", |
|
1535 ) |
|
1536 |
|
1537 _TYPES = ( |
|
1538 ProtocolBuffer.Encoder.NUMERIC, |
|
1539 ProtocolBuffer.Encoder.STRING, |
|
1540 |
|
1541 ProtocolBuffer.Encoder.STRING, |
|
1542 |
|
1543 ProtocolBuffer.Encoder.STRING, |
|
1544 |
|
1545 ) |
|
1546 |
|
1547 _STYLE = """""" |
|
1548 _STYLE_CONTENT_TYPE = """""" |
|
1549 class ImagesCompositeResponse(ProtocolBuffer.ProtocolMessage): |
|
1550 has_image_ = 0 |
|
1551 |
|
1552 def __init__(self, contents=None): |
|
1553 self.image_ = ImageData() |
|
1554 if contents is not None: self.MergeFromString(contents) |
|
1555 |
|
1556 def image(self): return self.image_ |
|
1557 |
|
1558 def mutable_image(self): self.has_image_ = 1; return self.image_ |
|
1559 |
|
1560 def clear_image(self):self.has_image_ = 0; self.image_.Clear() |
|
1561 |
|
1562 def has_image(self): return self.has_image_ |
|
1563 |
|
1564 |
|
1565 def MergeFrom(self, x): |
|
1566 assert x is not self |
|
1567 if (x.has_image()): self.mutable_image().MergeFrom(x.image()) |
|
1568 |
|
1569 def Equals(self, x): |
|
1570 if x is self: return 1 |
|
1571 if self.has_image_ != x.has_image_: return 0 |
|
1572 if self.has_image_ and self.image_ != x.image_: return 0 |
|
1573 return 1 |
|
1574 |
|
1575 def IsInitialized(self, debug_strs=None): |
|
1576 initialized = 1 |
|
1577 if (not self.has_image_): |
|
1578 initialized = 0 |
|
1579 if debug_strs is not None: |
|
1580 debug_strs.append('Required field: image not set.') |
|
1581 elif not self.image_.IsInitialized(debug_strs): initialized = 0 |
|
1582 return initialized |
|
1583 |
|
1584 def ByteSize(self): |
|
1585 n = 0 |
|
1586 n += self.lengthString(self.image_.ByteSize()) |
|
1587 return n + 1 |
|
1588 |
|
1589 def Clear(self): |
|
1590 self.clear_image() |
|
1591 |
|
1592 def OutputUnchecked(self, out): |
|
1593 out.putVarInt32(10) |
|
1594 out.putVarInt32(self.image_.ByteSize()) |
|
1595 self.image_.OutputUnchecked(out) |
|
1596 |
|
1597 def TryMerge(self, d): |
|
1598 while d.avail() > 0: |
|
1599 tt = d.getVarInt32() |
|
1600 if tt == 10: |
|
1601 length = d.getVarInt32() |
|
1602 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1603 d.skip(length) |
|
1604 self.mutable_image().TryMerge(tmp) |
|
1605 continue |
|
1606 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1607 d.skipData(tt) |
|
1608 |
|
1609 |
|
1610 def __str__(self, prefix="", printElemNumber=0): |
|
1611 res="" |
|
1612 if self.has_image_: |
|
1613 res+=prefix+"image <\n" |
|
1614 res+=self.image_.__str__(prefix + " ", printElemNumber) |
|
1615 res+=prefix+">\n" |
|
1616 return res |
|
1617 |
|
1618 kimage = 1 |
|
1619 |
|
1620 _TEXT = ( |
|
1621 "ErrorCode", |
|
1622 "image", |
|
1623 ) |
|
1624 |
|
1625 _TYPES = ( |
|
1626 ProtocolBuffer.Encoder.NUMERIC, |
|
1627 ProtocolBuffer.Encoder.STRING, |
|
1628 |
|
1629 ) |
|
1630 |
|
1631 _STYLE = """""" |
|
1632 _STYLE_CONTENT_TYPE = """""" |
|
1633 class ImagesHistogramRequest(ProtocolBuffer.ProtocolMessage): |
|
1634 has_image_ = 0 |
|
1635 |
|
1636 def __init__(self, contents=None): |
|
1637 self.image_ = ImageData() |
|
1638 if contents is not None: self.MergeFromString(contents) |
|
1639 |
|
1640 def image(self): return self.image_ |
|
1641 |
|
1642 def mutable_image(self): self.has_image_ = 1; return self.image_ |
|
1643 |
|
1644 def clear_image(self):self.has_image_ = 0; self.image_.Clear() |
|
1645 |
|
1646 def has_image(self): return self.has_image_ |
|
1647 |
|
1648 |
|
1649 def MergeFrom(self, x): |
|
1650 assert x is not self |
|
1651 if (x.has_image()): self.mutable_image().MergeFrom(x.image()) |
|
1652 |
|
1653 def Equals(self, x): |
|
1654 if x is self: return 1 |
|
1655 if self.has_image_ != x.has_image_: return 0 |
|
1656 if self.has_image_ and self.image_ != x.image_: return 0 |
|
1657 return 1 |
|
1658 |
|
1659 def IsInitialized(self, debug_strs=None): |
|
1660 initialized = 1 |
|
1661 if (not self.has_image_): |
|
1662 initialized = 0 |
|
1663 if debug_strs is not None: |
|
1664 debug_strs.append('Required field: image not set.') |
|
1665 elif not self.image_.IsInitialized(debug_strs): initialized = 0 |
|
1666 return initialized |
|
1667 |
|
1668 def ByteSize(self): |
|
1669 n = 0 |
|
1670 n += self.lengthString(self.image_.ByteSize()) |
|
1671 return n + 1 |
|
1672 |
|
1673 def Clear(self): |
|
1674 self.clear_image() |
|
1675 |
|
1676 def OutputUnchecked(self, out): |
|
1677 out.putVarInt32(10) |
|
1678 out.putVarInt32(self.image_.ByteSize()) |
|
1679 self.image_.OutputUnchecked(out) |
|
1680 |
|
1681 def TryMerge(self, d): |
|
1682 while d.avail() > 0: |
|
1683 tt = d.getVarInt32() |
|
1684 if tt == 10: |
|
1685 length = d.getVarInt32() |
|
1686 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1687 d.skip(length) |
|
1688 self.mutable_image().TryMerge(tmp) |
|
1689 continue |
|
1690 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1691 d.skipData(tt) |
|
1692 |
|
1693 |
|
1694 def __str__(self, prefix="", printElemNumber=0): |
|
1695 res="" |
|
1696 if self.has_image_: |
|
1697 res+=prefix+"image <\n" |
|
1698 res+=self.image_.__str__(prefix + " ", printElemNumber) |
|
1699 res+=prefix+">\n" |
|
1700 return res |
|
1701 |
|
1702 kimage = 1 |
|
1703 |
|
1704 _TEXT = ( |
|
1705 "ErrorCode", |
|
1706 "image", |
|
1707 ) |
|
1708 |
|
1709 _TYPES = ( |
|
1710 ProtocolBuffer.Encoder.NUMERIC, |
|
1711 ProtocolBuffer.Encoder.STRING, |
|
1712 |
|
1713 ) |
|
1714 |
|
1715 _STYLE = """""" |
|
1716 _STYLE_CONTENT_TYPE = """""" |
|
1717 class ImagesHistogram(ProtocolBuffer.ProtocolMessage): |
|
1718 |
|
1719 def __init__(self, contents=None): |
|
1720 self.red_ = [] |
|
1721 self.green_ = [] |
|
1722 self.blue_ = [] |
|
1723 if contents is not None: self.MergeFromString(contents) |
|
1724 |
|
1725 def red_size(self): return len(self.red_) |
|
1726 def red_list(self): return self.red_ |
|
1727 |
|
1728 def red(self, i): |
|
1729 return self.red_[i] |
|
1730 |
|
1731 def set_red(self, i, x): |
|
1732 self.red_[i] = x |
|
1733 |
|
1734 def add_red(self, x): |
|
1735 self.red_.append(x) |
|
1736 |
|
1737 def clear_red(self): |
|
1738 self.red_ = [] |
|
1739 |
|
1740 def green_size(self): return len(self.green_) |
|
1741 def green_list(self): return self.green_ |
|
1742 |
|
1743 def green(self, i): |
|
1744 return self.green_[i] |
|
1745 |
|
1746 def set_green(self, i, x): |
|
1747 self.green_[i] = x |
|
1748 |
|
1749 def add_green(self, x): |
|
1750 self.green_.append(x) |
|
1751 |
|
1752 def clear_green(self): |
|
1753 self.green_ = [] |
|
1754 |
|
1755 def blue_size(self): return len(self.blue_) |
|
1756 def blue_list(self): return self.blue_ |
|
1757 |
|
1758 def blue(self, i): |
|
1759 return self.blue_[i] |
|
1760 |
|
1761 def set_blue(self, i, x): |
|
1762 self.blue_[i] = x |
|
1763 |
|
1764 def add_blue(self, x): |
|
1765 self.blue_.append(x) |
|
1766 |
|
1767 def clear_blue(self): |
|
1768 self.blue_ = [] |
|
1769 |
|
1770 |
|
1771 def MergeFrom(self, x): |
|
1772 assert x is not self |
|
1773 for i in xrange(x.red_size()): self.add_red(x.red(i)) |
|
1774 for i in xrange(x.green_size()): self.add_green(x.green(i)) |
|
1775 for i in xrange(x.blue_size()): self.add_blue(x.blue(i)) |
|
1776 |
|
1777 def Equals(self, x): |
|
1778 if x is self: return 1 |
|
1779 if len(self.red_) != len(x.red_): return 0 |
|
1780 for e1, e2 in zip(self.red_, x.red_): |
|
1781 if e1 != e2: return 0 |
|
1782 if len(self.green_) != len(x.green_): return 0 |
|
1783 for e1, e2 in zip(self.green_, x.green_): |
|
1784 if e1 != e2: return 0 |
|
1785 if len(self.blue_) != len(x.blue_): return 0 |
|
1786 for e1, e2 in zip(self.blue_, x.blue_): |
|
1787 if e1 != e2: return 0 |
|
1788 return 1 |
|
1789 |
|
1790 def IsInitialized(self, debug_strs=None): |
|
1791 initialized = 1 |
|
1792 return initialized |
|
1793 |
|
1794 def ByteSize(self): |
|
1795 n = 0 |
|
1796 n += 1 * len(self.red_) |
|
1797 for i in xrange(len(self.red_)): n += self.lengthVarInt64(self.red_[i]) |
|
1798 n += 1 * len(self.green_) |
|
1799 for i in xrange(len(self.green_)): n += self.lengthVarInt64(self.green_[i]) |
|
1800 n += 1 * len(self.blue_) |
|
1801 for i in xrange(len(self.blue_)): n += self.lengthVarInt64(self.blue_[i]) |
|
1802 return n + 0 |
|
1803 |
|
1804 def Clear(self): |
|
1805 self.clear_red() |
|
1806 self.clear_green() |
|
1807 self.clear_blue() |
|
1808 |
|
1809 def OutputUnchecked(self, out): |
|
1810 for i in xrange(len(self.red_)): |
|
1811 out.putVarInt32(8) |
|
1812 out.putVarInt32(self.red_[i]) |
|
1813 for i in xrange(len(self.green_)): |
|
1814 out.putVarInt32(16) |
|
1815 out.putVarInt32(self.green_[i]) |
|
1816 for i in xrange(len(self.blue_)): |
|
1817 out.putVarInt32(24) |
|
1818 out.putVarInt32(self.blue_[i]) |
|
1819 |
|
1820 def TryMerge(self, d): |
|
1821 while d.avail() > 0: |
|
1822 tt = d.getVarInt32() |
|
1823 if tt == 8: |
|
1824 self.add_red(d.getVarInt32()) |
|
1825 continue |
|
1826 if tt == 16: |
|
1827 self.add_green(d.getVarInt32()) |
|
1828 continue |
|
1829 if tt == 24: |
|
1830 self.add_blue(d.getVarInt32()) |
|
1831 continue |
|
1832 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1833 d.skipData(tt) |
|
1834 |
|
1835 |
|
1836 def __str__(self, prefix="", printElemNumber=0): |
|
1837 res="" |
|
1838 cnt=0 |
|
1839 for e in self.red_: |
|
1840 elm="" |
|
1841 if printElemNumber: elm="(%d)" % cnt |
|
1842 res+=prefix+("red%s: %s\n" % (elm, self.DebugFormatInt32(e))) |
|
1843 cnt+=1 |
|
1844 cnt=0 |
|
1845 for e in self.green_: |
|
1846 elm="" |
|
1847 if printElemNumber: elm="(%d)" % cnt |
|
1848 res+=prefix+("green%s: %s\n" % (elm, self.DebugFormatInt32(e))) |
|
1849 cnt+=1 |
|
1850 cnt=0 |
|
1851 for e in self.blue_: |
|
1852 elm="" |
|
1853 if printElemNumber: elm="(%d)" % cnt |
|
1854 res+=prefix+("blue%s: %s\n" % (elm, self.DebugFormatInt32(e))) |
|
1855 cnt+=1 |
|
1856 return res |
|
1857 |
|
1858 kred = 1 |
|
1859 kgreen = 2 |
|
1860 kblue = 3 |
|
1861 |
|
1862 _TEXT = ( |
|
1863 "ErrorCode", |
|
1864 "red", |
|
1865 "green", |
|
1866 "blue", |
|
1867 ) |
|
1868 |
|
1869 _TYPES = ( |
|
1870 ProtocolBuffer.Encoder.NUMERIC, |
|
1871 ProtocolBuffer.Encoder.NUMERIC, |
|
1872 |
|
1873 ProtocolBuffer.Encoder.NUMERIC, |
|
1874 |
|
1875 ProtocolBuffer.Encoder.NUMERIC, |
|
1876 |
|
1877 ) |
|
1878 |
|
1879 _STYLE = """""" |
|
1880 _STYLE_CONTENT_TYPE = """""" |
|
1881 class ImagesHistogramResponse(ProtocolBuffer.ProtocolMessage): |
|
1882 has_histogram_ = 0 |
|
1883 |
|
1884 def __init__(self, contents=None): |
|
1885 self.histogram_ = ImagesHistogram() |
|
1886 if contents is not None: self.MergeFromString(contents) |
|
1887 |
|
1888 def histogram(self): return self.histogram_ |
|
1889 |
|
1890 def mutable_histogram(self): self.has_histogram_ = 1; return self.histogram_ |
|
1891 |
|
1892 def clear_histogram(self):self.has_histogram_ = 0; self.histogram_.Clear() |
|
1893 |
|
1894 def has_histogram(self): return self.has_histogram_ |
|
1895 |
|
1896 |
|
1897 def MergeFrom(self, x): |
|
1898 assert x is not self |
|
1899 if (x.has_histogram()): self.mutable_histogram().MergeFrom(x.histogram()) |
|
1900 |
|
1901 def Equals(self, x): |
|
1902 if x is self: return 1 |
|
1903 if self.has_histogram_ != x.has_histogram_: return 0 |
|
1904 if self.has_histogram_ and self.histogram_ != x.histogram_: return 0 |
|
1905 return 1 |
|
1906 |
|
1907 def IsInitialized(self, debug_strs=None): |
|
1908 initialized = 1 |
|
1909 if (not self.has_histogram_): |
|
1910 initialized = 0 |
|
1911 if debug_strs is not None: |
|
1912 debug_strs.append('Required field: histogram not set.') |
|
1913 elif not self.histogram_.IsInitialized(debug_strs): initialized = 0 |
|
1914 return initialized |
|
1915 |
|
1916 def ByteSize(self): |
|
1917 n = 0 |
|
1918 n += self.lengthString(self.histogram_.ByteSize()) |
|
1919 return n + 1 |
|
1920 |
|
1921 def Clear(self): |
|
1922 self.clear_histogram() |
|
1923 |
|
1924 def OutputUnchecked(self, out): |
|
1925 out.putVarInt32(10) |
|
1926 out.putVarInt32(self.histogram_.ByteSize()) |
|
1927 self.histogram_.OutputUnchecked(out) |
|
1928 |
|
1929 def TryMerge(self, d): |
|
1930 while d.avail() > 0: |
|
1931 tt = d.getVarInt32() |
|
1932 if tt == 10: |
|
1933 length = d.getVarInt32() |
|
1934 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1935 d.skip(length) |
|
1936 self.mutable_histogram().TryMerge(tmp) |
|
1937 continue |
|
1938 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1939 d.skipData(tt) |
|
1940 |
|
1941 |
|
1942 def __str__(self, prefix="", printElemNumber=0): |
|
1943 res="" |
|
1944 if self.has_histogram_: |
|
1945 res+=prefix+"histogram <\n" |
|
1946 res+=self.histogram_.__str__(prefix + " ", printElemNumber) |
|
1947 res+=prefix+">\n" |
|
1948 return res |
|
1949 |
|
1950 khistogram = 1 |
|
1951 |
|
1952 _TEXT = ( |
|
1953 "ErrorCode", |
|
1954 "histogram", |
|
1955 ) |
|
1956 |
|
1957 _TYPES = ( |
|
1958 ProtocolBuffer.Encoder.NUMERIC, |
|
1959 ProtocolBuffer.Encoder.STRING, |
|
1960 |
|
1961 ) |
|
1962 |
|
1963 _STYLE = """""" |
|
1964 _STYLE_CONTENT_TYPE = """""" |
|
1965 |
|
1966 __all__ = ['ImagesServiceError','ImagesServiceTransform','Transform','ImageData','OutputSettings','ImagesTransformRequest','ImagesTransformResponse','CompositeImageOptions','ImagesCanvas','ImagesCompositeRequest','ImagesCompositeResponse','ImagesHistogramRequest','ImagesHistogram','ImagesHistogramResponse'] |