MakeMask() public method

Make this Image a mask.
public MakeMask ( ) : void
return void
Exemplo n.º 1
0
        public virtual void RenderImage(ImageRenderInfo renderInfo)
        {
            IList <Rectangle> areasToBeCleaned = GetImageAreasToBeCleaned(renderInfo);

            if (areasToBeCleaned == null)
            {
                chunks.Add(new PdfCleanUpContentChunk.Image(false, null));
            }
            else
            {
                PdfImageObject pdfImage   = renderInfo.GetImage();
                byte[]         imageBytes = ProcessImage(pdfImage.GetImageAsBytes(), areasToBeCleaned);

                if (renderInfo.GetRef() == null && pdfImage != null)   // true => inline image
                {
                    PdfDictionary dict      = pdfImage.GetDictionary();
                    PdfObject     imageMask = dict.Get(PdfName.IMAGEMASK);
                    Image         image     = Image.GetInstance(imageBytes);

                    if (imageMask == null)
                    {
                        imageMask = dict.Get(PdfName.IM);
                    }

                    if (imageMask != null && imageMask.Equals(PdfBoolean.PDFTRUE))
                    {
                        image.MakeMask();
                    }

                    PdfContentByte canvas = Context.Canvas;
                    canvas.AddImage(image, 1, 0, 0, 1, 0, 0, true);
                }
                else if (pdfImage != null && imageBytes != pdfImage.GetImageAsBytes())
                {
                    chunks.Add(new PdfCleanUpContentChunk.Image(true, imageBytes));
                }
            }
        }