Exemple #1
0
        //todo accept cancellation from wait form
        //todo update main form status bar with "Processing request 2 of 6..."
        //todo on cancellation, still update main form with the last successfully completed coloration

        #region Color Bitmap

        /// <summary>
        /// The main worker method: colors in a region of the image.
        /// </summary>
        private void ColorPixel(object sender, DoWorkEventArgs e)
        {
            if (queue.Count == 0)
            {
                return;
            }

            ColorAtPoint request = queue.Dequeue();
            Color        color   = request.Color;
            Point        point   = request.Point;

            Color oldPureColor = masterImage.CleanGetCopy.GetPixel(point.X, point.Y);

            ConvertRegionToColor(color, point);
            //todo: refactor for new design - in master image keep partially updated image separate from last complete version
            //todo cont: basically, a buffered version to edit on, and a completed version that can always be displayed
            e.Result = new RequestColorWorkerResult(masterImage.CleanGetCopy, request, request.ChangeColor(oldPureColor));
        }