コード例 #1
0
ファイル: OverlayBase`1.cs プロジェクト: negingai/Daigassou
 public static extern IntPtr CreateDIBSection(
     IntPtr hdc,
     [In] ref NativeMethods.BitmapInfo pbmi,
     uint iUsage,
     out IntPtr ppvBits,
     IntPtr hSection,
     uint dwOffset);
コード例 #2
0
ファイル: DIBitmap.cs プロジェクト: alalwww/OverlayPlugin
        /// <summary>
        /// 幅と高さを指定してデバイス独立ビットマップを作成します。
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public DIBitmap(int width, int height)
        {
            this.IsDisposed = false;

            this.Width = width;
            this.Height = height;

            var hScreenDC = NativeMethods.CreateCompatibleDC(IntPtr.Zero);
            this.DeviceContext = NativeMethods.CreateCompatibleDC(hScreenDC);

            var bi = new NativeMethods.BitmapInfo();
            bi.bmiHeader.biSize = (uint)Marshal.SizeOf(bi);
            bi.bmiHeader.biBitCount = 32;
            bi.bmiHeader.biPlanes = 1;
            bi.bmiHeader.biWidth = width;
            bi.bmiHeader.biHeight = -height;

            IntPtr biBits;
            this.Handle = NativeMethods.CreateDIBSection(
                this.DeviceContext,
                ref bi,
                NativeMethods.DIB_RGB_COLORS,
                out biBits,
                IntPtr.Zero,
                0);
            this.Bits = biBits;
        }
コード例 #3
0
        public DIBitmap(int width, int height)
        {
            this.IsDisposed = false;

            this.Width  = width;
            this.Height = height;

            var hScreenDC = NativeMethods.CreateCompatibleDC(IntPtr.Zero);

            this.DeviceContext = NativeMethods.CreateCompatibleDC(hScreenDC);

            var bi = new NativeMethods.BitmapInfo();

            bi.bmiHeader.biSize     = (uint)Marshal.SizeOf(bi);
            bi.bmiHeader.biBitCount = 32;
            bi.bmiHeader.biPlanes   = 1;
            bi.bmiHeader.biWidth    = width;
            bi.bmiHeader.biHeight   = -height;

            IntPtr biBits;

            this.Handle = NativeMethods.CreateDIBSection(
                this.DeviceContext,
                ref bi,
                NativeMethods.DIB_RGB_COLORS,
                out biBits,
                IntPtr.Zero,
                0);
            this.Bits = biBits;
        }
コード例 #4
0
        public DIBitmap(int width, int height)
        {
            this.IsDisposed    = false;
            this.Width         = width;
            this.Height        = height;
            this.DeviceContext = NativeMethods.CreateCompatibleDC(NativeMethods.CreateCompatibleDC(IntPtr.Zero));
            NativeMethods.BitmapInfo pbmi = new NativeMethods.BitmapInfo();
            pbmi.bmiHeader.biSize     = (uint)Marshal.SizeOf((object)pbmi);
            pbmi.bmiHeader.biBitCount = (ushort)32;
            pbmi.bmiHeader.biPlanes   = (ushort)1;
            pbmi.bmiHeader.biWidth    = width;
            pbmi.bmiHeader.biHeight   = -height;
            IntPtr ppvBits;

            this.Handle = NativeMethods.CreateDIBSection(this.DeviceContext, ref pbmi, 0U, out ppvBits, IntPtr.Zero, 0U);
            this.Bits   = ppvBits;
        }