Esempio n. 1
0
        public void Crop(int left, int top, int right, int bottom)
        {
            EnsureNotDisposed();
            FIBITMAP tmp_dib = FreeImage.Copy(this.Dib, left, top, right, bottom);

            if (!tmp_dib.IsNull)
            {
                this.ReplaceDib(tmp_dib);
            }
        }
Esempio n. 2
0
        /*
         * public bool GetGreyLevelHistogram(int number_of_bins, out ulong[] hist, out double range_per_bin)
         * {
         *  double max = 0.0;
         *
         *  FreeImage.GetMaxPosibleValueForFib(this.Dib, out max);
         *
         *  FreeImageType type = FreeImage.GetImageType(this.Dib);
         *
         *      bool isFloat = (type == FreeImageType.Float || type == FreeImageType.Double);
         *
         *  int number_of_bins = (int) Math.Ceiling(max) + 1;
         *
         *  range_per_bin = 1.0;
         *      if(isFloat || number_of_bins > 255)
         *      {
         *              number_of_bins = 256;
         *              range_per_bin = max / 256.0;
         *      }
         *
         *  double max = this.MaximumPossibleIntensityValue;
         *  range_per_bin = max / 256.0;
         *
         *  hist = new ulong[number_of_bins];
         *
         *  return FreeImage.Histogram(this.Dib, 0, max, number_of_bins, hist);
         * }
         */

        /*
         * public bool AdjustGamma(double gamma)
         * {
         *  return FreeImage.AdjustGamma(this.Dib, gamma);
         * }
         *
         * public bool AdjustBrightness(double brightness)
         * {
         *  return FreeImage.AdjustBrightness(this.Dib, brightness);
         * }
         *
         * public bool AdjustContrast(double contrast)
         * {
         *  return FreeImage.AdjustContrast(this.Dib, contrast);
         * }
         *
         * public bool Invert()
         * {
         *  return FreeImage.Invert(this.Dib);
         * }
         *
         * public bool Paste(FreeImageBitmap src, int left, int top, int alpha)
         * {
         *  return FreeImage.Paste(this.Dib, src.dib, left, top, alpha);
         * }
         *
         * public bool Paste(FreeImageBitmap src, Point location, int alpha)
         * {
         *  return this.Paste(src, location.X, location.Y, alpha);
         * }
         */

        public new FreeImageAlgorithmsBitmap Copy(int left, int top, int right, int bottom)
        {
            EnsureNotDisposed();
            FreeImageAlgorithmsBitmap result = null;
            FIBITMAP newDib = FreeImage.Copy(this.Dib, left, top, right, bottom);

            if (!newDib.IsNull)
            {
                result = new FreeImageAlgorithmsBitmap(newDib);
            }
            return(result);
        }