Example #1
0
 public void Dispose()
 {
     Monitor.Enter(this);
     try
     {
         if (this.gdiGraphics != null)
         {
             this.gdiGraphics.Dispose();
             FIBR.Announce("GDIBigLockedImage.Dispose(graphics)", new object[]
             {
                 MakeObjectID.Maker.make(this)
             });
         }
         FIBR.Announce("GDIBigLockedImage.Dispose(image)", new object[]
         {
             MakeObjectID.Maker.make(this)
         });
         this.gdiImage.Dispose();
         this.CrementCounter(-1);
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #2
0
 public void DrawImageOntoThis(GDIBigLockedImage gDISImage, RectangleF destRect, RectangleF srcRect)
 {
     Monitor.Enter(this);
     try
     {
         Graphics gDIGraphics = this.GetGDIGraphics();
         Monitor.Enter(gDISImage);
         try
         {
             gDIGraphics.DrawImage(gDISImage.gdiImage, destRect, srcRect, GraphicsUnit.Pixel);
         }
         finally
         {
             Monitor.Exit(gDISImage);
         }
         this.gdiGraphics.Dispose();
         this.gdiGraphics = null;
         FIBR.Announce("GDIBigLockedImage.DrawImageOntoThis", new object[]
         {
             MakeObjectID.Maker.make(this),
             MakeObjectID.Maker.make(gDISImage),
             destRect,
             srcRect
         });
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #3
0
 public GDIBigLockedImage(Size size, string sourceLabel)
 {
     gdiImage = new Bitmap(size.Width, size.Height);
     FIBR.Announce("GDIBigLockedImage.GDIBigLockedImage", new object[] { MakeObjectID.Maker.make(this), size });
     this.sourceLabel = sourceLabel;
     CrementCounter(1);
 }
Example #4
0
        public RectangleF GetPageSize()
        {
            object foxitMutex;

            Monitor.Enter(foxitMutex = FoxitViewer.FoxitMutex);
            RectangleF result;

            try
            {
                RectangleF rectangleF = default(RectangleF);
                double     num        = this.foxitLib.GetPageWidth(this.pageHandle);
                rectangleF.Width = (float)num;
                num = this.foxitLib.GetPageHeight(this.pageHandle);
                rectangleF.Height = (float)num;
                FIBR.Announce("FoxitViewer.GetPageSize", new object[]
                {
                    MakeObjectID.Maker.make(this)
                });
                result = rectangleF;
            }
            finally
            {
                Monitor.Exit(foxitMutex);
            }
            return(result);
        }
Example #5
0
        public FoxitViewer(string filename, int pageNumber)
        {
            object foxitMutex;

            Monitor.Enter(foxitMutex = FoxitMutex);
            try
            {
                if (foxitLib == null)
                {
                    throw FoxitLibManager.theInstance.loadException;
                }

                this.filename = filename;
                foxitLib.UnlockDLL("SDKRDYX1645", "3A6DE5356500929A15F3E6517416F91635E336C0");
                if ((docHandle = foxitLib.LoadDocument(filename, null)) == 0)
                {
                    throw new Exception("Can't open " + filename);
                }

                numPages = foxitLib.GetPageCount(docHandle);
                if ((pageHandle = foxitLib.LoadPage(docHandle, pageNumber)) == 0)
                {
                    foxitLib.CloseDocument(docHandle);
                    throw new Exception("Can't open first page of " + filename);
                }

                FIBR.Announce("FoxitViewer.FoxitViewer",
                              new object[] { MakeObjectID.Maker.make(this), filename, pageNumber });
                foxitResourceCounter.crement(1);
            }
            finally
            {
                Monitor.Exit(foxitMutex);
            }
        }
Example #6
0
        public static GDIBigLockedImage FromStream(Stream instream)
        {
            GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage("FromStream");

            gDIBigLockedImage.gdiImage = Image.FromStream(instream);
            FIBR.Announce("GDIBigLockedImage.FromStream", new object[] { MakeObjectID.Maker.make(gDIBigLockedImage) });
            return(gDIBigLockedImage);
        }
Example #7
0
        public static GDIBigLockedImage FromFile(string filename)
        {
            GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage("FromFile");

            gDIBigLockedImage.gdiImage = Image.FromFile(filename);
            FIBR.Announce("GDIBigLockedImage.FromFile",
                          new object[] { MakeObjectID.Maker.make(gDIBigLockedImage), filename });
            return(gDIBigLockedImage);
        }
Example #8
0
 public void SetClip(Region clipRegion)
 {
     Monitor.Enter(this);
     try
     {
         GetGDIGraphics().Clip = clipRegion;
         FIBR.Announce("GDIBigLockedImage.SetClip", new object[] { MakeObjectID.Maker.make(this) });
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #9
0
 public void Save(string outputFilename)
 {
     Monitor.Enter(this);
     try
     {
         gdiImage.Save(outputFilename);
         FIBR.Announce("GDIBigLockedImage.Save", new object[] { MakeObjectID.Maker.make(this), outputFilename });
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #10
0
 public void Save(Stream outputStream, ImageFormat imageFormat)
 {
     Monitor.Enter(this);
     try
     {
         gdiImage.Save(outputStream, imageFormat);
         FIBR.Announce("GDIBigLockedImage.Save", new object[] { MakeObjectID.Maker.make(this), "stream" });
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #11
0
 internal void DisposeGraphics()
 {
     Monitor.Enter(this);
     try
     {
         if (gdiGraphics != null)
         {
             gdiGraphics.Dispose();
             gdiGraphics = null;
             FIBR.Announce("GDIBigLockedImage.DisposeGraphics", new object[] { MakeObjectID.Maker.make(this) });
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Example #12
0
        public void Dispose()
        {
            object foxitMutex;

            Monitor.Enter(foxitMutex = FoxitMutex);
            try
            {
                foxitLib.ClosePage(pageHandle);
                foxitLib.CloseDocument(docHandle);
                FIBR.Announce("FoxitViewer.Dispose", new object[] { MakeObjectID.Maker.make(this) });
                foxitResourceCounter.crement(-1);
            }
            finally
            {
                Monitor.Exit(foxitMutex);
            }
        }
Example #13
0
        private Graphics GetGDIGraphics()
        {
            if (gdiGraphics == null)
            {
                Monitor.Enter(this);
                try
                {
                    gdiGraphics = Graphics.FromImage(gdiImage);
                    FIBR.Announce("GDIBigLockedImage.GetGDIGraphics", new object[] { MakeObjectID.Maker.make(this) });
                }
                finally
                {
                    Monitor.Exit(this);
                }
            }

            return(gdiGraphics);
        }