private void btnPickColorRemapColorRangeCMYK_Click(object sender, RoutedEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorCMYK)
                {
                    c.ConvertToCMYK();
                }

                tbRemapColorRangeCyanMin.Value    = c.CMYKCyan;
                tbRemapColorRangeCyanMax.Value    = c.CMYKCyan;
                tbRemapColorRangeMagentaMin.Value = c.CMYKMagenta;
                tbRemapColorRangeMagentaMax.Value = c.CMYKMagenta;
                tbRemapColorRangeYellowMin.Value  = c.CMYKYellow;
                tbRemapColorRangeYellowMax.Value  = c.CMYKYellow;
                tbRemapColorRangeBlackMin.Value   = c.CMYKBlack;
                tbRemapColorRangeBlackMax.Value   = c.CMYKBlack;
            }

            else
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorCMYK)
                {
                    c.ConvertToCMYK();
                }

                tbRemapColorRangeCyanMin.Value    = Math.Min(c.CMYKCyan, tbRemapColorRangeCyanMin.Value);
                tbRemapColorRangeMagentaMin.Value = Math.Min(c.CMYKMagenta, tbRemapColorRangeMagentaMin.Value);
                tbRemapColorRangeYellowMin.Value  = Math.Min(c.CMYKYellow, tbRemapColorRangeYellowMin.Value);
                tbRemapColorRangeBlackMin.Value   = Math.Min(c.CMYKBlack, tbRemapColorRangeBlackMin.Value);

                tbRemapColorRangeCyanMax.Value    = Math.Max(c.CMYKCyan, tbRemapColorRangeCyanMax.Value);
                tbRemapColorRangeMagentaMax.Value = Math.Max(c.CMYKMagenta, tbRemapColorRangeMagentaMax.Value);
                tbRemapColorRangeYellowMax.Value  = Math.Max(c.CMYKYellow, tbRemapColorRangeYellowMax.Value);
                tbRemapColorRangeBlackMax.Value   = Math.Max(c.CMYKBlack, tbRemapColorRangeBlackMax.Value);
            }
        }
        private void btnPickColorRemapColorRangeRGB_Click(object sender, RoutedEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorRGB)
                {
                    c.ConvertToRGB();
                }

                tbRemapColorRangeRedMin.Value   = c.RGBRed;
                tbRemapColorRangeRedMax.Value   = c.RGBRed;
                tbRemapColorRangeGreenMin.Value = c.RGBGreen;
                tbRemapColorRangeGreenMax.Value = c.RGBGreen;
                tbRemapColorRangeBlueMin.Value  = c.RGBBlue;
                tbRemapColorRangeBlueMax.Value  = c.RGBBlue;
            }

            else
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorRGB)
                {
                    c.ConvertToRGB();
                }

                tbRemapColorRangeRedMin.Value   = Math.Min(c.RGBRed, tbRemapColorRangeRedMin.Value);
                tbRemapColorRangeGreenMin.Value = Math.Min(c.RGBGreen, tbRemapColorRangeGreenMin.Value);
                tbRemapColorRangeBlueMin.Value  = Math.Min(c.RGBBlue, tbRemapColorRangeBlueMin.Value);

                tbRemapColorRangeRedMax.Value   = Math.Max(c.RGBRed, tbRemapColorRangeRedMax.Value);
                tbRemapColorRangeGreenMax.Value = Math.Max(c.RGBGreen, tbRemapColorRangeGreenMax.Value);
                tbRemapColorRangeBlueMax.Value  = Math.Max(c.RGBBlue, tbRemapColorRangeBlueMax.Value);
            }
        }
        private void btnPickColorRemapColorRangeGray_Click(object sender, RoutedEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorGray)
                {
                    c.ConvertToGray();
                }

                tbRemapColorRangeGrayMin.Value = c.Gray;
                tbRemapColorRangeGrayMax.Value = c.Gray;
            }

            else
            {
                corel.Color c = new corel.Color();
                if (!c.UserAssignEx())
                {
                    return;
                }

                if (c.Type != cdrColorType.cdrColorGray)
                {
                    c.ConvertToGray();
                }

                tbRemapColorRangeGrayMin.Value = Math.Min(c.Gray, tbRemapColorRangeGrayMin.Value);

                tbRemapColorRangeGrayMax.Value = Math.Max(c.Gray, tbRemapColorRangeGrayMax.Value);
            }
        }
Beispiel #4
0
 private void btnPickApplyColor_Click(object sender, RoutedEventArgs e)
 {
     applyColor.UserAssignEx();
     updateColorSampleBar();
 }
        public corel.Color Convert(corel.Color color)
        {
            string colorName;

            if (color.Type == cdrColorType.cdrColorSpot)
            {
                colorName = color.Name;

                // если спот из таблиц пантонов
                if (colorName.Contains("PANTONE"))
                {
                    colorName = colorName.Replace(" 2X", "");
                    colorName = colorName.Substring(0, colorName.LastIndexOf(' '));

                    //разные названия TransWhite
                    if (!colorName.Contains("Trans. White"))
                    {
                        colorName = colorName + " C";
                    }

                    // исправление неправильного названия в PANTONE MATCHING SYSTEM Coated - Corel 10
                    if (colorName == "PANTONE Relfex Blue C")
                    {
                        colorName = "PANTONE Reflex Blue C";
                    }
                }
            }

            else
            {
                colorName = color.HexValue.ToString();
            }

            // поиск в найденных цветах
            if (foundColors.ContainsKey(colorName))
            {
                corel.Color c = foundColors[colorName];
                // если спот сохранить тинт
                if (color.Type == cdrColorType.cdrColorSpot && color.IsTintable && c.IsSpot && c.IsTintable)
                {
                    c.Tint = color.Tint;
                    return(c);
                }
                else
                {
                    return(c);
                }
            }

            // поиск в палитрах корела если палитра Locked
            if (color.Type == cdrColorType.cdrColorSpot)
            {
                foreach (string id in palettesID)
                {
                    if (color.PaletteIdentifier != id)
                    {
                        corel.Palette castPalette = corelApp.PaletteManager.GetPalette(id);
                        int           colorID     = castPalette.FindColor(colorName);
                        if (colorID != 0)
                        {
                            corel.Color c = new Color();
                            c.PaletteAssign(castPalette.Identifier, colorID);
                            foundColors.Add(c.Name.ToString(), c);
                            c.Tint = color.Tint;
                            return(c);
                        }
                    }
                    else
                    {
                        return(color);
                    }
                }

                // если нигде нет
                if (MessageBox.Show("В палитрах ненайден цвет:\n" + color.Name + "\n" + "Заменить вручную?", "Ненайден цвет", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                {
                    corel.Color c = new corel.Color();
                    if (c.UserAssignEx())
                    {
                        // если спот учитывать тинт
                        foundColors.Add(colorName, c);
                        if (c.IsSpot && c.IsTintable)
                        {
                            c.Tint = color.Tint;
                        }
                        return(c);
                    }
                }
                else
                {
                    foundColors.Add(colorName, color);
                    return(color);
                }
            }

            else
            {
                corel.Color c = new corel.Color();
                c.CopyAssign(color);
                c.ConvertToPalette("6e75244b-d853-4d2e-bea2-a5da3f195d08");
                foundColors.Add(colorName, c);
                return(c);
            }

            return(color);
        }