Beispiel #1
0
        public bool KernelCorrelateImageRegions(FreeImageAlgorithmsBitmap src2, Rectangle rect1, Rectangle rect2,
                                                Rectangle search_area, FIBITMAP mask,
                                                CorrelationPrefilter prefilter, out Point pt, out double max)
        {
            FIARECT  fiaRect1   = new FIARECT(rect1);
            FIARECT  fiaRect2   = new FIARECT(rect2);
            FIARECT  searchRect = new FIARECT(search_area);
            FIAPOINT fiaPoint   = new FIAPOINT();

            bool ret = FreeImage.KernelCorrelateImageRegions(this.Dib, fiaRect1, src2.Dib, fiaRect2, searchRect, mask, prefilter, out fiaPoint, out max);

            pt = new Point(fiaPoint.x, fiaPoint.y);

            return(ret);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new ICC-Profile for <paramref name="dib" />.
        /// </summary>
        /// <param name="dib">Handle to a FreeImage bitmap.</param>
        /// <param name="data">The ICC-Profile data.</param>
        /// <param name="size">Number of bytes to use from data.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="dib" /> is null.
        /// </exception>
        public unsafe FIICCPROFILE(FIBITMAP dib, byte[] data, int size)
        {
            if (dib.IsNull)
            {
                throw new ArgumentNullException("dib");
            }

            FIICCPROFILE prof;

            size        = Math.Min(size, data.Length);
            prof        = *(FIICCPROFILE *)FreeImage.CreateICCProfile(dib, data, size);
            Flags       = prof.Flags;
            Size        = prof.Size;
            DataPointer = prof.DataPointer;
        }
Beispiel #3
0
        public FreeImageAlgorithmsBitmap(int width, int height, int colorDepth)
        {
            FIBITMAP dib = FreeImage.Allocate(width, height, colorDepth,
                                              FreeImage.FI_RGBA_RED_MASK,
                                              FreeImage.FI_RGBA_GREEN_MASK,
                                              FreeImage.FI_RGBA_BLUE_MASK);

            if (dib.IsNull)
            {
                throw new Exception("Unable to create bitmap.");
            }

            this.ReplaceDib(dib);

            this.SetGreyLevelPalette();
        }
        private static void InitializeMessage()
        {
            if (null == outputMessageFunction)
            {
                lock (outputMessageFunctionLock)
                {
                    if (null == outputMessageFunction)
                    {
                        FreeImage.ValidateAvailability();

                        try
                        {
                            // Create a delegate (function pointer) to 'OnMessage'
                            outputMessageFunction =
                                delegate(FREE_IMAGE_FORMAT fif, string message)
                            {
                                LastErrorMessage = message;

                                // Get a local copy of the multicast-delegate
                                OutputMessageFunction m = FreeImageEngine.message;

                                // Check the local copy instead of the static instance
                                // to prevent a second thread from setting the delegate
                                // to null, which would cause a nullreference exception
                                if (m != null)
                                {
                                    // Invoke the multicast-delegate
                                    m.Invoke(fif, message);
                                }
                            };

                            // Set the callback
                            FreeImage.SetOutputMessage(outputMessageFunction);
                        }
                        catch
                        {
                            outputMessageFunction = null;
                            throw;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public void PasteFromTopLeft(FreeImageAlgorithmsBitmap src, int left, int top, bool blending)
        {
            bool ret;

            if (blending)
            {
                ret = FreeImage.GradientBlendPasteFromTopLeft(this.Dib, src.Dib, left, top);
            }
            else
            {
                ret = FreeImage.PasteFromTopLeft(this.Dib, src.Dib, left, top);
            }

            if (ret == false)
            {
                string errorStr = String.Format(
                    "Can not paste freeimage. Dst image bpp {0}, Src image bpp {1}",
                    this.ColorDepth, src.ColorDepth);

                throw new FormatException(errorStr);
            }
        }
Beispiel #6
0
        public bool DrawSolidRectangle(Point location, Size size, double val)
        {
            FIARECT fiaRect = new FIARECT(location, size);

            return(FreeImage.DrawSolidRectangle(this.Dib, fiaRect, val));
        }
Beispiel #7
0
        public bool DrawSolidRectangle(Rectangle rect, double val)
        {
            FIARECT fiaRect = new FIARECT(rect.Left, rect.Top, rect.Right, rect.Bottom);

            return(FreeImage.DrawSolidRectangle(this.Dib, fiaRect, val));
        }
Beispiel #8
0
 public bool DrawSolidRectangle(FIARECT rect, double val)
 {
     return(FreeImage.DrawSolidRectangle(this.Dib, rect, val));
 }
Beispiel #9
0
 public bool Translate(double x, double y, FIA_MatrixOrder order)
 {
     return(FreeImage.MatrixTranslate(this.matrix, x, y, order));
 }
Beispiel #10
0
 public void DrawImage(FreeImageAlgorithmsBitmap dst, Rectangle dstRect, RGBQUAD colour)
 {
     FreeImage.DrawImageToDst(dst.Dib, this.Dib, FIA_Matrix.Zero,
                              dstRect.Left, dstRect.Top, dstRect.Width, dstRect.Height, colour, 1);
 }
Beispiel #11
0
 public bool DrawColourSolidRect(FIARECT rect, RGBQUAD colour)
 {
     return(FreeImage.DrawColourSolidRect(this.Dib, rect, colour));
 }
Beispiel #12
0
 public bool GradientBlendPasteFromTopLeft(FreeImageAlgorithmsBitmap src, int left, int top)
 {
     return(FreeImage.GradientBlendPasteFromTopLeft(this.Dib, src.Dib, left, top));
 }
Beispiel #13
0
 public bool GradientBlendPasteFromTopLeft(FreeImageAlgorithmsBitmap src, Point pt)
 {
     return(FreeImage.GradientBlendPasteFromTopLeft(this.Dib, src.Dib, pt.X, pt.Y));
 }
Beispiel #14
0
 public bool PasteFromTopLeft(FreeImageBitmap src, int left, int top)
 {
     return(FreeImage.PasteFromTopLeft(this.Dib, src.Dib, left, top));
 }
Beispiel #15
0
        public void AffineTransform(FreeImageAlgorithmsMatrix matrix, RGBQUAD colour)
        {
            FIBITMAP tmp_dib = FreeImage.AffineTransform(this.Dib, (int)this.Width, (int)this.Height, matrix.Data, colour, 1);

            this.ReplaceDib(tmp_dib);
        }
Beispiel #16
0
 public void DrawImage(FreeImageAlgorithmsBitmap dst, FreeImageAlgorithmsMatrix matrix,
                       int dstLeft, int dstTop, int dstWidth, int dstHeight, RGBQUAD colour)
 {
     FreeImage.DrawImageToDst(dst.Dib, this.Dib, matrix.Data,
                              dstLeft, dstTop, dstWidth, dstHeight, colour, 1);
 }
Beispiel #17
0
        public bool DrawColourSolidRect(Rectangle rect, RGBQUAD colour)
        {
            FIARECT fiaRect = new FIARECT(rect);

            return(FreeImage.DrawColourSolidRect(this.Dib, fiaRect, colour));
        }
Beispiel #18
0
 public void DrawImage(FreeImageAlgorithmsBitmap dst, Point dstPoint, Size dstSize, RGBQUAD colour)
 {
     FreeImage.DrawImageToDst(dst.Dib, this.Dib, FIA_Matrix.Zero,
                              dstPoint.X, dstPoint.Y, dstSize.Width, dstSize.Height, colour, 1);
 }
Beispiel #19
0
 public bool DrawColourRect(FIARECT rect, RGBQUAD colour, int lineWidth)
 {
     return(FreeImage.DrawColourRect(this.Dib, rect, colour, lineWidth));
 }
Beispiel #20
0
 public bool Rotate(double a, FIA_MatrixOrder order)
 {
     return(FreeImage.MatrixRotate(this.matrix, a, order));
 }
Beispiel #21
0
        public bool DrawColourRect(Rectangle rect, RGBQUAD colour, int lineWidth)
        {
            FIARECT fiaRect = new FIARECT(rect);

            return(FreeImage.DrawColourRect(this.Dib, fiaRect, colour, lineWidth));
        }