예제 #1
0
파일: listswf.c 프로젝트: akleine/libming
void printLineStyleArray(FILE *f, int shapeType)
{
  int count, i;

  count = readUInt8(f);

  if(count==255)
    count = readUInt16(f);

  for(i=0; i<count; ++i)
  {
    print("LineStyle %i: ", i+1);
    printf("width=%i ", readUInt16(f));

    if(shapeType==SWF_DEFINEMORPHSHAPE)
      printf("width2=%i ", readUInt16(f));

    puts("color=");

    if(shapeType==SWF_DEFINESHAPE3 || shapeType==SWF_DEFINEMORPHSHAPE)
      printRGBA(f);
    else
      printRGB(f);

    if(shapeType==SWF_DEFINEMORPHSHAPE)
    {
      puts("color2=");
      printRGBA(f);
    }

    putchar('\n');
  }
}
예제 #2
0
파일: listswf.c 프로젝트: akleine/libming
void printMorphGradient(FILE *f)
{
  int i;
  int numGrads = readUInt8(f);

  for(i=0; i<numGrads; ++i)
  {
    print("Shape 1, Grad[%i]: ratio=%i, ", i, readUInt8(f));
    puts("color=");
    printRGBA(f);
    putchar('\n');

    print("Shape 2, Grad[%i]: ratio=%i, ", i, readUInt8(f));
    puts("color=");
    printRGBA(f);
    putchar('\n');
  }
}
예제 #3
0
void printGradient(struct Gradient *g)
{
  int i;

  printf("\t$g = new SWF::Gradient();\n");

  for(i=0; i<g->nGradients; ++i)
  {
    printf("\t$g->addEntry(%f, ", g->ratio[i]/255.0);
    printRGBA(&(g->colors[i]));
    printf(");\n");
  }
}
예제 #4
0
파일: listswf.c 프로젝트: akleine/libming
int printTextRecord(FILE *f, int glyphBits, int advanceBits, int type)
{
  int i, numGlyphs;
  int flags = readUInt8(f);

  if(flags == 0)
    return 0;

  if(flags & TEXTRECORD_STATECHANGE)
  {
    if(flags & TEXTRECORD_HASFONT)
      println("font id: %i", readUInt16(f));

    if(flags & TEXTRECORD_HASCOLOR)
    {
      print("color: ");

      if(type == 2)
	printRGBA(f);
      else
	printRGB(f);

      putchar('\n');
    }

    if(flags & TEXTRECORD_HASXOFF)
      println("X Offset: %i", readSInt16(f));

    if(flags & TEXTRECORD_HASYOFF)
      println("Y Offset: %i", readSInt16(f));

    if(flags & TEXTRECORD_HASFONT)
      println("font height: %i", readUInt16(f));
  }
  else
  {
    numGlyphs = flags & TEXTRECORD_NUMGLYPHS;

    for(i=0; i<numGlyphs; ++i)
    {
      println("glyph index: %i", readBits(f, glyphBits));
      println("glyph x advance: %i", readSBits(f, advanceBits));
    }
  }

  return 1;
}
예제 #5
0
void printShapeRec(struct Shape *shape, struct ShapeRecord *s, int id){
	switch(s->type){
		
		case SHAPERECORD_END:
			return;
		
		case SHAPERECORD_STATECHANGE:
			if(s->data.change.movetox != 0 || s->data.change.movetoy != 0){
				printf("\t$s%i->movePenTo(%i, %i);\n", id, \
					s->data.change.movetox, \
					s->data.change.movetoy);
			}
      if(s->data.change.fill0 != -1){
				printFillChange(id, shape, s->data.change.fill0, 0);
			}
      if(s->data.change.fill1 != -1){
				printFillChange(id, shape, s->data.change.fill1, 1);
			}
      if(s->data.change.line != -1){
				if(s->data.change.line == 0){
					printf("\t$s%i->setLine(0);\n", id);
				}
				else{
					struct LineStyle *line = &(shape->lines.line[s->data.change.line-1]);
					printf("\t$s%i->setLine(%i, ", id, line->width);
					printRGBA(&(line->color));
					printf(");\n");
				}
			}
			break;

		case SHAPERECORD_LINE:
			printf("\t$s%i->drawLine(%i, %i);\n", id, s->data.line.x, s->data.line.y);
			break;

		case SHAPERECORD_CURVE:
			printf("\t$s%i->drawCurve(%i, %i, %i, %i);\n", id,
				s->data.curve.controlx, s->data.curve.controly,
				s->data.curve.anchorx, s->data.curve.anchory);
			break;

		default:
			error("Bad shape type: %i!\n", s->type);
	}
}
예제 #6
0
파일: listswf.c 프로젝트: akleine/libming
void printGradient(FILE *f, int shapeType)
{
  int i;
  int numGrads = readUInt8(f);

  for(i=0; i<numGrads; ++i)
  {
    print("Grad[%i]: ratio=%i, ", i, readUInt8(f));
    puts("color=");

    if(shapeType==SWF_DEFINESHAPE3)
      printRGBA(f);
    else
      printRGB(f);

    putchar('\n');
  }
}
예제 #7
0
void printFillChange(int id, struct Shape *shape, int fillNum, int side)
{
  if(fillNum == 0)
    /*no fill*/
    printf("\t$s%i->set%sFill();\n", id, side==0 ? "Left" : "Right");

  else if(shape->fills.fill[fillNum-1].type == 0)
  {
    printf("\t$s%i->set%sFill(", id, side==0 ? "Left" : "Right");
    printRGBA(&(shape->fills.fill[fillNum-1].fill.color));
    printf(");\n");
  }

  else {
    printf("\t$s%i->set%sFill($f%i);\n", id, side==0 ? "Left" : "Right",
	   fillNum);
  }
}
예제 #8
0
파일: listswf.c 프로젝트: akleine/libming
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);
}