Exemplo n.º 1
0
void Graphics::drawGraphicsDatum(IGraphicsData *inData)
{
   switch(inData->GetType())
   {
      case gdtUnknown: break;
      case gdtTrianglePath: break;
      case gdtPath:
         {
         GraphicsPath *path = inData->AsPath();
         drawPath(path->commands, path->data, path->winding);
         break;
         }
      case gdtEndFill:
         endFill();
         break;
      case gdtSolidFill:
      case gdtGradientFill:
      case gdtBitmapFill:
         {
         IGraphicsFill *fill = inData->AsIFill();
         if (fill->isSolidStyle())
         {
            Flush(false,true);
            endTiles();
            if (mFillJob.mFill)
               mFillJob.mFill->DecRef();
            mFillJob.mFill = fill;
            mFillJob.mFill->IncRef();
            if (mFillJob.mCommand0 == mPathData->commands.size())
               mPathData->initPosition(mCursor);
         }
         else if (mLineJob.mStroke)
         {
            Flush(true,false);
            mLineJob.mStroke = mLineJob.mStroke->CloneWithFill(fill);
         }
         }
         break;
      case gdtStroke:
         {
         Flush(true,false);
         if (mLineJob.mStroke)
         {
            mLineJob.mStroke->DecRef();
            mLineJob.mStroke = 0;
         }
         GraphicsStroke *stroke = inData->AsStroke();
         if (stroke->thickness>=0 && stroke->fill)
         {
            mLineJob.mStroke = stroke;
            mLineJob.mStroke->IncRef();
            if (mLineJob.mCommand0 == mPathData->commands.size())
               mPathData->initPosition(mCursor);
         }
         }
         break;

   }
   OnChanged();
}
Exemplo n.º 2
0
void Graphics::beginTiles(Surface *bitmapData,bool inSmooth)
{
   endFill();
   lineStyle(-1);
   Flush();
   if (mTileJob.mFill)
      mTileJob.mFill->DecRef();
   mTileJob.mFill = new GraphicsBitmapFill(bitmapData,Matrix(),false,inSmooth);
   mTileJob.mFill->IncRef();
}
Exemplo n.º 3
0
void Graphics::beginTiles(Surface *bitmapData,bool inSmooth,int inBlendMode, int inMode, int inCount)
{
   endFill();
   lineStyle(-1);
   Flush();
   if (mTileJob.mFill)
      mTileJob.mFill->DecRef();
   mTileJob.mFill = new GraphicsBitmapFill(bitmapData,Matrix(),false,inSmooth);
   mTileJob.mFill->IncRef();
   mTileJob.mBlendMode = inBlendMode;
   mTileJob.mTileCount = inCount;
   mTileJob.mTileMode = inMode;
}
Exemplo n.º 4
0
void
DynamicShape::beginFill(const rgba& color)
{
	// End previous fill
	endFill();

	// Add the new fill style and set as current
	fill_style style; style.setSolid(color);
	_currfill = add_fill_style(style);

	// TODO: how to know wheter the fill should be set
	//       as *left* or *right* fill ?
	//       A quick test shows that *left* always work fine !
	Path newPath(_x, _y, _currfill, 0, _currline, true); 
	add_path(newPath);
}
Exemplo n.º 5
0
void
DynamicShape::beginLinearGradientFill(const std::vector<gradient_record>& grad, const SWFMatrix& mat)
{
	// Add the new fill style and set as current
	fill_style style;
    style.setLinearGradient(grad, mat);

	endFill();

	_currfill = add_fill_style(style);
	// TODO: how to know wheter the fill should be set
	//       as *left* or *right* fill ?
	//       A quick test shows that *left* always work fine !
	Path newPath(_x, _y, _currfill, 0, _currline, true);
	add_path(newPath);
}
Exemplo n.º 6
0
void Graphics::drawPoints(QuickVec<float> inXYs, QuickVec<int> inRGBAs, unsigned int inDefaultRGBA,
								  double inSize)
{
   endFill();
   lineStyle(-1);
   Flush();

   GraphicsJob job;
   job.mCommand0 = mPathData->commands.size();
   job.mCommandCount = 1;
   job.mData0 = mPathData->data.size();
   job.mIsPointJob = true;
   mPathData->drawPoints(inXYs,inRGBAs);
   job.mDataCount = mPathData->data.size() - job.mData0;
   if (mPathData->commands[job.mCommand0]==pcPointsXY)
   {
      job.mFill = new GraphicsSolidFill(inDefaultRGBA&0xffffff,(inDefaultRGBA>>24)/255.0);
      job.mFill->IncRef();
   }