Esempio n. 1
0
 private void RemapFountainFill(corel.FountainFill fill)
 {
     for (int i = 0; i < fill.Colors.Count; i++)
     {
         if (checkColor.Check(fill.Colors[i].Color))
         {
             fill.Colors[i].Color = convertColor.Convert(fill.Colors[i].Color);
         }
     }
 }
Esempio n. 2
0
        private void btnGrabColorToColorTint_Click(object sender, RoutedEventArgs e)
        {
            corel.Shape s = corelApp.ActiveSelection;
            if (s == null || s.Shapes.Count > 1 || s.Fill.Type != cdrFillType.cdrFountainFill)
            {
                return;
            }

            corel.FountainFill ff = s.Fill.Fountain;

            for (int i = 1; i < ff.Colors.Count; i++)
            {
                corel.FountainColor startFC = ff.Colors[i - 1];
                corel.FountainColor endFC   = ff.Colors[i];
                int         posStart        = startFC.Position;
                int         posEnd          = endFC.Position;
                corel.Color startC          = startFC.Color;
                corel.Color endC            = endFC.Color;

                if (startC.IsSpot)
                {
                    corel.Color c = new corel.Color();
                    c.CopyAssign(startC);
                    c.ConvertToCMYK();
                    startC = c;
                }

                if (endC.IsSpot)
                {
                    corel.Color c = new corel.Color();
                    c.CopyAssign(endC);
                    c.ConvertToCMYK();
                    endC = c;
                }

                for (int j = posStart; j <= posEnd; j++)
                {
                    int cyan    = (int)Math.Floor((double)(startC.CMYKCyan + (endC.CMYKCyan - startC.CMYKCyan) * (j - posStart) / (posEnd - posStart)));
                    int magenta = (int)Math.Floor((double)(startC.CMYKMagenta + (endC.CMYKMagenta - startC.CMYKMagenta) * (j - posStart) / (posEnd - posStart)));
                    int yellow  = (int)Math.Floor((double)(startC.CMYKYellow + (endC.CMYKYellow - startC.CMYKYellow) * (j - posStart) / (posEnd - posStart)));
                    int black   = (int)Math.Floor((double)(startC.CMYKBlack + (endC.CMYKBlack - startC.CMYKBlack) * (j - posStart) / (posEnd - posStart)));

                    fountainColorTint[j].CMYKAssign(cyan, magenta, yellow, black);
                }
            }

            cnvToColorSpaceColorBar.Background = ConvertFromFountain(ff);
        }
Esempio n. 3
0
        private LinearGradientBrush ConvertFromFountain(corel.FountainFill ff)
        {
            LinearGradientBrush lgBrush = new LinearGradientBrush();

            lgBrush.StartPoint = new System.Windows.Point(0, 0.5);
            lgBrush.EndPoint   = new System.Windows.Point(1, 0.5);

            foreach (corel.FountainColor fc in ff.Colors)
            {
                corel.Color c = new corel.Color();
                c.CopyAssign(fc.Color);
                c.ConvertToRGB();
                float pos = fc.Position;

                System.Windows.Media.Color bc = System.Windows.Media.Color.FromRgb((byte)c.RGBRed, (byte)c.RGBGreen, (byte)c.RGBBlue);

                GradientStop gs = new GradientStop(bc, pos / 100f);

                lgBrush.GradientStops.Add(gs);
            }

            return(lgBrush);
        }