Ejemplo n.º 1
0
        private int Threaded_Draw(int start, int end, Engine.Threading.ParamList paramList)
        {
            t_colorVariance.Step();

            int x = (int)paramList.Get("x").Value;
            int y = (int)paramList.Get("y").Value;

            for (int i = start; i < end; i++)
            {
                t_particles[i].Update(t_attractor);

                Engine.Color.Cell px;

                if (t_useColorFromImage)
                {
                    px = t_imageSource.GetPixel(x, y, Surface.PixelRetrievalOptions.ReturnEdgePixel);
                }
                else
                {
                    px = t_colorVariance.ColorVariation;
                }

                px.Alpha = t_alpha;
                t_particles[i].Draw(t_imageSource, px);
            }

            return(0);
        }
        private void ThreadedProcess()
        {
            t_workflow.AllowInvalidate = true;

            Engine.Color.Cell c = Engine.Application.UISelectedValues.SelectedColor;
            t_colorVariance.SetColor(c);

            for (int x = 0; x < t_imageProcessed.Width; x++)
            {
                t_colorVariance.Step();

                for (int y = 0; y < t_imageProcessed.Height; y++)
                {
                    int offset = t_imageProcessed.GetOffset(x, y);

                    if (y < t_imageProcessed.Height * t_percent / 100)
                    {
                        Engine.Color.Cell variance = t_colorVariance.ColorVariation;
                        variance.WriteBytes(t_imageProcessed.Array, offset);
                    }
                    else
                    {
                        c.WriteBytes(t_imageProcessed.Array, offset);
                    }
                }
            }

            base.PostProcess();
        }
Ejemplo n.º 3
0
        internal override void Draw(MousePoint p)
        {
            if (!t_skipper.Skip())
            {
                return;
            }

            if (t_imageSource.IsOutOfBounds(p.X, p.Y))
            {
                return;
            }

            Engine.Color.Cell col;
            t_colorVariance.Step();

            if (t_useColorFromImage)
            {
                col = t_imageSource.GetPixel(p.X, p.Y, PixelRetrievalOptions.ReturnEdgePixel);
                t_colorVariance.SetColor(col);
                col       = t_colorVariance.ColorVariation;
                col.Alpha = t_alpha;
            }
            else
            {
                col       = t_colorVariance.ColorVariation;
                col.Alpha = t_alpha;
            }

            // particles must follow the pen between each call to draw
            int[] delta          = MousePoint.Delta(t_previousPoint, p);
            Engine.Calc.Vector d = new Engine.Calc.Vector(delta[0], delta[1]);

            foreach (Engine.Effects.Particles.Obsolete.PixelParticle_O px in t_particles)
            {
                px.Move(d);

                px.Draw(t_imageSource, col);
            }

            t_previousPoint = p;
        }