|
I've looked thru as many articles as I could find on the subject of bitmaps and I still cannot find how to make a composite bitmap from a few individual ones. I want to do this in a memory dc then when finished adding each bitmap, bitblt the single one to the screen dc. My goal is to reduce or eliminate flickering and ,yes, I know about double buffering but everthing I read was blitting 1 single bitmap not multiple ones.
Basically, I have one large (400x550 pixels) background bitmap and about 38 smaller (30x150) bitmaps that I am layering over the background one. I have lots of flickering. So I thought that if I could combine all bitmaps into one single memory dc then blit to screen dc I would greatly reduce flicker.
Am I or dreaming??
Manufacturing Software Developer
|
|
|
|
|
You can create a new DC which is compatible with your application DC using CreateCompatibleDC( ... ). Then you can do all your layering operations in this newly created DC, and when your are finished, you can BitBlt the newly created DC to your application DC. This can certainly avoid the flickering you are talking about.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Yes, that was it exactly. I feel like an idiot because of how simple the solution was. Actually, just after I sent off this question I experimenting with the method that you ended up suggesting. I created a new memory DC, bitblt'd with SCRCOPY each bitmap into that same memory space. Then, finally, bitblt SCRCOPY the memory DC to the screen DC. It worked fine. There was no flickering.
I tend to exhaust all other means of possible solution paths before using common sense!
Thanks!
Manufacturing Software Developer
Hewlett-Packard Company
|
|
|
|
|
Where in VC++.NET do I change the name of the exe file? Thanks.
Matt (Padawan Learner)
|
|
|
|
|
Its in the project settings, in the Link section.. isn't it ?
Just trying to remember off the top of my tiny head.
|
|
|
|
|
Got it. Thanks.
Matt (Padawan Learner)
|
|
|
|
|
Please Tell me How to search and operate a device,such as USB device?
Use the functions such as "SetupDiClassDev() etc.," need GUID,and How can I Get GUID use windows'API functions?
I Use Windows XP OS.
Thanks.
ST!!
Njbull
Sep.12/2003,Beijing
|
|
|
|
|
I need to draw a selection box in a real time video. This box is created when i pressed the left mouse button and drag the outline of the box. However since my codes are not in MFC, i do not know of any way to draw this box.. Can anyone help??
|
|
|
|
|
I am trying to print out everything in Picturebox.
I can't print out anything except blank.
Here is my source in MyViewClass::OnPrint(CDC* pDC, CPrintInfo* pInfo ) and please help me how I am doing wrong?
CRect rect;
GetWindowRect(&rect);
//CDC* pTempDC = GetWindowDC();
CDC memDC;
//IGBMapViewCtrl d;
//d.GetDC();
memDC.CreateCompatibleDC( pDC );
// create bitmap with my window-pDC and set it in the memory-DC
CBitmap bitmap;
bitmap.CreateCompatibleBitmap( m_MapView.GetDC(), rect.Width(), rect.Height());
memDC.SelectObject(&bitmap);
// open printer dialog
// detach DCs
bitmap.Detach();
|
|
|
|
|
to print a bitmap, you need to use a device independent bitmap (DIB), not a device dependent bitmap
|
|
|
|
|
Thank you, I will test it.
Shin
|
|
|
|
|
Thank you, I will test it.
Shin
|
|
|
|
|
Hello,
I'm trying to write a Scene Editor for a 3d engine. In doing this, I have to use Direct3D which means all my surfaces and what not depend on the size of my view.
The only solution I have come up with so far is to create all my stuff, wait until the view is opened so I can get the correct size of it and in it's OnDraw method, initialize Direct3D with the size of the view. I would like to move some of the Direct3D stuff over to my Document class so that they can share this with other views but I'm not sure how to do this. The view hasn't been created by the time OnNewDocument is called so I can't get the right size.
Any ideas?
Thanks
Shawn
|
|
|
|
|
A customer emailed today asking why a combo box in our program sorted like this:
Item1
Item10
Item2
etc
Our combo box sorts alphabetically and it's a field of names which generally wouldn't have numbers in it.
In other words, they expect "Item10" to follow "Item2" which makes intuitive sense but seems to be difficult to program for.
Has anyone ever seen a combo box that sorts alphabetically and numerically, in any program? Any ideas on how to reliably do that? Is this a known problem with a known algorithm?
|
|
|
|
|
Yeah, its a pain isn't it. Happens in all sorts of places.
Try using this http://sourcefrog.net/projects/natsort/[^] and then manualy inserting the items.
You could just wrap the comparison in a std::less or pass it to qsort.
Ryan.
|
|
|
|
|
Ahh! Outstanding link, thank you very much!
Cheers!
|
|
|
|
|
The simple solution is to make sure everything is in the form item001, item010, item283, like so - then it will work.
|
|
|
|
|
Yes, of course!
Thanks for pointing that out, I should have thought of it before.
|
|
|
|
|
Make every item in same string length, for example, populate your combo box like this:
CString sItem;
for (int i = 0; i < 100; i++)
{
sItem.Format(_T("Item%03d"), i + 1);
m_wndCombo.AddString(sItem);
}
Then items will be sorted in the way you desired.
|
|
|
|
|
Normally yes, but in this case the users enter whatever they want, it's a list of their clients and so I have no control over what they type in.
|
|
|
|
|
|
Ian Darling wrote:
StrCmpLogicalW is your friend.
Ahh! Didn't know about that one, thanks!
Unfortunately it's XP or above only I'm afraid, but will be most useful in future when we can weed people off of w98/wme/wnt4
Cheers!
|
|
|
|
|
Hi,
It's a newbie question. The SDI application show title "Untitled-Generator" where Generator is the name of the application. Now I want it show a different name and also want to change the name of the generated exe to that name. How do I do that without creating a new application with that name?
|
|
|
|
|
CDocument has a member called SetTitle.
|
|
|
|
|
Didn't read the question very carefully - The name of the app is in the resource string table - look there for a string with lots of \n's in it and change that whereever you see the old name. To change the exe, go into the Project Settings for the compiler and change the output file name for Debug and Link. Make sure that it is selected for both Debug and Release versions.
|
|
|
|