flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
vivik
I want to display an image.
I'm confused by device dependent bitmap and device independent bitmap. https://msdn.microsoft.com/en-us/library/dd183382(v=vs.85).aspx I'm confused by dpi avareness. https://blogs.windows.com/buildingapps/2017/05/19/improving-high-dpi-experience-gdi-based-desktop-apps/ >When used in multi-monitor configuration, off-screen content will not be updated when the application window is moved between displays with different DPIs. I'm confused by SetProcessDPIAware. https://stackoverflow.com/questions/11066255/dpi-awareness-is-really-needed https://msdn.microsoft.com/en-us/library/ms701681 My goal is a simple tga viewer, and just learning to do gui on windows in general. |
|||
![]() |
|
vivik
https://msdn.microsoft.com/en-us/library/windows/desktop/dd144877(v=vs.85).aspx
GetDeviceCaps LOGPIXELSX >In a system with multiple display monitors, this value is the same for all monitors. What do they mean? How to get dpi for current monitor then? Also, if app is displayed on two monitors simultaniously (half on one monitor, half on another), does window receive two WM_PAINT? Because there should be a way to adapt, if two monitors have different dpi. |
|||
![]() |
|
vivik
Are DDB always represented as RGB or RGBA internally? I guess they can be monochrome for printers, but I don't think monochrome monitors is a thing anymore.
|
|||
![]() |
|
revolution
vivik wrote: Are DDB always represented as RGB or RGBA internally? I guess they can be monochrome for printers, but I don't think monochrome monitors is a thing anymore. |
|||
![]() |
|
vivik
If target device is a monitor, shouldn't "device dependent" bitmap be the same or almost the same for most of modern monitors?
|
|||
![]() |
|
revolution
vivik wrote: If target device is a monitor, shouldn't "device dependent" bitmap be the same or almost the same for most of modern monitors? Just use DIB like everyone else. They are usually easier to deal with and Windows knows how to use the GPU and/or hardware acceleration to convert it if it is needed when painting. |
|||
![]() |
|
vivik
As it looks like now, to display a tga, I have to first inpack it into DIB, and then from that create DDB. Why can't I unpack to DDB directly. Can't really find what kind of format DDB will have.
|
|||
![]() |
|
revolution
A DDB format is unknown until you run the code on a particular device. So for example you won't know what format you need for a printer device until you create a context and interact with the device driver.
|
|||
![]() |
|
vivik
I don't care about printers atm, I'm asking about monitors.
Maybe I should learn DirectWrite. To just display an image, yeah. |
|||
![]() |
|
revolution
It's the same for monitors though, a DDB format for a monitor is also unknown until you have the context and work with it.
|
|||
![]() |
|
vivik
Hm, okay. Thanks for info. Time to write code then. I'll bump this thread when I'll get stuck.
It's probably possible to get DDB format once at startup, implement a speedy unpacking for the most likely variant, and also implement a fallback to the standard way if something is weird. I'll google it. |
|||
![]() |
|
revolution
Unless you are expecting to convert thousands of images per second then I wonder if using the "standard" DIB is the way to go. In theory using DDBs means you need to write so many different variants of converters to match all the possible hardware formats that the code overhead it crazy. Using DIB will take advantage of the device drivers inbuilt rapid conversion to the actual output format, and using DDB means you would basically be duplicating this code yourself, but doing it with the CPU instead of the hardware silicon.
|
|||
![]() |
|
vivik
I said I'd implement only two: the most common and the standard (os provided) one.
Strange how CreateDIBitmap creates DDB. Shouldn't it be called CreateDDBitmap? |
|||
![]() |
|
vivik
https://msdn.microsoft.com/en-us/library/dd183371(v=vs.85).aspx
BITMAP WORD bmPlanes; The count of color planes. What the hell are planes? Each rgb BITMAP is three bitmaps following each other? |
|||
![]() |
|
ProMiNick
planes for bitmap(DIB,DDB) can have only value 1 (default), or value 0 (mean that OS ignore it and OS will think here is 1 by default).
_________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||
![]() |
|
vivik
About "writing directly to DDB". It looks like windows just wouldn't give me access to that, no way to get a pointer to raw data. https://stackoverflow.com/questions/14207618/get-bytes-from-hbitmap , "if bitmap is not created by CreateDIBSection bitmap.bmBit pointer will be null". Plus I looked inside a real world gdi game, it just used DIB and BitBlt.
When do I need to use DDB then? I guess it's like uploading image to GPU, you can do that if you rarely change it? It's probably safe to forget it's existance. I just launched elona recently, it got some fancy effects in the main menu, like "cicles on water". Obliviously no gpu here. I wonder how to do this, I guess the same DIB and BitBlt. http://www.herdsoft.com/ti/davincie/imex3izm.htm |
|||
![]() |
|
vivik
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx
"Per monitor–DPI aware applications are a new class of applications in Windows 8.1." okay, so I can ignore that for now, good |
|||
![]() |
|
pabloreda
I use this ruttines for display graphics in win,
https://github.com/phreda4/reda4/tree/master/r4asm r4fasm.asm is window mode r4fasmfull is full screen r4fasm64.asm is for 64bit mode, not well tested |
|||
![]() |
|
vivik
@pabloreda
In this piece of code from r4fasm2.asm, there are multiple .fin labels. How does it know to jump to a correct one? Code: SYSFFIRST: ; ( "path" -- fdd ) push ebx ecx edx edi esi mov esi,_dir .bcpy: mov bl,[eax] or bl,bl jz .ends mov byte[esi],bl add eax,1 add esi,1 jmp .bcpy .ends: mov dword [esi],$002A2f2f invoke FindFirstFile,_dir,fdd mov [hfind],eax cmp eax,INVALID_HANDLE_VALUE je .nin mov eax,fdd jmp .fin .nin: xor eax,eax .fin: pop esi edi edx ecx ebx ret ;=============================================== SYSFNEXT: ; ( -- fdd/0) lea esi,[esi-4] mov [esi], eax push ebx ecx edx edi esi invoke FindNextFile,[hfind],fdd or eax,eax jz .nin mov eax,fdd jmp .fin .nin: invoke FindClose,[hfind] xor eax,eax .fin: pop esi edi edx ecx ebx ret |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.