Desktop Functions: Smart Device Functions:
|
Search Results for "BITMAP" in [All]kernel32
FsctlGetVolumeBitmap = (EFileDevice.FileSystem << 16) | (27 << 2) | EMethod.Neither | (0 << 14),
BITMAP = 2,
BITMAP = 2
private const uint RT_BITMAP = 0x00000002; 3: MoveMemory Public Function ConvertRBGTo1bpp(ByVal pSrcImg As Image) As Bitmap
Dim bitmap As Bitmap = New Bitmap(Width, Height, PixelFormat.Format1bppIndexed)
Dim BmpCopy As Bitmap = New Bitmap(Width, Height, PixelFormat.Format32bppArgb)
Dim bitmapData As BitmapData
bitmapData = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed)
Dim pixels As IntPtr = bitmapData.Scan0
If (bitmapData.Stride > 0) Then
pBits = pixels.ToInt32() + bitmapData.Stride * (Height - 1)
Dim stride As Integer = Math.Abs(bitmapData.Stride)
bitmap.UnlockBits(bitmapData)
Return bitmap opengl32
GL_BITMAP_TOKEN = 0x0704,
GL_BITMAP = 0x1A00,
public static extern void glBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, byte[] bitmap); Structures5: BITMAP
public struct BITMAPINFOHEADER
public BitmapCompressionMode biCompression;
Public Structure BITMAPINFOHEADER
Public biCompression As BitmapCompressionMode 7: BITMAPINFO
public struct BITMAPINFOHEADER
public BitmapCompressionMode biCompression;
Public Structure BITMAPINFOHEADER
Public biCompression As BitmapCompressionMode The BITMAPINFOHEADER contains information about the color space and dimensions of a DIB.
public struct BITMAPINFOHEADER
public BitmapCompressionMode biCompression;
Public Structure BITMAPINFOHEADER
Public biCompression As BitmapCompressionMode 9: FORMATETC
// The storage medium is a Graphics Device Interface (GDI) component (HBITMAP).
// the bitmap.
// the bitmap.
// the bitmap.
' The storage medium is a Graphics Device Interface (GDI) component (HBITMAP).
' the bitmap.
' the bitmap.
' the bitmap. 10: ICONINFO
/// The icon bitmask bitmap
/// A handle to the icon color bitmap.
''' The icon bitmask bitmap.
''' A handle to the icon color bitmap.
public int xBitmap;
public int yBitmap;
Public xBitmap As Integer
Public yBitmap As Integer Interfaces
void InitializeFromBitmap( 13: ISharedBitmap
14: IShellItem
IntPtr hbitmap = IntPtr.Zero;
((IShellItemImageFactory)ppsi).GetImage(new SIZE(256, 256), 0x0, out hbitmap);
IntPtr hbitmap = IntPtr.Zero;
((IShellItemImageFactory)ppsi).GetImage(new SIZE(256, 256), 0x0, out hbitmap); 16: IThumbnailCache
[Out][MarshalAs(UnmanagedType.Interface)] out ISharedBitmap ppvThumb,
[Out][MarshalAs(UnmanagedType.Interface)] out ISharedBitmap ppvThumb, 17: IUIImage
// Produces containers for bitmap images
public interface IUIImageFromBitmap
HRESULT CreateImage(IntPtr /* HBITMAP */ bitmap, UI_Ownership options, [Out(), MarshalAs(UnmanagedType.Interface)] out IUIImage image); user3219: CreateCaret
static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth,
Public Shared Function CreateCaret(ByVal hWnd As IntPtr, ByVal hBitmap As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As Boolean If you're using a Bitmap image to render the caret, the colour will be changed based on the background of the Control. To ensure that you have the expected colour, first apply an XOR mask:
Public Shared Function CreateCaret(ByVal hWnd As IntPtr, ByVal hBitmap As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As Boolean
Dim bmPtr As IntPtr = GetHBitmap()
The hBitmap parameter is a handle to the bitmap you want to use(or gray/solid).
Bitmaps have a method attached to return the handle
Function GetHBitmap() As IntPtr
Dim embeddedBitmap As Byte() = {137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 10, 0, 0, 0, 10, 8, 2, 0, 0, 0, 2, 80, 88, 234, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, 177, 143, 11, 252, 97, 5, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 14, 195, 0, 0, 14, 195, 1, 199, 111, 168, 100, 0, 0, 0, 48, 73, 68, 65, 84, 40, 83, 99, 248, 143, 23, 16, 39, 205, 192, 128, 162, 14, 206, 165, 138, 225, 184, 0, 204, 14, 252, 118, 3, 249, 8, 33, 100, 54, 132, 2, 2, 136, 40, 4, 64, 133, 144, 165, 177, 128, 255, 255, 1, 57, 41, 7, 8, 21, 108, 65, 188, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130}
Dim bm As Bitmap
Using s As New System.IO.MemoryStream(embeddedBitmap)
bm = CType(Bitmap.FromStream(s), Bitmap)
Return bm.GetHbitmap() 20: CreateIcon
public IntPtr MaskBitmap;
public IntPtr ColorBitmap;
Bitmap img = GetIconBitmap(...);
IntPtr imgHandle = img.GetHbitmap();
ii.MaskBitmap = imgHandle;
ii.ColorBitmap = imgHandle;
Bitmap.FromHicon()
public IntPtr MaskBitmap;
public IntPtr ColorBitmap;
Bitmap img = GetIconBitmap(...);
IntPtr imgHandle = img.GetHbitmap();
ii.MaskBitmap = imgHandle;
ii.ColorBitmap = imgHandle; 22: CreatePopupMenu
internal static extern int SetMenuItemBitmaps(HMenu hmenu, int nPosition, MFMENU uflags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked); 23: DestroyIcon
Bitmap bmp = (Bitmap)Image.FromFile(fileName); 24: EnableMenuItem
internal const UInt32 MF_USECHECKBITMAPS =0x00000200;
internal const UInt32 MF_BITMAP =0x00000004;
internal const UInt32 MFT_BITMAP =MF_BITMAP; 25: GetDesktopWindow
Dim myImage As Image = New Bitmap(size.Width, size.Height)
Dim bmp As New Bitmap(area.Width, area.Height) 26: GetGuiResources
/// - Win32 GDI objects (pens, brushes, fonts, palettes, regions, device contexts, bitmap headers)
/// - WIN32 resources (accelerator tables, bitmap resources, dialog box templates, font resources, menu resources, raw data resources, string table entries, message table entries, cursors/icons) 27: GetIconInfo
public IntPtr hbmMask; // (HBITMAP) Specifies the icon bitmask bitmap. If this structure defines a black and white icon,
public IntPtr hbmColor; // (HBITMAP) Handle to the icon color bitmap. This member can be optional if this
// flag to the destination; subsequently, the color bitmap is applied (using XOR) to the This function CREATES two GDI objects: bitmap hbmColor and bitmap hbmMask. Don't forget to delete them!!!
public Bitmap ColorBitmap {
return Image.FromHbitmap(ii.hbmColor);
public Bitmap MaskBitmap {
return Image.FromHbitmap(ii.hbmMask); 28: GetWindowDC
Private Function GetDecoratedFormImage() As Bitmap
' Make a Bitmap to hold the image.
Dim TempBMP As New Bitmap(Me.Width, Me.Height, MyGrph)
' creating the new Bitmap, which uses me_gr.
' BitBlt the form's image onto the Bitmap. 29: LoadBitmap
static extern IntPtr LoadBitmap(IntPtr hInstance, string lpBitmapName);
Declare Function LoadBitmap Lib "user32" Alias "LoadBitmapA" (ByVal hInstance As IntPtr, ByVal lpBitmapName As String) As IntPtr
static extern IntPtr LoadBitmap(IntPtr hInstance, long resourceID)
static extern IntPtr LoadBitmap(IntPtr hInstance, int resourceID); 30: LoadImage [System.Drawing.Bitmap.FromResource] 31: PrintWindow Screenshotting a form to a Bitmap in C#:
Bitmap bmp = new Bitmap(form.Size.Width, form.Size.Height, g); Control.DrawToBitmap()
static extern bool SetMenuItemBitmaps(IntPtr hMenu, uint uPosition,
uint uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
public static extern int SetMenuItemBitmaps(IntPtr hMenu, IntPtr nPosition, int wFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
private int AddImageToMenuItem(MenuItem mi,string bitmap_file)
Bitmap bmp = new Bitmap(bitmap_file);
private int AddImageToMenuItem(MenuItem mi,Bitmap bmp)
IntPtr intp = bmp.GetHbitmap();
return SetMenuItemBitmaps(mi.Parent.Handle,(IntPtr) mi.Index,MF_BYPOSITION,intp,intp); 33: ShowCaret Bitmap mybitmap = new Bitmap("1.jpg");
CreateCaret(listBox1.Handle,mybitmap.GetHbitmap(), 1, listBox1.Height);
public void SetBackground(Control control, Bitmap bitmap)
bitmap = la PNG da utilizzare come sfondo*/
// Imposta le dimensioni del controllo come quelle della bitmap
control.Width = bitmap.Width;
control.Height = bitmap.Height;
if (bitmap.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb)
IntPtr hBitmap = IntPtr.Zero;
IntPtr oldBitmap = IntPtr.Zero;
hBitmap = bitmap.GetHbitmap(Color.FromArgb(0));
oldBitmap = Win32.SelectObject(memDc, hBitmap);
Win32.Size size = new Win32.Size(bitmap.Width, bitmap.Height);
if (hBitmap != IntPtr.Zero)
Win32.SelectObject(memDc, oldBitmap);
Win32.DeleteObject(hBitmap); msvcrt35: memcpy public static Bitmap Clone(Bitmap src)
// lock source bitmap data
BitmapData srcData = src.LockBits(
Bitmap dst = new Bitmap(width, height, src.PixelFormat);
// lock destination bitmap data
BitmapData dstData = dst.LockBits( gdi3236: AlphaBlend
37: BitBlt BitBlt returns an error if the source and destination device contexts represent different devices. To transfer data between device contexts for different devices, convert the memory bitmap to a DIB by calling GetDIBits. To display the DIB to the second device, call SetDIBits or StretchDIBits. Here's a way to take a bitmap snapshot of any Windows.Forms.Control (PInvoke signatrue omitted for brevity)
private Bitmap SnapShot(win.Control c)
Bitmap bmp;
bmp=new Bitmap(c.Width, c.Height); The BitBlt function can be used to quickly render a Bitmap onto a Control (and much, much more). For this purpose, it is much faster than the managed alternative, Graphics.DrawImage(). See the example code below.
IntPtr pOrig = SelectObject(pSource, bmp.GetHbitmap()); 38: CreateBitmap
static extern IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits);
Private Shared Function CreateBitmap(nWidth As Integer, nHeight As Integer, cPlanes As UInteger, cBitsPerPel As UInteger, lpvBits As IntPtr) As IntPtr The [System.Drawing.Bitmap] constructor, although it creates a DIB rather than a DDB.
/// Creates a bitmap compatible with the device that is associated with the specified device context.
/// <param name="nWidth">The bitmap width, in pixels.</param>
/// <param name="nHeight">The bitmap height, in pixels.</param>
/// <returns>If the function succeeds, the return value is a handle to the compatible bitmap (DDB). If the function fails, the return value is <see cref="System.IntPtr.Zero"/>.</returns>
[DllImport("gdi32.dll", EntryPoint = "CreateCompatibleBitmap")]
static extern IntPtr CreateCompatibleBitmap([In] IntPtr hdc, int nWidth, int nHeight);
Private Shared Function CreateCompatibleBitmap(hdc As IntPtr, nWidth As Integer, nHeight As Integer) As IntPtr 40: CreateDIBitmap
static extern IntPtr CreateDIBitmap(IntPtr hdc, [In] ref BITMAPINFOHEADER
lpbmih, uint fdwInit, byte [] lpbInit, [In] ref BITMAPINFO lpbmi,
Public Shared Function CreateDIBitmap( _
ByRef lpbmih As BITMAPINFOHEADER, _
ByRef lpbmi As BITMAPINFO, _ 41: CreateDIBSection
static extern IntPtr CreateDIBSection(IntPtr hdc, [In] ref BITMAPINFO pbmi,
ByRef pbmi As BITMAPINFO, ByVal iUsage As System.UInt32, _ The BITMAPINFO structure defines the dimensions and color information for a DIB, it contains the members BITMAPINFOHEADER structure (contains information about the dimensions of color format) and bmiColors which contains one of the following: See MSDN Documentation for BITMAPINFO concerning specific details concerning structure members.hSection is a handle to a file mapping object that the function will use to create the DIB and can be NULL. If hSection is not NULL, it must be a handle to a file mapping object created by calling the CreateFileMapping function (otherwise CreateDIBSection will fail). Moreover, the CreateDIBSection function will locate the bitmap’s bit values at offset dwOffset in the file mapping object referred to by hSection. An application can retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection. dwOffset specifies the offset from the beginning of the file mapping object referenced by hSection where storage for the bitmap’s bit values is to begin (ignored if hSection is NULL). The bitmap’s bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the size of a DWORD. If the function succeeds, the return value is a handle to the newly created device-independent bitmap (and ppvBits will point to the bitmap’s bit values). If the function fails, the return value is NULL (and ptr ppvBits will be NULL). To get extended error information, call GetLastError. hbmp simply is a handle to a bitmap image. Using the System.Drawing.Bitmap class, you can create whatever pattern you desire.
Dim bB As New Bitmap(Width, Height)
gBrush = CreatePatternBrush(bB.GetHbitmap) 43: CreatePen // create a bitmap and get a pointer suitable for GDI Bitmap maskImage = new Bitmap (width, height); IntPtr maskHbitmap = maskImage.GetHbitmap(); void PaintLine3(IntPtr hbitmap, Point start, Point end, bool erase)
IntPtr pOrig = SelectObject(pDC, hbitmap); 44: DeleteObject
/// <summary>Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.</summary>
/// <param name="hObject">A handle to a logical pen, brush, font, bitmap, region, or palette.</param>
/// <para>When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.</para> Call DeleteObject on a HBitmap object after using the GDI+ function:
public static Bitmap FromHbitmap(
IntPtr hbitmap FromHbitmap transfers a copy of the image bytes into returned Bitmap so it is important to call DeleteObject on the HBitmap to prevent two copies of the image from existing in the system. 45: FloodFill
46: GdipLoadImage
private static Type imageType = typeof(System.Drawing.Bitmap);
return (Bitmap) imageType.InvokeMember("FromGDIplus", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { loadingImage }); 47: GetCurrentObject
OBJ_BITMAP = 7, 48: GetDIBits
/// Retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format.
/// <param name="hbmp">A handle to the bitmap. This must be a compatible bitmap (DDB).</param>
/// <param name="lpvBits">A pointer to a buffer to receive the bitmap data. If this parameter is <see cref="IntPtr.Zero"/>, the function passes the dimensions and format of the bitmap to the <see cref="BITMAPINFO"/> structure pointed to by the <paramref name="lpbi"/> parameter.</param>
/// <param name="lpbi">A pointer to a <see cref="BITMAPINFO"/> structure that specifies the desired format for the DIB data.</param>
/// <param name="uUsage">The format of the bmiColors member of the <see cref="BITMAPINFO"/> structure. It must be one of the following values.</param>
/// <returns>If the lpvBits parameter is non-NULL and the function succeeds, the return value is the number of scan lines copied from the bitmap.
/// If the lpvBits parameter is NULL and GetDIBits successfully fills the <see cref="BITMAPINFO"/> structure, the return value is nonzero.
static extern int GetDIBits([In] IntPtr hdc, [In] IntPtr hbmp, uint uStartScan, uint cScanLines, [Out] byte[] lpvBits, ref BITMAPINFO lpbi, DIB_Color_Mode uUsage); 49: GetFontData
/// Deletes a logical pen, brush, font, bitmap, region, or palette handle freeing all system resources associated with the object.
// Create dummy bitmap to generate a graphics device context
using (Graphics g = Graphics.FromImage(new Bitmap(1, 1))) 50: GetGlyphOutline
using(Bitmap b = new Bitmap(1,1)) 51: GetObject Had a terrible time getting this to work to retrieve a BITMAP object from a HBITMAP, this code finally worked. BITMAP bmpScreen; IntPtr ptrToBitmap = hndl.AddrOfPinnedObject(); GDI32.GetObject(hBitmap, Marshal.SizeOf<GDI32.BITMAP>(), ptrToBitmap); bmpScreen = Marshal.PtrToStructure<GDI32.BITMAP>(ptrToBitmap); A better option than the above example would be to leverage Image.FromHbitmap Image.FromHbitmap Documentation on MSDN: https://msdn.microsoft.com/en-us/library/k061we7x 52: GetPixel
// ... and apply the color to Bitmap-struct via SetPixel() or whatever else you want to do with it.. 53: HBitmap
static extern TODO HBitmap(TODO);
Declare Function HBitmap Lib "gdi32.dll" (TODO) As TODO System.Drawing.Bitmap 54: LineTo // create a bitmap and get a pointer suitable for GDI Bitmap maskImage = new Bitmap (width, height); IntPtr maskHbitmap = maskImage.GetHbitmap(); void PaintLine3(IntPtr hbitmap, Point start, Point end, bool erase)
IntPtr pOrig = SelectObject(pDC, hbitmap); 55: MoveToEx // create a bitmap and get a pointer suitable for GDI Bitmap maskImage = new Bitmap (width, height); IntPtr maskHbitmap = maskImage.GetHbitmap(); void PaintLine3(IntPtr hbitmap, Point start, Point end, bool erase)
IntPtr pOrig = SelectObject(pDC, hbitmap); 56: SelectObject
/// <para>An application cannot select a single bitmap into more than one DC at a time.</para> 57: SetBitmapBits SetBitmapBits (gdi32) Summary The SetBitmapBits API static extern int SetBitmapBits(IntPtr hbmp, uint cBytes, byte [] lpBits); Documentation [SetBitmapBits] on MSDN 58: SetDIBits
byte [] lpvBits, [In] ref BITMAPINFO lpbmi, uint fuColorUse); 59: SetMapMode
public static extern int DeleteObject(int hBitmap); 60: SetPixel The SetPixel method sets the color of a specified pixel in this bitmap. Cut off search results after 60. Please refine your search. |