|
|
Hmmm.. If you're using 32-bit DIBsection(s) for your bitmap(s), you shouldn't have
to worry about the background at all.
If you use a BLENDFUNCTION like
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
and specify the ULW_ALPHA flag when calling UpdateLayeredWindow()
then the per-pixel alpha values in the DIBSection will control all the blending.
Is that what you're looking for or do you need to do special blending with the
background?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I use BLENDFUNCTION as you described however smth. stange happens with alpha values. a day ago I found an alternate method but sometimes background jumps while dragging window but blending and Aero effect is perfect. I think this topic can be closed....
|
|
|
|
|
Hi dear
I want to ask you if you know where the first address for image data in monochrome bitmap is. I know the header allocate 54 bytes but I am not sure about this in Monochrome images.
Please if you can tell me where is the location of the first data, I will be so thankful.
Note: the intented image is Monochrome (one bit per pixel)
Thanks
|
|
|
|
|
This is a really vague question.
I have no idea what type of bitmap you're referring to.
Even if I assume it's a Window DIB I couldn't tell you, since the location can
vary if the "bitmap" is/isn't in packed form.
Info like format, source (file/resource) etc. would help.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to write a program with c#. (a game to be exactly) But it wants to us e a 3d card to write it. how would i write one that you can use software graphics??? can anyone help me?
Michael
(Up and coming Game programmer)
EST
|
|
|
|
|
For anyone doing 3D graphics work in C++, it's worth taking a look.
http://www.openscenegraph.org/projects/osg[^]
OpenSceneGraph is an open source high performance 3D graphics toolkit, used by application developers in fields such as visual simulation, games, virtual reality, scientific visualization and modelling. Written entirely in Standard C++ and OpenGL it runs on all Windows platforms, OSX, GNU/Linux, IRIX, Solaris, HP-Ux, AIX and FreeBSD operating systems.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Hi my friends,
I would try to create a 4-bit bitmap for my researches but I can't.
Please tell me how to create a 4-bit bitmap in "photoshop", "mspaint" or else where you know.
thanks for your help.
|
|
|
|
|
in paint. File - Save as. Save as type: 16 color bitmap. (4bit = 16 colors)
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Mohammad Khodaea wrote: I would try to create a 4-bit bitmap for my researches but I can't.
Depends on your definition of 4 bit. Do you mean 4bit per color? You can do this simply by halving the bits. If you have 8bit color 8bit R, G, and B (8+8+8 is 24bit color, 8bit component) and the distribution is fairly wide in each color, you can simply shift the bits down with a program and you have 4 bit values. I am not sure of any filters for photoshop, but a program can do this quite easily.
4 bit component color is not the same as 16 color format as mentioned above (which is true 4 bit total color, not by component). 4 bit component data is 16 shades of each color R, G and B, so 16*16*16 or 4096 color. 4bit color is often used in OpenGL where 8bit images are truncated automatically on texturing with the option of RGB4 OpenGL Internal Formats[^]
So if you mean 4 bits overall, go with the above. If you mean 4 bit per component, shift and you shall receive.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Dear All,
I need to develop a Image Processing Application which can do OCR- recognition of typewritten text and ICR – recognition of handwritten text. It has to be done using C# in Visual studio 2005 environment. Although I am into .Net for sometime I am a newbie as far as Image Processing is concerned.
Specifically I require help in the following areas:
1. Pre Processing of Images in order to improve Recognition accuracy. There are many processes like deskew, despeckle ,flipping etc. But which are the processes that need to be applied. Does it depend on the quality of the image. Is it required to apply graphics Filters, if so which are those.
2. Dividing the Image into Zones i.e OCR and ICR.
3. Retrieving the pixels from each element and feeding it into a neural network Library for accurate Recognition.
4. Displaying the Recognised text in another Window for Spell checking and correction.
There are a lot of good articles in this forum but they give information in bits and pieces and it is very difficult(if not impossible) to put it all together for developing this application.
Can someone give me a total picture step wise as mentioned above. If someone,who has developed a similar Application and who has a good knowledge of C# comes forward to help me in developing this Application I shall be ever grateful to the person. In addition I am willing to pay Consultation charges.You may refer me some good books which covers this subject in detail and which provides code.
Sunny74.
|
|
|
|
|
Hi coders!
I would like you to give me some insight. I have almost NO experience with graphics programming (speaking of DirectX and OpenGL) and would like to implement something like a biiiig bulletin board which should only be a big scrollable/zoomable image.
How/where should I start with this?
I'd like to use C#/VB.NET for the task.
Best regards,
Stevie
|
|
|
|
|
Stevie wrote: I'd like to use C#/VB.NET for the task.
well, I can't help you with that side of it, though you could easily integrate this as an off screen render using render to texture methods and then scale the viewer to look at the texture subportions with pan&scan or scaling.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I'm writing a game using C++/CLI (.NET 2.0), taking full advantage of .NET framework for the ease of writing dialog boxes, menus, etc, but keeping my core logic and OpenGL code in "native" C++. Since my main window is a .NET window, I am using a Timer control to trigger the rendering cycle. Since I want to draw as fast as possible, the timer interval is set to 1 ms.
The test scene I'm rendering contains a measely 10,000 triangles. My framerate is a poor 64fps -- running the executable directly (running in the IDE drops my frames to 5fps). I don't know a lot about graphics cards, but I do know their performance is sometimes measured in millions of triangle per sec. If you do the math, 10k triangles * 64fps = 640,000 triangles per second. NOT GOOD.
I do most of my development on a notebook that has a screen refresh rate of 60Hz. I thought that might be the problem, so I switched over to my tower, which is running an Nvidia GeForce 5900XT and a refresh rate of 75Hz. Guess what? I still get the 64fps rendering rate.
Is this the best I can expect from a .NET-encompassed application? Would switching back to an older technology like MFC or even plain old Win32 programming increase my framerate? I do have a good C++ background with pointers and all that stuff, so I'm not afraid to roll up my sleeves if that's what it takes.
Thanks in advance for your help.
|
|
|
|
|
It's possible your Timer interval is too low. If the CPU spends all it's time dealing with that, then there's little time left to run the overhead for DX/OpenGL.
You could either shuffle the loop to simply call itself when it finishes, or change the Timer interval to something like 10. This gives you a rate of 100, but remember: the human eye can't tell the difference between 100 and 30...
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
I thought about the CPU time spent processing a low timer interval. But I was using the single-threaded Forms timer. The timer isn't going to continue toward the next interval until after the graphics processing is complete.
I also read an article by Luc Pattyn on this site that suggests the problem is that the accuracy of timers is dependent on the user's individual system. For instance, if my system operates such that my timer interval is limited to a minimum of 20ms (for round numbers), then I am limited to 50fps no matter what I do with the timer control.
That's a good argument for moving to a loop like you had suggested. But if I move everything to a self-calling loop, won't that keep adding to the call stack and eventually cause the memory to run out?
I know the human eye can't really distinguish much above 30ms. But what's going to happen when I create a more complete scene with 100k triangles instead of 10k triangles? I'll be down to 10fps or worse. And that's something the human eye WILL notice. I want to see a good chunk of framerate overhead so I know I'll still be OK when I get to rendering complex scenes.
|
|
|
|
|
The way I usually work it is to have the painting (or a call to the painting) done in the Form Paint event. Then you Invalidate the form at the end of this code, and the paint event finishes, before executing again at the first available opportunity.
Or, you use a Goto statement
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
"Goto" statement.
I actually considered using the Paint event, but for some reason I got all paranoid that tying up the paint event would prevent other events from firing, effectively locking out the menu system, etc. Plus I'm not rendering to the form directly. The form houses a "System::NativeWindow" instance, which is where the rendering is actually done.
But I am doing something similar now, and it has boosted the framerate substantially:
<br />
void MyRenderingWindow::Shown(System::Object^ sender, System::EventArgs^ e)<br />
{<br />
while (Form::Created)<br />
{<br />
if (bDataAvailable)<br />
RenderScene();<br />
Application::DoEvents();<br />
}<br />
}<br />
I guess it's basically the same idea, just a little different approach. I'm now pulling between 80-110fps on my notebook, which is what I was getting for a similar application I wrote with VC++6/MFC.
Interestingly, my tower refuses to budge over 75fps. My graphics card is weird and has some kind of limiter that ties the glFlush() command directly to the refresh rate, which is set at 75Hz right now -- the most my monitor supports. I tried knocking the refresh rate to 60Hz, and my app limits itself to 60fps. I'll have to figure out how to override that garbage. There's no way a stock notebook graphics card should outperform a $250 GeForce card!!!
|
|
|
|
|
Xpnctoc wrote: My graphics card is weird and has some kind of limiter that ties the glFlush() command directly to the refresh rate, which is set at 75Hz right now -- the most my monitor supports. I tried knocking the refresh rate to 60Hz, and my app limits itself to 60fps. I'll have to figure out how to override that garbage.
ahhhhh, the picture grows clearer.... yup, graphics card setting. You are tied with Vsync. When this is set within the graphics driver, as soon as you issue a frame command, your program will wait until the next vertical sync before starting.
Go in and turn off the vertical sync.
nvidia control panel->
3D settings ->
Adjust image settings with preview ->
[check] Use advanced settings ->
[click] link "Take me there"
look for vertical sync and turn it to "off"
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Xpnctoc wrote: I'll have to figure out how to override that garbage.
Actually, it's not garbage. Vsync helps prevent tearing and wasted processing time. Personally, I leave it off for development (FPS can help you determine bottlenecks) but switch it back on for testing, etc.
|
|
|
|
|
Jeremy Falcon wrote: wasted processing time.
It's not wasted if you have bragging rights. oooo... I have 185fps on my 60hz monitor! woohoo!
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
El Corazon wrote: It's not wasted if you have bragging rights.
Touché
|
|
|
|
|
El Corazon wrote: I have 185fps on my 60hz monitor!
That's it? And you're bragging?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: That's it? And you're bragging?
I didn't say what was being displayed....
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Any time there's numbers being thrown around, I think of this dialog...
(from This Is Spinal Tap (1984))
Nigel: This is a top to a—you know, what we use on stage, but it's very, very special because if you can see...
Marty: Yeah...
Nigel: The numbers all go to eleven. Look...right across the board.
Marty: Ahh...oh, I see....
Nigel: Eleven...eleven...eleven....
Marty: ..and most of these amps go up to ten....
Nigel: Exactly.
Marty: Does that mean it's...louder? Is it any louder?
Nigel: Well, it's one louder, isn't it? It's not ten. You see, most, most blokes, you know, will be playing at ten. You're on ten here...all the way up...all the way up....
Marty: Yeah....
Nigel: ...all the way up. You're on ten on your guitar.. where can you go from there? Where?
Marty: I don't know....
Nigel: Nowhere. Exactly. What we do is if we need that extra push over the cliff, you know what we do?
Marty: Put it up to eleven.
Nigel: Eleven. Exactly. One louder.
Marty: Why don't you just make ten louder and make ten be the top number and make that a little louder?
[pause]
Nigel: These go to eleven.
"I think we can all appreciate the relevance of that now..." (Shaun - Shaun of the Dead)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|