[GDI] Handle auf DIB



  • Hi,

    ich hab eine Frage zu DIBs. Ich habe eine BITMAPINFO und eine Zeiger auf die Daten des DIB. Ich will das Bitmap über die GDI bearbeiten. Um es an einen Gerätekontext zu binden (SelectObject), benötige ich ein HBITMAP.

    Wie erzeuge ich das HBITMAP eines DIB? 😕

    Im MSDN habe ich 2 Methoden gefunden, wobei ich mir nicht sicher bin, ob es zu meinem Problem passt:

    CreateDIBitmap()
    The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits.

    CreateDIBSection()
    The CreateDIBSection function creates a DIB that applications can write to directly. The function gives you a pointer to the location of the bitmap bit values. You can supply a handle to a file-mapping object that the function will use to create the bitmap, or you can let the system allocate the memory for the bitmap.

    Die erste Fkt. erzeugt ein HBITMAP, nimmt die gegebene pBits auf, aber macht daraus ein DDB.
    Die zweite gibt mir ein HBITMAP auf ein DIB (das will ich), aber ich bekomme die pBits nicht mit unter, sodass ich sie erst rüberkopieren müsste. Diesen Ansatz werde ich erstmal umsetzen.

    Gibt es noch eine andere Möglichkeit?

    Danke,
    don_basto.


Anmelden zum Antworten