Questions tagged [hbitmap]

A handle to a bitmap (one of Windows Data Types)

HBITMAP is pointer to any type. But usually it is used for pointing on BITMAP object (one of Windows Data Types). See it's declaration:

typedef HANDLE HBITMAP; // see WinDef.h
typedef PVOID HANDLE;   // see WinNT.h
typedef void *PVOID;    // see WinNT.h
96 questions
2
votes
1 answer

Turn PNG loading code to use a FILE instead of local resource

I'm working on a little softare which is meant to display a png file directly on the desktop. i've found a way of doing the later part with a HBITMAP strukture. Yet I've spent days by now searching for a way to load a .PNG file to such a…
DragonGamer
  • 834
  • 3
  • 9
  • 27
2
votes
3 answers

Create HBITMAP from jpeg memory buffer?

I want to create HBITMAP from byte array with JPEG format. I have searched but I only can create it from bitmap file as HBITMAP hbm = (HBITMAP)LoadImage(NULL,"fileName",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); Can someone show me how…
TTGroup
  • 3,575
  • 10
  • 47
  • 79
1
vote
1 answer

Deleting a HBitmap placed into a QLabel

I have a series of QLabel objects on my Qt GUI, and I fill them with HBITMAP objects. These HBITMAP's are buffers in memory, they don't exist on disk. Now I use the QPixmaps fromWinHBITMAPto create aQPixmapwhich I can then pass to…
Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
1
vote
0 answers

Convert HBitmap to Bitmap preserving alpha channel

I have been searching in Google and Stack Overflow, and I cannot find a working example. I need to convert a HBitmap to a Managed .NET bitmap, but the following code does not preserve the alpha channel. private static Bitmap…
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
1
vote
1 answer

WinApi: Displaying HBITMAP on the screen

I created a simple render function as a test. I call this function with FPS 60. I'm testing 2 pictures in total. Each time the function is called, I draw one picture. With each new call, the picture changes. The idea is that due to the high…
Alex
  • 45
  • 5
1
vote
1 answer

convert SVG to HBITMAP using NanoSVG color issue

I tried converting SVG to HBITMAP using NanoSVG. Everything works fine but the color of the Bitamp or saved png is different then the original svg. Please help me to fix this I tried below code // Load the SVG file NSVGimage* image =…
latosvarun
  • 93
  • 6
1
vote
2 answers

Creating a HBITMAP from glReadPixels

I need to create a HBITMAP from data returned by a glReadPixels() call: HDC hCompDC = CreateCompatibleDC(NULL); HDC hDC = GetDC(); m_hClipboardBitmap = CreateCompatibleBitmap(hDC, size.cx, size.cy); if ( m_hClipboardBitmap == NULL ) { throw…
user907285
  • 11
  • 3
1
vote
2 answers

WIndows function DestroyObject for HBITMP doesn't work very well (memory leak)

I need to create HBITMAP images very often in a C++ program, and of course I need to delete these bitmap after use. The code is similar to this HBITMAP hBmp; while(true) { hBmp = CreateBitmap(width, height, 1, 8, imageData); process(hBmp); …
il_mix
  • 553
  • 8
  • 20
1
vote
2 answers

Where is the memory leak from my hdc/hbitmap?

so I've noticed that part of my code leaks a lot of memory when it's called and I've tried to find out where or why it leaks but I'm at a dead end. I've tried the Visual Studio 2017 debugger to take snapshots to find out where the leak happens but…
1
vote
0 answers

C++ raw HBITMAP to png struct data

So I have a HBITMAP object that has all of the pixels that I need to send to a server via a socket (Winsock). The thing is that it needs to be converted to PNG data, so all that needs to be sent is a struct and the server only has to write all that…
Kordnak
  • 165
  • 10
1
vote
0 answers

C# - From native HBitmap to JPEG-encoded Stream, Transparency and upside down

My final goal is to put a HBitmap, that I retrieved from the Windows Thumbnail Cache using this code: // GUID of IShellItem. Guid uuid = new Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe"); SHCreateItemFromParsingName(filename, IntPtr.Zero, uuid, out…
Philipp
  • 53
  • 5
1
vote
2 answers

Resizing HBITMAP while keeping transparent background

I have an application that loads an image with a transparent background, then I use StretchBlt to resize it to the desired size, with HALFTONE set using SetStretchBltMode (I tried using other modes that, while keeping the transparency intact, also…
0x400921FB54442D18
  • 725
  • 1
  • 5
  • 18
1
vote
2 answers

c++ - Conversion from ARGB to Grayscale - Results are well, but upside down

I wrote a small function to convert a Bitmap in ARGB to Grayscale. The conversion itself works fantastic, but the results are upside down. I cannot find the mistake. Code: #include #include inline BYTE GrayScaleValue(BYTE* r, BYTE* g,…
Jan021981
  • 521
  • 3
  • 28
1
vote
3 answers

Can I delete a HBITMAP object created in another process?

I'm creating a utility program which draws some (user customizable) icons onto other windows on the desktop using a global hook. As bitmap objects are specific to a process, I'm creating separate HBITMAP objects for these icons in each process…
Gary Chang
  • 13
  • 3
1
vote
2 answers

Why HBITMAP is inverted

I am trying to create an avi file for a given jpg images. I am reading jpg's using a library and preparing hbitmap for it. Finally i am adding it to create avi file. But my final avi file contains the inverted images. I kept nagative for hight in…
wizards
  • 11
  • 2