Beispiel #1
0
        private void btn_bulkEdit_Click(object sender, RoutedEventArgs e)
        {
            Corel.Interop.VGCore.ShapeRange sel = corelApp.ActiveDocument.SelectionRange;
            LatexEquation eq = ShapeTags.getLatexEquation(sel.FirstShape);

            if (eq != null)
            {
                m_sdialog.init(eq, "Bulk-edit style");
                m_sdialog.ShowDialog();
                if (m_sdialog.Result == System.Windows.Forms.DialogResult.OK)
                {
                    foreach (Corel.Interop.VGCore.Shape s in sel)
                    {
                        eq = ShapeTags.getLatexEquation(s);
                        m_sdialog.LatexEquation = eq;
                        if (m_sdialog.generateEquation())
                        {
                            Corel.Interop.VGCore.Shape latexObj = m_sdialog.LatexEquation.m_shape;
                            if (latexObj != null)
                            {
                                latexObj.TransformationMatrix = s.TransformationMatrix;
                                s.Delete();
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
 private void symbolToShape(corel.Shape s)
 {
     if (s.Type == corel.cdrShapeType.cdrSymbolShape)
     {
         s.Symbol.RevertToShapes();
     }
 }
Beispiel #3
0
 private void dropShadowBreakApart(corel.Shape s)
 {
     if (s.Type == corel.cdrShapeType.cdrDropShadowGroupShape)
     {
         s.Effect.DropShadow.ShadowGroup.Separate();
     }
 }
Beispiel #4
0
 private void lensEffectToBitmap(corel.Shape s)
 {
     if (s.Effects.LensEffect != null)
     {
         s.ConvertToBitmapEx(corel.cdrImageType.cdrCMYKColorImage, false, true, 300, corel.cdrAntiAliasingType.cdrNormalAntiAliasing, true, true, 95);
     }
 }
Beispiel #5
0
 private void textToCurves(corel.Shape s)
 {
     if (s.Type == Corel.Interop.VGCore.cdrShapeType.cdrTextShape)
     {
         s.ConvertToCurves();
     }
 }
 private void RemapInPowerClipShape(corel.Shape s)
 {
     corel.ShapeRange sr = s.PowerClip.Shapes.All();
     s.PowerClip.EnterEditMode();
     RemapInShapeRange(sr);
     s.PowerClip.LeaveEditMode();
 }
Beispiel #7
0
 private void contourGroupBreakApart(corel.Shape s)
 {
     if (s.Type == corel.cdrShapeType.cdrContourGroupShape)
     {
         s.Effect.Contour.ContourGroup.Separate();
     }
 }
        //开始导入排版
        private void button_startRun_Click(object sender, EventArgs e)
        {
            //for(int i = 1; i < 21; i++)
            //{
            //    string[] data = (string[])datas[i];
            //    int padding = 3;
            //    var sh_qrcode = myQrcode(dir + data[1] + ".jpg", 20 ,i * (20+padding), 0);
            //    //文字
            //    corelApp.ActiveLayer.CreateArtisticText(sh_qrcode.LeftX,sh_qrcode.TopY, data[1],Size:150);
            //}

            myOptimize(true, true);
            int count = 0;

            for (int x = 0; x < qrX; x++)
            {
                for (int y = 0; y < qrY; y++)
                {
                    string[] data      = (string[])datas[count];
                    int      Xpadding  = (int)numericUpDown3.Value;
                    int      Ypadding  = (int)numericUpDown4.Value;
                    int      size      = (int)numericUpDown5.Value;
                    var      sh_qrcode = myQrcode(dir + data[1] + ".jpg", size);
                    //文字
                    Shape text = corelApp.ActiveLayer.CreateArtisticText(sh_qrcode.CenterX, sh_qrcode.BottomY, data[1], Size: 5 * size);
                    sh_qrcode.SetPosition(x * (size + Xpadding), y * (size + text.SizeHeight + Ypadding));
                    text.CenterX = sh_qrcode.CenterX;
                    text.TopY    = sh_qrcode.BottomY - text.SizeHeight * 2 / 3;
                    count++;
                }
            }
            myOptimize(true, false);
        }
Beispiel #9
0
 private void powerClipShape(actionMethod method, corel.Shape s)
 {
     corel.ShapeRange sr = s.PowerClip.Shapes.All();
     s.PowerClip.EnterEditMode();
     forEachShapeOnShapeRange(method, sr);
     s.PowerClip.LeaveEditMode();
 }
        // convert

        private void RemapCdrBitmapShape(corel.Shape s)
        {
            if (s.Bitmap.Mode != cdrImageType.cdrBlackAndWhiteImage)
            {
                return;
            }
            RemapCdrSimpleShape(s);
        }
 public void DrawArrow(Corel.Interop.VGCore.Application app)
 {
     //Criando um segmento de linha com ponta de flecha
     Corel.Interop.VGCore.Shape line = app.ActiveDocument.ActiveLayer.CreateLineSegment(0, 0, 1.5, 0);
     line.Outline.EndArrow = app.ArrowHeads[2];
     //Inicio de flecha
     // line.Outline.StartArrow = app.ArrowHeads[2];
 }
Beispiel #12
0
 private void bitmapToGray(corel.Shape s)
 {
     if (s.Type == corel.cdrShapeType.cdrBitmapShape)
     {
         if (s.Bitmap.Mode != corel.cdrImageType.cdrGrayscaleImage)
         {
             s.Bitmap.ConvertTo(corel.cdrImageType.cdrGrayscaleImage);
         }
     }
 }
Beispiel #13
0
 private void bitmapToCMYK(corel.Shape s)
 {
     if (s.Type == corel.cdrShapeType.cdrBitmapShape)
     {
         if (s.Bitmap.Mode != corel.cdrImageType.cdrCMYKColorImage)
         {
             s.Bitmap.ConvertTo(corel.cdrImageType.cdrCMYKColorImage);
         }
     }
 }
        private void RemapCdrSimpleShape(corel.Shape s)
        {
            if (applyFill && s.CanHaveFill)
            {
                switch (s.Fill.Type)
                {
                case cdrFillType.cdrFountainFill:
                    RemapFountainFill(s.Fill.Fountain);
                    break;

                case cdrFillType.cdrHatchFill:
                    break;

                case cdrFillType.cdrNoFill:
                    break;

                case cdrFillType.cdrPatternFill:
                    break;

                case cdrFillType.cdrPostscriptFill:
                    break;

                case cdrFillType.cdrTextureFill:
                    break;

                case cdrFillType.cdrUniformFill:
                    RemapUniformFill(s.Fill);
                    break;

                default:
                    break;
                }
            }

            if (applyOutline && s.CanHaveOutline)
            {
                switch (s.Outline.Type)
                {
                case cdrOutlineType.cdrEnhancedOutline:
                    RamapOutline(s.Outline);
                    break;

                case cdrOutlineType.cdrNoOutline:
                    break;

                case cdrOutlineType.cdrOutline:
                    RamapOutline(s.Outline);
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #15
0
        private void resampleBitmap(corel.Shape s)
        {
            int resolution = tbBitmapDpi.Value;

            if (s.Type == corel.cdrShapeType.cdrBitmapShape)
            {
                if (s.Bitmap.ResolutionX != resolution || s.Bitmap.ResolutionY != resolution)
                {
                    s.Bitmap.Resample(0, 0, true, resolution, resolution);
                }
            }
        }
Beispiel #16
0
 private void uniformFillToCMYK(corel.Shape s)
 {
     if (s.CanHaveFill)
     {
         if (s.Fill.Type == corel.cdrFillType.cdrUniformFill)
         {
             if (s.Fill.UniformColor.Type != corel.cdrColorType.cdrColorCMYK)
             {
                 s.Fill.UniformColor.ConvertToCMYK();
             }
         }
     }
 }
Beispiel #17
0
 private void replaceOutlineColor(corel.Shape s)
 {
     if (s.CanHaveOutline)
     {
         if (s.Outline.Type == corel.cdrOutlineType.cdrOutline)
         {
             if (s.Outline.Color.IsSame(replaceColor))
             {
                 s.Outline.Color = applyColor;
             }
         }
     }
 }
Beispiel #18
0
 private void outlineFillToCMYK(corel.Shape s)
 {
     if (s.CanHaveOutline)
     {
         if (s.Outline.Type == corel.cdrOutlineType.cdrOutline)
         {
             if (s.Outline.Color.Type != corel.cdrColorType.cdrColorCMYK)
             {
                 s.Outline.Color.ConvertToCMYK();
             }
         }
     }
 }
Beispiel #19
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);
        }
Beispiel #20
0
 private void fountainFillToCMYK(corel.Shape s)
 {
     if (s.CanHaveFill)
     {
         if (s.Fill.Type == corel.cdrFillType.cdrFountainFill)
         {
             foreach (corel.FountainColor c in s.Fill.Fountain.Colors)
             {
                 if (c.Color.Type != corel.cdrColorType.cdrColorCMYK)
                 {
                     c.Color.ConvertToCMYK();
                 }
             }
         }
     }
 }
Beispiel #21
0
 // какогото хрена идет двойной вызов
 // закаментил else
 private void textShape(actionMethod method, corel.Shape s)
 {
     if (method == textToCurves)
     {
         method(s);
     }
     if (method == uniformFillToCMYK)
     {
         textUniformFillToCMYK(s.Text.Story.Characters);
     }
     if (method == outlineFillToCMYK)
     {
         textOutlineFillToCMYK(s.Text.Story.Characters);
     }
     //else method(s);
 }
Beispiel #22
0
 public void ChangeColor(Corel.Interop.VGCore.Application app)
 {
     try
     {
         corel.Shapes sh     = app.ActiveDocument.ActiveLayer.Shapes;
         Random       random = new Random();
         for (int i = 1; i <= sh.Count; i++)
         {
             corel.Shape s = sh[i];
             if (s.Selected)
             {
                 s.Fill.UniformColor.CMYAssign(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
             }
         }
     }
     catch (Exception ex)
     {
         txtBox_Info.Text = ex.Message;
     }
 }
Beispiel #23
0
 private void LinkText(corel.Application app)
 {
     try
     {
         corel.ShapeRange sr = app.ActiveSelectionRange;
         for (int i = 1; i <= sr.Count; i++)
         {
             if (sr[i] != null && sr[i].Type != corel.cdrShapeType.cdrTextShape)
             {
                 txtBox_Info.Text = "Add Text";
                 corel.Layer s_l = sr[i].Layer;
                 corel.Shape s1  = s_l.CreateArtisticText(5, 6, "Text_123");
                 s1.Fill.UniformColor.CMYKAssign(0, 0, 0, 100);
                 s1.Outline.SetNoOutline();
                 corel.Shape s2 = s_l.CreateConnectorEx(corel.cdrConnectorType.cdrConnectorStraight, sr[i].SnapPoints.Object(corel.cdrObjectSnapPointType.cdrObjectPointRight), app.ActiveDocument.CreateFreeSnapPoint(6, 6));
                 s2.Connector.EndPoint = s1.SnapPoints.Object(corel.cdrObjectSnapPointType.cdrObjectPointTop);
             }
         }
         //corel.Shapes sh = app.ActiveDocument.ActiveLayer.Shapes;
         //for (int i = 1; i <= sh.Count; i++)
         //{
         //    corel.Shape s = sh[i];
         //    if (s.Selected && s.Type != corel.cdrShapeType.cdrTextShape)
         //    {
         //        corel.Shape s1 = app.ActiveLayer.CreateArtisticText(5, 6, "Text_123");
         //        s1.Fill.UniformColor.CMYKAssign(0, 0, 0, 100);
         //        s1.Outline.SetNoOutline();
         //        corel.Shape s2 = app.ActiveLayer.CreateConnectorEx(corel.cdrConnectorType.cdrConnectorStraight, s.SnapPoints.Object(corel.cdrObjectSnapPointType.cdrObjectPointRight), app.ActiveDocument.CreateFreeSnapPoint(6, 6));
         //        s2.Connector.EndPoint = s1.SnapPoints.Object(corel.cdrObjectSnapPointType.cdrObjectPointTop);
         //    }
         //}
     }
     catch (Exception ex)
     {
         txtBox_Info.Text = ex.Message;
     }
     finally
     {
     }
 }
Beispiel #24
0
        private void btn_gerarBitmap_Click(object sender, RoutedEventArgs e)
        {
            if (this.app.ActiveDocument == null)
            {
                global::System.Windows.MessageBox.Show("Abra um novo documento para gerar");
                return;
            }
            CreateBitmapLocal();
            this.app.ActiveLayer.Name    = "QrCode JPG";
            this.app.ActiveDocument.Unit = this.app.ActiveDocument.Rulers.HUnits;
            Corel.Interop.VGCore.Shape q = this.app.ActiveLayer.FindShape("temp_qrcode.jpg");
            int strSize = 221;

            if (Int32.TryParse(txt_size.Text, out strSize))
            {
                q.SetSize(strSize, strSize);
            }
            else
            {
                System.Windows.MessageBox.Show("Formato de tamanho inválido", "Aviso para Você!");
            }
        }
Beispiel #25
0
        public bool editLatexObject(Corel.Interop.VGCore.Shape s)
        {
            LatexEquation eq = ShapeTags.getLatexEquation(s);

            if (eq != null)
            {
                m_dialog.init(eq, "Edit latex object");

                m_dialog.ShowDialog();
                if (m_dialog.Result == System.Windows.Forms.DialogResult.OK)
                {
                    Corel.Interop.VGCore.Shape latexObj = m_dialog.LatexEquation.m_shape;
                    if (latexObj != null)
                    {
                        latexObj.TransformationMatrix = s.TransformationMatrix;
                        s.Delete();
                    }
                }
                return(true);
            }
            return(false);
        }
Beispiel #26
0
        private void testMethod(corel.Shape s)
        {
            //s.Fill.UniformColor.CMYKAssign(0, 100, 50, 0);

            if (s.Type == corel.cdrShapeType.cdrGuidelineShape)
            {
                s.Delete();
            }

            //string str = "";
            //corel.SeparationPlates plates;
            //corel.SeparationPlate plate;
            //plates = corelApp.ActiveDocument.PrintSettings.Separations.Plates;

            //for (int j = 1; j <= plates.Count; j++)
            //{
            //	plate = plates[j];
            //	if (plate.Enabled)
            //		str = str + plate.Color.ToString() + "\n";
            //}
            //MessageBox.Show(str);
        }
Beispiel #27
0
        private void oleShapesToCurves(corel.Shape s)
        {
            if (s.Type == Corel.Interop.VGCore.cdrShapeType.cdrOLEObjectShape)
            {
                corel.Rect  oleRect;
                corel.Shape vectShape;

                corel.Shape oleShape = s;
                oleRect = oleShape.BoundingBox;

                oleShape.Copy();
                corelApp.ActiveLayer.PasteSpecial("Metafile");
                vectShape = corelApp.ActiveSelection.Shapes.First;
                //vectShape.ConvertToCurves();
                vectShape.RotationAngle = oleShape.RotationAngle;
                vectShape.SetPosition(oleRect.Left, oleRect.Top);
                vectShape.SetSize(oleRect.Width, oleRect.Height);

                vectShape.TreeNode.LinkAfter(oleShape.TreeNode);
                oleShape.Delete();
            }
        }
Beispiel #28
0
        private void replaceFillColor(corel.Shape s)
        {
            if (s.CanHaveFill)
            {
                if (s.Fill.Type == corel.cdrFillType.cdrUniformFill)
                {
                    if (s.Fill.UniformColor.IsSame(replaceColor))
                    {
                        s.Fill.UniformColor = applyColor;
                    }
                }

                if (s.Fill.Type == corel.cdrFillType.cdrFountainFill)
                {
                    for (int i = 0; i < s.Fill.Fountain.Colors.Count; i++)
                    {
                        if (s.Fill.Fountain.Colors[i].Color.IsSame(replaceColor))
                        {
                            s.Fill.Fountain.Colors[i].Color = applyColor;
                        }
                    }
                }
            }
        }
Beispiel #29
0
        private void CreateVetorLocal2()
        {
            CreateBitmapLocal();
            Shapes shapes = this.app.ActiveLayer.Shapes;

            foreach (Corel.Interop.VGCore.Shape shape in shapes)
            {
                if (shape.Name == "temp_qrcode.jpg")
                {
                    double x, y, w, h;
                    shape.GetPosition(out x, out y);
                    shape.GetSize(out w, out h);

                    TraceSettings traceSettings = shape.Bitmap.Trace(cdrTraceType.cdrTraceLineDrawing);
                    traceSettings.DetailLevelPercent    = 100;
                    traceSettings.BackgroundRemovalMode = cdrTraceBackgroundMode.cdrTraceBackgroundAutomatic;
                    traceSettings.CornerSmoothness      = 0;
                    traceSettings.DeleteOriginalObject  = true;
                    traceSettings.RemoveBackground      = true;
                    traceSettings.RemoveEntireBackColor = true;
                    traceSettings.RemoveOverlap         = true;
                    traceSettings.SetColorCount(2);
                    traceSettings.SetColorMode(cdrColorType.cdrColorGray, cdrPaletteID.cdrCustom);
                    traceSettings.Smoothing = 0;
                    traceSettings.TraceType = cdrTraceType.cdrTraceClipart;
                    traceSettings.Finish();
                    Corel.Interop.VGCore.ShapeRange sr = new Corel.Interop.VGCore.ShapeRange();
                    foreach (Corel.Interop.VGCore.Shape s in this.app.ActiveLayer.Shapes)
                    {
                        sr.Add(s);
                    }
                    sr.CreateSelection();
                    Corel.Interop.VGCore.Shape qrShape = this.app.ActiveSelection;
                    Corel.Interop.VGCore.Shape cod     = this.app.ActiveSelection.Weld(qrShape);
                    cod.Name = "Cod";

                    Corel.Interop.VGCore.Color cWhite = new Corel.Interop.VGCore.Color();
                    cWhite.CMYKAssign(0, 0, 0, 0);
                    Corel.Interop.VGCore.Shape border = this.app.ActiveLayer.CreateRectangle2(x, y - h, w, h);
                    border.Fill.ApplyUniformFill(cWhite);
                    border.Outline.Width = 0;
                    border.OrderToBack();
                    border.Name = "Borda";
                    int strSize = 221;



                    cod.AddToSelection();
                    border.AddToSelection();
                    Corel.Interop.VGCore.Shape g = this.app.ActiveSelection.Group();
                    this.app.ActiveDocument.Unit = this.app.ActiveDocument.Rulers.HUnits;
                    if (Int32.TryParse(txt_size.Text, out strSize))
                    {
                        g.SetSize(strSize, strSize);
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Formato de tamanho inválido", "Aviso para Você!");
                    }
                }
            }
            this.app.ActiveLayer.Name = "QrCode Vetor";
        }
        private void RemapCdrTextShape(corel.Shape s)
        {
            if (textAsStory)
            {
                RemapCdrSimpleShape(s);
            }

            else
            {
                foreach (corel.TextRange tr in s.Text.Story.Characters)
                {
                    if (applyFill)
                    {
                        switch (tr.Fill.Type)
                        {
                        case cdrFillType.cdrFountainFill:
                            RemapFountainFill(tr.Fill.Fountain);
                            break;

                        case cdrFillType.cdrHatchFill:
                            break;

                        case cdrFillType.cdrNoFill:
                            break;

                        case cdrFillType.cdrPatternFill:
                            break;

                        case cdrFillType.cdrPostscriptFill:
                            break;

                        case cdrFillType.cdrTextureFill:
                            break;

                        case cdrFillType.cdrUniformFill:
                            RemapUniformFill(tr.Fill);
                            break;

                        default:
                            break;
                        }
                    }

                    if (applyOutline)
                    {
                        switch (tr.Outline.Type)
                        {
                        case cdrOutlineType.cdrEnhancedOutline:
                            RamapOutline(tr.Outline);
                            break;

                        case cdrOutlineType.cdrNoOutline:
                            break;

                        case cdrOutlineType.cdrOutline:
                            RamapOutline(tr.Outline);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }