-
July 20th, 2009, 09:27 AM
#1
How to: accelerating the creation of a Custom Window
Guys i have a problem. Im creating a custom window from a bitmap just using win32 and C++. but my picture is too big. So i dont know how accelerating the creation of a Custom Window. Someone has a idea? thx in advance.
Note: im not using MFC and other. im just using C++ and Win32. unless there is no option and i have actually to use other methods.
-
July 20th, 2009, 09:35 AM
#2
Re: How to: accelerating the creation of a Custom Window
I'm sorry, but without code or some more specific topic we can only guess, or endeavor to write a book on the general topic.
Some code, perhaps minimal to illustrate the problem, then we have something to analyze.
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
-
July 20th, 2009, 09:44 AM
#3
Re: How to: accelerating the creation of a Custom Window
ok, so sorry it was not my intention, so sorry. i will post my code: http://pastebin.com/m9774e17 .
i hope its useful.
-
July 20th, 2009, 11:43 AM
#4
Re: How to: accelerating the creation of a Custom Window
This is the bottleneck:
Code:
for(int Y =0; Y < bmInfo.bmHeight;Y++){
for(int X =0; X<bmInfo.bmWidth;X++){
if(GetPixel(hdcMem,X,Y)!=crTransp){
HRGN temp = CreateRectRgn(X,Y,X+1,Y+2);
CombineRgn(rgn,rgn,temp,RGN_OR);
DeleteObject(temp);
};
};
};
I would have to better understand the nature of the image, and the nature of the region you're creating.
For example, if the image doesn't change, or the number of possible images is very limited, it would be highly advisable to create a region from data and store that for loading during application initialization.
If this is a generalized requirement for a wide range of images, the region and the image review should be managed by an image library that can find edges and form the region as data. The repeated CombineRgn and GetPixel are both slow.
What do you tnink along these lines?
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
-
July 20th, 2009, 12:41 PM
#5
Re: How to: accelerating the creation of a Custom Window
the image is just a alpha level. i found some stuff and i was wondering if its possivel a create it like a dialog template and later i can use it to create my window. but i dont know if its the right method and also i dont know how to do it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|