
#include <mingpp.h>

int main()
{
  Ming_init();
  Ming_setScale(1.0);

  SWFShape *s = new SWFShape();

  // .msk file generated with "gif2mask" utility
  SWFFill *f = s->addBitmapFill(new SWFBitmap("../common/alphafill.jpg", "../common/alphafill.msk"));
  s->setRightFill(f);

  s->drawLine(640, 0);
  s->drawLine(0, 480);
  s->drawLine(-640, 0);
  s->drawLine(0, -480);

  SWFShape *c = new SWFShape();
  c->setRightFill(c->addSolidFill(0x99, 0x99, 0x99));
  c->drawLine(40, 0);
  c->drawLine(0, 40);
  c->drawLine(-40, 0);
  c->drawLine(0, -40);

  SWFMovie *m = new SWFMovie();
  m->setDimension(640, 480);
  m->setBackground(0xcc, 0xcc, 0xcc);

  // draw checkerboard background
  for(int y=0; y<480; y+=40)
  {
    for(int x=0; x<640; x+=80)
    {
      SWFDisplayItem *i = m->add(c);
      i->moveTo(x, y);
    }

    y+=40;

    for(int x=40; x<640; x+=80)
    {
      SWFDisplayItem *i = m->add(c);
      i->moveTo(x, y);
    }
  }

  m->add(s);

  m->save("test.swf");

  exit(0);
}
