예제 #1
0
 private void SaveTile(GDIBigLockedImage compositeImage)
 {
     try
     {
         ImageRef imageRef = new ImageRef(new ImageRefCounted(compositeImage));
         GDIBigLockedImage.Transparentness transparentness = imageRef.image.GetTransparentness();
         if (transparentness == GDIBigLockedImage.Transparentness.EntirelyTransparent)
         {
             D.Sayf(0, "skipping blank tile.", new object[0]);
         }
         else
         {
             if (this.outputTileType == OutputTileType.IPIC)
             {
                 if (transparentness == GDIBigLockedImage.Transparentness.EntirelyOpaque)
                 {
                     this.outputTileType = OutputTileType.JPG;
                 }
                 else
                 {
                     this.outputTileType = OutputTileType.PNG;
                 }
             }
             RenderOutputUtil.SaveImage(imageRef, this.renderOutput, this.outputFilename, this.outputTileType.imageFormat);
         }
         this.feedback.PostImageResult(imageRef, this.layer, "(composite)", this.address);
         imageRef.Dispose();
     }
     catch (Exception arg)
     {
         this.feedback.PostMessage(string.Format("Can't create {0}: {1}", this.outputFilename, arg));
     }
 }
예제 #2
0
        private void ReplacePreviewImage(ImageRef newImage)
        {
            if (previewImage != null)
            {
                previewImage.Dispose();
            }

            previewImage = newImage;
        }
예제 #3
0
        private void previewPanel_Paint(object sender, PaintEventArgs e)
        {
            HandleUpdate();
            ImageRef imageRef = null;

            Monitor.Enter(this);
            try
            {
                if (previewImage != null)
                {
                    imageRef = (ImageRef)previewImage.Duplicate("LegendOptionsPanel.previewPanel_Paint");
                }
            }
            finally
            {
                Monitor.Exit(this);
            }

            if (imageRef != null)
            {
                try
                {
                    GDIBigLockedImage image;
                    Monitor.Enter(image = imageRef.image);
                    try
                    {
                        Image image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
                        e.Graphics.DrawImage(image2,
                                             new Rectangle(new Point(0, 0), previewPanel.Size),
                                             new Rectangle(new Point(0, 0), previewPanel.Size),
                                             GraphicsUnit.Pixel);
                    }
                    finally
                    {
                        Monitor.Exit(image);
                    }
                }
                catch (Exception)
                {
                    D.Say(0, "Absorbing that disturbing bug wherein the mostRecentTile image is corrupt.");
                }

                imageRef.Dispose();
                return;
            }

            e.Graphics.DrawRectangle(new Pen(Color.Black),
                                     0,
                                     0,
                                     previewPanel.Size.Width - 1,
                                     previewPanel.Height - 1);
        }
예제 #4
0
            public override void Destroy()
            {
                // free our C# reference so Dalvik can clean up
                // the resources.
                if (ImageView != null && ImageView.Drawable != null)
                {
                    ImageView.Drawable.Dispose( );
                    ImageView.SetImageBitmap(null);
                }

                if (ImageRef != null)
                {
                    ImageRef.Recycle( );
                    ImageRef.Dispose( );
                    ImageRef = null;
                }
            }
예제 #5
0
        private void UpdatePreviewImage(ImageRef imageRef)
        {
            Monitor.Enter(this);
            try
            {
                if (previewImage != null)
                {
                    previewImage.Dispose();
                    previewImage = null;
                }

                if (imageRef != null)
                {
                    previewImage = (ImageRef)imageRef.Duplicate("LegendOptionsPanel.UpdatePreviewImage");
                }
            }
            finally
            {
                Monitor.Exit(this);
            }

            Invalidate();
        }
예제 #6
0
        public Pixel GetBaseLayerCenterPixel()
        {
            IDisplayableSource         displayableSource       = this.baseLayer;
            CoordinateSystemIfc        defaultCoordinateSystem = displayableSource.GetDefaultCoordinateSystem();
            TileDisplayDescriptorArray tileArrayDescriptor     = defaultCoordinateSystem.GetTileArrayDescriptor(this.center().llz, base.Size);
            int num  = base.Size.Width / 2;
            int num2 = base.Size.Height / 2;

            foreach (TileDisplayDescriptor current in tileArrayDescriptor)
            {
                Rectangle paintLocation = current.paintLocation;
                if (paintLocation.Left <= num)
                {
                    Rectangle paintLocation2 = current.paintLocation;
                    if (paintLocation2.Right > num)
                    {
                        Rectangle paintLocation3 = current.paintLocation;
                        if (paintLocation3.Top <= num2)
                        {
                            Rectangle paintLocation4 = current.paintLocation;
                            if (paintLocation4.Bottom > num2)
                            {
                                int       arg_D1_0       = num;
                                Rectangle paintLocation5 = current.paintLocation;
                                int       x              = arg_D1_0 - paintLocation5.Left;
                                int       arg_E6_0       = num2;
                                Rectangle paintLocation6 = current.paintLocation;
                                int       y              = arg_E6_0 - paintLocation6.Top;
                                Present   present        = displayableSource.GetImagePrototype(null, (FutureFeatures)19).Curry(new ParamDict(new object[]
                                {
                                    TermName.TileAddress,
                                    current.tileAddress
                                })).Realize("ViewerControl.GetBaseLayerCenterPixel imageRef");
                                Pixel result;
                                if (!(present is ImageRef))
                                {
                                    result = new UndefinedPixel();
                                    return(result);
                                }
                                ImageRef          imageRef = (ImageRef)present;
                                GDIBigLockedImage image;
                                Monitor.Enter(image = imageRef.image);
                                Pixel pixel2;
                                try
                                {
                                    Image  image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
                                    Bitmap bitmap = (Bitmap)image2;
                                    Color  pixel  = bitmap.GetPixel(x, y);
                                    pixel2 = new Pixel(pixel);
                                }
                                finally
                                {
                                    Monitor.Exit(image);
                                }
                                imageRef.Dispose();
                                result = pixel2;
                                return(result);
                            }
                        }
                    }
                }
            }
            return(new UndefinedPixel());
        }
예제 #7
0
 public void Dispose()
 {
     imageRef.Dispose();
 }