Beispiel #1
0
        public static void OpenImage(AxPXV_Control axPXV_Control1, out Bitmap btm, string imgPath)
        {
            btm = null;
            try
            {
                IIXC_Inst  inst         = (IIXC_Inst)axPXV_Control1.Inst.GetExtension("IXC"); //Create new instance
                IIXC_Image img_for_open = inst.CreateEmptyImage();                            //Crete new empty image for open file
                img_for_open.Load(imgPath);                                                   //Load image from it path

                IIXC_Page page_ixc = img_for_open.GetPage(0);                                 //Create new page from image
                page_ixc.ConvertToFormat(IXC_PageFormat.PageFormat_8Indexed);
                btm = new Bitmap((int)page_ixc.Width, (int)page_ixc.Height);                  //Converting by pixels page to C# bitmap
                for (int i = 0; i < page_ixc.Width; i++)
                {
                    for (int j = 0; j < page_ixc.Height; j++)
                    {
                        int   color = (int)page_ixc.GetPixel(i, j);
                        Color clr   = ColorTranslator.FromWin32(color);
                        btm.SetPixel(i, j, clr);
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
        static public int ConvertToPDF(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }

            IIXC_Inst  ixcInst = Parent.m_pxcInst.GetExtension("IXC");
            IAUX_Inst  auxInst = Parent.m_pxcInst.GetExtension("AUX");
            IPXC_Pages pages   = Parent.m_CurDoc.Pages;
            IPXC_Page  Page    = pages[0];
            double     nHeight = 0.0;
            double     nWidth  = 0.0;

            Page.GetDimension(out nWidth, out nHeight);
            IIXC_Image img = ixcInst.CreateEmptyImage();

            img.Load(System.Environment.CurrentDirectory + "\\Images\\Editor_welcome.png");
            IIXC_Page           ixcPage = img.GetPage(0);
            IPXC_Image          pxcImg  = Parent.m_CurDoc.AddImageFromIXCPage(ixcPage);
            IPXC_ContentCreator CC      = Parent.m_CurDoc.CreateContentCreator();
            PXC_Rect            rcImg   = new PXC_Rect();

            CC.SaveState();
            {
                //Proportional resize rectangle calculation
                {
                    double k1 = nWidth / nHeight;
                    double k2 = (double)pxcImg.Width / pxcImg.Height;
                    if (k1 >= k2)
                    {
                        rcImg.top   = nHeight;
                        rcImg.right = nWidth / 2.0 + rcImg.top * k2 / 2.0;
                        rcImg.left  = nWidth / 2.0 - rcImg.top * k2 / 2.0;
                    }
                    else
                    {
                        rcImg.right  = nWidth;
                        rcImg.top    = nHeight / 2.0 + rcImg.right / k2 / 2.0;
                        rcImg.bottom = nHeight / 2.0 - rcImg.right / k2 / 2.0;
                    }
                }
                //Moving the image rectangle to the center

                PXC_Rect rcImage = new PXC_Rect();
                rcImage.right = 1;
                rcImage.top   = 1;
                PXC_Matrix matrix = Page.GetMatrix(PXC_BoxType.PBox_PageBox);
                matrix = auxInst.MathHelper.Matrix_RectToRect(ref rcImage, ref rcImg);
                CC.ConcatCS(ref matrix);
                CC.PlaceImage(pxcImg);
            }
            CC.RestoreState();
            Page.PlaceContent(CC.Detach());

            Marshal.ReleaseComObject(Page);
            Marshal.ReleaseComObject(pages);

            return((int)Form1.eFormUpdateFlags.efuf_All);
        }
 public void OpenImage(Bitmap btm, string imgPath, IIXC_Image img_for_open, IIXC_Inst inst, IXC_PageFormat pgFmt)
 { 
     btm = null;
     img_for_open.Load(imgPath); //Load image from it path
     IIXC_Page page_ixc = img_for_open.GetPage(0);
     page_ixc.ConvertToFormat(pgFmt);
     btm = new Bitmap((int)page_ixc.Width, (int)page_ixc.Height); //Converting by pixels page to C# bitmap
     for (int i = 0; i < page_ixc.Width; i++)
     {
         for (int j = 0; j < page_ixc.Height; j++)
         {
             int color = (int)page_ixc.GetPixel(i, j);
             Color clr = ColorTranslator.FromWin32(color);
             btm.SetPixel(i, j, clr);
         }
     }
 }
Beispiel #4
0
        public void OpenImage(Bitmap btm, string imgPath, IIXC_Image img_for_open, IIXC_Inst inst, IXC_PageFormat pgFmt)
        {
            btm = null;
            img_for_open.Load(imgPath); //Load image from it path
            IIXC_Page page_ixc = img_for_open.GetPage(0);

            page_ixc.ConvertToFormat(pgFmt);
            btm = new Bitmap((int)page_ixc.Width, (int)page_ixc.Height); //Converting by pixels page to C# bitmap
            for (int i = 0; i < page_ixc.Width; i++)
            {
                for (int j = 0; j < page_ixc.Height; j++)
                {
                    int   color = (int)page_ixc.GetPixel(i, j);
                    Color clr   = ColorTranslator.FromWin32(color);
                    btm.SetPixel(i, j, clr);
                }
            }
        }