CreateDIBSection() private method

private CreateDIBSection ( IntPtr hdc, [ pbmi, uint pila, IntPtr &ppvBits, IntPtr hSection, uint dwOffset ) : IntPtr
hdc IntPtr
pbmi [
pila uint
ppvBits IntPtr
hSection IntPtr
dwOffset uint
return IntPtr
Example #1
0
        /// <summary>
        /// Resizes the section.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="bitCount">The bit count.</param>
        public void Resize(int width, int height, int bitCount)
        {
            //	Destroy existing objects.
            this.DestroyBitmap();

            //  Set parameters.
            this.Width  = width;
            this.Height = height;

            //	Create a bitmap info structure.
            var info = new BitmapInfo();

            info.Init();

            //	Set the data.
            info.biBitCount = (short)bitCount;
            info.biPlanes   = 1;
            info.biWidth    = width;
            info.biHeight   = height;

            //	Create the bitmap.
            this.HBitmap = Win32.CreateDIBSection(this.MemoryDeviceContext, ref info, Win32.DIB_RGB_COLORS,
                                                  out this.bits, IntPtr.Zero, 0);

            Win32.SelectObject(this.MemoryDeviceContext, this.HBitmap);
        }
Example #2
0
        /// <summary>
        /// Creates the specified width.
        /// </summary>
        /// <param name="deviceContext"></param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="bitCount">The bit count.</param>
        /// <returns></returns>
        public virtual bool Create(IntPtr deviceContext, int width, int height, int bitCount)
        {
            this.Width  = width;
            this.Height = height;
            this.MemoryDeviceContext = Win32.CreateCompatibleDC(deviceContext);

            //	Destroy existing objects.
            this.DestroyBitmap();

            //	Create a bitmap info structure.
            var info = new BitmapInfo();

            info.Init();

            //	Set the data.
            info.biBitCount = (short)bitCount;
            info.biPlanes   = 1;
            info.biWidth    = width;
            info.biHeight   = height;

            //	Create the bitmap.
            this.HBitmap = Win32.CreateDIBSection(this.MemoryDeviceContext, ref info, Win32.DIB_RGB_COLORS,
                                                  out this.bits, IntPtr.Zero, 0);

            Win32.SelectObject(this.MemoryDeviceContext, this.HBitmap);

            //	Set the OpenGL pixel format.
            SetPixelFormat(this.MemoryDeviceContext, bitCount);

            return(true);
        }
Example #3
0
        /// <summary>
        /// Resizes the section.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="bitCount">The bit count.</param>
        public void Resize(int width, int height, int bitCount)
        {
            //	Destroy existing objects.
            Destroy();

            //  Set parameters.
            Width  = width;
            Height = height;

            //	Create a bitmap info structure.
            BITMAPINFO info = new BITMAPINFO();

            info.Init();

            //	Set the data.
            info.biBitCount = (short)bitCount;
            info.biPlanes   = 1;
            info.biWidth    = width;
            info.biHeight   = height;

            //	Create the bitmap.
            HBitmap = Win32.CreateDIBSection(parentDC, ref info, Win32.DIB_RGB_COLORS,
                                             out bits, IntPtr.Zero, 0);

            Win32.SelectObject(parentDC, HBitmap);
        }
Example #4
0
        /// <summary>
        /// Creates the specified width.
        /// </summary>
        /// <param name="deviceContext"></param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="parameters">parameters.</param>
        public DIBSection(IntPtr deviceContext, int width, int height, ContextGenerationParams parameters)
        {
            this.Width  = width;
            this.Height = height;
            this.MemoryDeviceContext = Win32.CreateCompatibleDC(deviceContext);

            //	Destroy existing objects.
            this.DestroyBitmap();

            //	Create a bitmap info structure.
            var info = new BitmapInfo();

            info.Init();

            //	Set the data.
            info.biBitCount = parameters.ColorBits;
            info.biPlanes   = 1;
            info.biWidth    = width;
            info.biHeight   = height;

            //	Create the bitmap.
            IntPtr mdc = this.MemoryDeviceContext;

            this.HBitmap = Win32.CreateDIBSection(mdc, ref info, Win32.DIB_RGB_COLORS, out this.bits, IntPtr.Zero, 0);

            Win32.SelectObject(mdc, this.HBitmap);

            //	Set the OpenGL pixel format.
            this.SetPixelFormat(mdc, parameters);
        }
Example #5
0
        /// <summary>
        /// Creates the specified width.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="bitCount">The bit count.</param>
        /// <returns></returns>
        public virtual bool Create(IntPtr hDC, int width, int height, int bitCount)
        {
            this.Width  = width;
            this.Height = height;
            parentDC    = hDC;

            //	Destroy existing objects.
            Destroy();

            //	Create a bitmap info structure.
            BITMAPINFO info = new BITMAPINFO();

            info.Init();

            //	Set the data.
            info.biBitCount = (short)bitCount;
            info.biPlanes   = 1;
            info.biWidth    = width;
            info.biHeight   = height;

            //	Create the bitmap.
            HBitmap = Win32.CreateDIBSection(hDC, ref info, Win32.DIB_RGB_COLORS,
                                             out bits, IntPtr.Zero, 0);

            Win32.SelectObject(hDC, HBitmap);

            //	Set the OpenGL pixel format.
            SetPixelFormat(hDC, bitCount);

            return(true);
        }