Exemplo n.º 1
0
        /// <summary>
        /// Create bitmap based on given parameters.
        /// </summary>
        /// <param name="width">Required width.</param>
        /// <param name="height">Required height.</param>
        /// <param name="format">Required format.</param>
        /// <param name="buffer">Required buffer.</param>
        /// <param name="stride">Required stride.</param>
        public void Create(int width, int height, BitmapFormat format, IntPtr buffer, int stride)
        {
            if (width <= 0)
            {
                throw new ArgumentException($"Parameter {nameof(width)} has wrong value - {width}");
            }

            if (height <= 0)
            {
                throw new ArgumentException($"Parameter {nameof(height)} has wrong value - {height}");
            }

            Width  = width;
            Height = height;

            _bitmapHandle = _mainComponent.PDFiumBridge.FPDFBitmap_CreateEx(Width, Height, (FPDFBitmapFormat)format, buffer, stride);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Set <paramref name="bitmap" /> to <paramref name="image_object" />.
 /// </summary>
 /// <param name="loadedPages">All loaded pages, may be <c>null</c>.</param>
 /// <param name="image_object">Handle to an image object.</param>
 /// <param name="bitmap">Handle of the bitmap.</param>
 /// <returns><c>true</c> on success.</returns>
 public static bool FPDFImageObj_SetBitmap(FPDF_PAGE[] loadedPages, FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap)
 => FPDFImageObj_SetBitmap(ref loadedPages[0], loadedPages.Length, image_object, bitmap);
Exemplo n.º 3
0
        public void FPDF_BITMAP_Constructor_Call1_Success()
        {
            var h = new FPDF_BITMAP();

            Assert.IsFalse(h.IsValid);
        }
Exemplo n.º 4
0
        public void FPDF_BITMAP_Constructor_Call2_Success()
        {
            var h = new FPDF_BITMAP(new IntPtr(1));

            Assert.IsTrue(h.IsValid);
        }