Esempio n. 1
0
        private void CompileBlendOp()
        {
            bool isDefaultOp = (properties.blendOp.GetType() == UserBlendOps.GetDefaultBlendOp());

            if (this.Opacity == 255)
            {
                this.compiledBlendOp = properties.blendOp;
            }
            else
            {
                this.compiledBlendOp = properties.blendOp.CreateWithOpacity(this.Opacity);
            }
        }
Esempio n. 2
0
        public void Render(RenderArgs args, Rectangle[] roi, int startIndex, int length, bool clearBackground)
        {
            int startLayerIndex;

            if (clearBackground)
            {
                BitmapLayer layer0;
                layer0 = this.layers[0] as BitmapLayer;

                // Special case: if the first layer is a visible BitmapLayer with full opacity using
                // the default blend op, we can just copy the pixels straight over
                if (layer0 != null &&
                    layer0.Visible &&
                    layer0.Opacity == 255 &&
                    layer0.BlendOp.GetType() == UserBlendOps.GetDefaultBlendOp())
                {
                    args.Surface.CopySurface(layer0.Surface, roi, startIndex, length);
                    startLayerIndex = 1;
                }
                else
                {
                    ClearBackground(args.Surface, roi, startIndex, length);
                    startLayerIndex = 0;
                }
            }
            else
            {
                startLayerIndex = 0;
            }

            for (int i = startLayerIndex; i < this.layers.Count; ++i)
            {
                Layer layer = (Layer)this.layers[i];

                if (layer.Visible)
                {
                    layer.RenderUnchecked(args, roi, startIndex, length);
                }
            }
        }