void printFillStyle(struct FillStyle *s, int id, int num, int isMorph) { switch(s->type) { case 0: return; case 0x10: printGradient(&(s->fill.gradient)); printf("\t$f%i = $s%i->addFill($g, SWFFILL_LINEAR_GRADIENT);\n", num, id); break; case 0x12: printGradient(&(s->fill.gradient)); printf("\t$f%i = $s%i->addFill($g, SWFFILL_RADIAL_GRADIENT);\n", num, id); break; case 0x40: printf("\t$f%i = $s%i->addFill($b%i, SWFFILL_TILED_BITMAP);\n", num, id, s->fill.bitmap); break; case 0x41: printf("\t$f%i = $s%i->addFill($b%i, SWFFILL_CLIPPED_BITMAP);\n", num, id, s->fill.bitmap); break; default: error("Unknown fill type: 0x%02x!", s->type); } if(isMorph) { if(s->type == 0x40 || s->type == 0x41) printTransform(&(s->matrix2), 'f', num); } else printTransform(&(s->matrix), 'f', num); }
void printFillStyle(FILE *f, int shapeType) { int type; type = readUInt8(f); if(type==0) /* solid fill */ { print("color="); if(shapeType==SWF_DEFINESHAPE3 || shapeType==SWF_DEFINEMORPHSHAPE) printRGBA(f); else printRGB(f); if(shapeType==SWF_DEFINEMORPHSHAPE) { print("color2="); printRGBA(f); } putchar('\n'); } else if(type==0x10) /* linear */ { println("Matrix:"); ++gIndent; printMatrix(f); --gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) { println("Matrix2:"); ++gIndent; printMatrix(f); --gIndent; } println("Gradient (linear):"); ++gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) printMorphGradient(f); else printGradient(f, shapeType); --gIndent; } else if(type==0x12) /* radial gradient */ { println("Matrix:"); ++gIndent; printMatrix(f); --gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) { println("Matrix2:"); ++gIndent; printMatrix(f); --gIndent; } println("Gradient (radial):"); ++gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) printMorphGradient(f); else printGradient(f, shapeType); --gIndent; } else if(type==0x40) /* tiled bitmap */ { println("Bitmap id: %i (tiled)", readUInt16(f)); println("Bitmap matrix:"); ++gIndent; printMatrix(f); --gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) { println("Bitmap matrix:"); ++gIndent; printMatrix(f); --gIndent; } } else if(type==0x41) /* clipped bitmap */ { println("Bitmap id: %i (clipped)", readUInt16(f)); println("Bitmap matrix:"); ++gIndent; printMatrix(f); --gIndent; if(shapeType==SWF_DEFINEMORPHSHAPE) { println("Bitmap matrix:"); ++gIndent; printMatrix(f); --gIndent; } } else println("Unknown fill type: %i", type); }