hello, I'd love to know how to open window with partially transparent background... i tried "maskblt" and "bitblt", but it returns error code... on a Window DC and even Global screen DC. I'd also want to know how to GET in one time any DC background bitmap part, and copy it to a bitmap structure or whatever (in fact, i'd want to work on the pixel data, but the only way i found to do that correctly is "GetPixel" loop, that is really slow as you can imagine...) Could somebody help me ?
Posted on 2000-12-08 09:25:00 by wtdx
Hi, here is an example how to access bitmap data without 'GetPixel'. Perhaps this is a partially solution for your question ... For more infos download my example 'td_win32asm_170.zip' (graphic engine) at: http://www.geocities.com/ge2001 Let's go: I create a compatible device context, a compatible Bitmap and a DIBSection. Now I am able to work with the CDC, use it with API 'BitBlt', and also with the direct pointer to the bitmap data in memory ! ;------------------------------------------------------------------------------ ; API "GetDC" retrieves a handle of a display device context (DC) for the ; client area of the specified window. ;------------------------------------------------------------------------------ push WP1_hWnd ;hwnd, handle of window call GetDC ;- API Function - mov handleDC,eax ;handle of DC ;------------------------------------------------------------------------------ ; API "FindResource" determines the location of a resource with the specified ; type and name in the specified module ;------------------------------------------------------------------------------ push 2h ;lpType,address of resource type, RT_BITMAP push OFFSET NameBMP_picture ;lpName, address of resource name push hInstance ;hModule, resource-module handle call FindResourceA ;- API Function - ;------------------------------------------------------------------------------ ; API "LoadResource" loads the specified resource into global memory. ;------------------------------------------------------------------------------ push eax ;hResInfo, resource handle push hInstance ;hModule, resource-module handle call LoadResource ;- API Function - ;------------------------------------------------------------------------------ ; API "LockResource" locks the specified resource in memory. ;------------------------------------------------------------------------------ push eax ;hResData, handle to resource to lock call LockResource ;- API Function - mov temp,eax ;pointer to the first byte of the resource ;------------------------------------------------------------------------------ ; API "CreateCompatibleDC" creates a memory device context (DC) compatible with ; the specified device. ;------------------------------------------------------------------------------ push handleDC ;hdc, handle memory device context call CreateCompatibleDC ;- API Function - mov handleCDC_back,eax ;handle, compatible DC ;------------------------------------------------------------------------------ ; API "CreateDIBSection" creates a device-independent bitmap (DIB) that ; applications can write to directly. ; The return value is a handle to the newly created device-independent bitmap, ; and ppvBits points to the bitmap's bit values. ;------------------------------------------------------------------------------ push 0h ;dwOffset, offset to bitmap bit values push 0h ;hSection, optional handle to a file push OFFSET pointerBMP_back ;ppvBits, receive pointer to bitmap bits push 0h ;iUsage,color data type, DIB_RGB_COLORS push temp ;pbmi, address of BITMAPINFO structure push handleDC ;hdc, handle of device context call CreateDIBSection ;- API Function - mov handleBMP_back,eax ; ;------------------------------------------------------------------------------ ; API "SelectObject" selects an object into the specified device context. ; The new object replaces the previous object of the same type. ;------------------------------------------------------------------------------ push handleBMP_back ;hgdiobj, handle of objec
Posted on 2000-12-09 04:55:00 by Test Department
Hi, here is an example how to access bitmap data without 'GetPixel'. Perhaps this is a partially solution for your question ... For more infos download my example 'td_win32asm_170.zip' (graphic engine) at: http://www.geocities.com/ge2001 Let's go: I create a compatible device context, a compatible Bitmap and a DIBSection. Now I am able to work with the CDC, use it with API 'BitBlt', and also with the direct pointer to the bitmap data in memory ! ;------------------------------------------------------------------------------ ; API "GetDC" retrieves a handle of a display device context (DC) for the ; client area of the specified window. ;------------------------------------------------------------------------------ push WP1_hWnd ;hwnd, handle of window call GetDC ;- API Function - mov handleDC,eax ;handle of DC ;------------------------------------------------------------------------------ ; API "FindResource" determines the location of a resource with the specified ; type and name in the specified module ;------------------------------------------------------------------------------ push 2h ;lpType,address of resource type, RT_BITMAP push OFFSET NameBMP_picture ;lpName, address of resource name push hInstance ;hModule, resource-module handle call FindResourceA ;- API Function - ;------------------------------------------------------------------------------ ; API "LoadResource" loads the specified resource into global memory. ;------------------------------------------------------------------------------ push eax ;hResInfo, resource handle push hInstance ;hModule, resource-module handle call LoadResource ;- API Function - ;------------------------------------------------------------------------------ ; API "LockResource" locks the specified resource in memory. ;------------------------------------------------------------------------------ push eax ;hResData, handle to resource to lock call LockResource ;- API Function - mov temp,eax ;pointer to the first byte of the resource ;------------------------------------------------------------------------------ ; API "CreateCompatibleDC" creates a memory device context (DC) compatible with ; the specified device. ;------------------------------------------------------------------------------ push handleDC ;hdc, handle memory device context call CreateCompatibleDC ;- API Function - mov handleCDC_back,eax ;handle, compatible DC ;------------------------------------------------------------------------------ ; API "CreateDIBSection" creates a device-independent bitmap (DIB) that ; applications can write to directly. ; The return value is a handle to the newly created device-independent bitmap, ; and ppvBits points to the bitmap's bit values. ;------------------------------------------------------------------------------ push 0h ;dwOffset, offset to bitmap bit values push 0h ;hSection, optional handle to a file push OFFSET pointerBMP_back ;ppvBits, receive pointer to bitmap bits push 0h ;iUsage,color data type, DIB_RGB_COLORS push temp ;pbmi, address of BITMAPINFO structure push handleDC ;hdc, handle of device context call CreateDIBSection ;- API Function - mov handleBMP_back,eax ; ;------------------------------------------------------------------------------ ; API "SelectObject" selects an object into the specified device context. ; The new object replaces the previous object of the same type. ;------------------------------------------------------------------------------ push handleBMP_back ;hgdiobj, handle of objec
Posted on 2000-12-09 04:55:00 by Test Department
Hi, its not really possible to make parts of a window transparent by blitting from the desktop window into your own window. This results in some kind of recursion. All windows laying on the desktop windows will be part of it during a blit. beaster.
Posted on 2000-12-20 13:12:00 by beaster
It's quite poossible and kinda eazy to make parts of your window completely transparent, and once set-up, takes zero code to maintain em like that. What you need to do is define a region that is the outline shape of your window. Regions may be added, subtracted, and otherwise melded with other regions, and the resulting composit region applied to your window with SetWindowRgn.
Posted on 2000-12-21 00:54:00 by Ernie