/** Implements CAnimator::DrawMask.*/
void CBitmapAnimator::DrawMask(CBitmapContext& aBitmapContext) const
	{
	const TUint32 frameFlags = iFrameArray[iCurrentFrame]->FrameInfo().iFlags;

	if (frameFlags&TFrameInfo::ERestoreToPrevious)
		RestoreToPrevious(aBitmapContext, ETrue);
	RenderMask(aBitmapContext, iNextFrame);
	}
void CBitmapAnimator::RestoreToPrevious(CBitmapContext& aBitmapContext, TBool aMask) const
	{
	TInt frame = 0;
	while (frame < iCurrentFrame)
		{
		if (!(iFrameArray[frame]->FrameInfo().iFlags&TFrameInfo::ERestoreToPrevious))
			{
			if (aMask)
				RenderMask(aBitmapContext, frame);
			else
				Render(aBitmapContext, frame);
			}
		++frame;
		}
	}
Beispiel #3
0
void StrokeStyle::operator () (Pixels destPixels, Pixels maskPixels)
{
  if (!active)
    return;

  if (type != typeGradient)// || gradient.style != GradientFill::styleShapeBurst)
  {
    //
    // Calculate mask using distance transform
    //

    Image matteImage (
      Image::SingleChannel,
      maskPixels.getBounds ().getWidth (),
      maskPixels.getBounds ().getHeight (),
      false);

    Pixels mattePixels (matteImage);

    switch (pos)
    {
    case posInner:
      DistanceTransform::Meijster::calculateAntiAliased (
        RenderMask (Pixels::Map2D (mattePixels), size),
        Inside (maskPixels),
        maskPixels.getWidth (),
        maskPixels.getHeight (),
        DistanceTransform::Meijster::EuclideanMetric ());
      break;

    case posOuter:
      DistanceTransform::Meijster::calculateAntiAliased (
        RenderMask (Pixels::Map2D (mattePixels), size),
        Outside (maskPixels),
        maskPixels.getWidth (),
        maskPixels.getHeight (),
        DistanceTransform::Meijster::EuclideanMetric ());
      break;

    case posCentre:
      break;

    default:
      jassertfalse;
      break;
    };

    //
    // Apply fill using mask
    //

    switch (type)
    {
    case typeColour:
      BlendMode::apply (
        mode,
        Pixels::Iterate2 (destPixels, mattePixels),
        BlendProc::RGB::MaskFill (colour, opacity));
      break;

    case typeGradient:
      break;

    case typePattern:
      break;

    default:
      jassertfalse;
      break;
    };
  }
  else
  {
    //
    // Special case for shape burst gradients
    //
    SharedTable <Colour> colourTable = gradient.colours.createLookupTable ();

    switch (pos)
    {
    case posInner:
      {
        DistanceTransform::Meijster::calculateAntiAliased (
          RenderShapeBurst (Pixels::Map2D (destPixels), size, colourTable),
          Inside (maskPixels),
          maskPixels.getWidth (),
          maskPixels.getHeight (),
          DistanceTransform::Meijster::EuclideanMetric ());
      }
      break;

    case posOuter:
      {
        DistanceTransform::Meijster::calculateAntiAliased (
          RenderShapeBurst (Pixels::Map2D (destPixels), size, colourTable),
          Outside (maskPixels),
          maskPixels.getWidth (),
          maskPixels.getHeight (),
          DistanceTransform::Meijster::EuclideanMetric ());
      }
      break;

    case posCentre:
      {
      }
      break;

    default:
      jassertfalse;
      break;
    };
  }
}