|
I don't think it is so simple as you said, how to orgnize those partial datum and display them while paning and zooming quickly, how to process the image, get display result quickly, and when the display part is changed, how to add the current process method to the new partial image, including undo and redo implementation, so it is a little complicated, though not so difficult.
swandream
|
|
|
|
|
You say you wanna display an image of 20k pixels x 20k pixels, and your user's screen resolution is only 1k x 1k pixels (just for simplicity) (GetDeviceCaps gives the current resolution) then you can
1.
display the pic in its original size (i.e.:20k x 20k). Of course the user will see only a tiny part of it in 1k x 1k (1/400th part), and he can use the scrollbar to navigate it.
In this way you keep all the pic in memory, so your user will have more memory than your pic consumes, in order to be able to use you program efficiently.
2.
read in 20 pixels from file both horizontally and vertically, and make 1 pixel out of it according to an algorithm (maybe taking the average of RGB values), and this about 1 million (=1k x 1k) times.
So you will be able to construct and show a 1k x 1k image out of a 20k x 20k image. This pic will fit the user's screen.
This method does not consume memory but enormously consumes CPU capacity.
3.
Another method would be if you read in from file every 20th pixel both horizontally and vertically (ignoring 19 out of 20 pixels), and show only the 1k x 1k image in this way.
This mehtod does consume neither memory nor CPU, but this image shows 20x20 = 400 times less data (i.e.:resemblance) with the original 20k x 20k pic. Could be a good way if you have pics with large homogenous areas.
Whatever way you choose, you have to make sacrifices, because of the confines of the current Win32 system. I am sure there will be no sacrifices with Win128 or Win256, but it entails some sacrifices of time...
Peter Molnar
|
|
|
|
|
thank you Peter Molnar for your reply, but your methods could not satisfy my request
for the first method you metioned, it is obviously difficult to keep all the pic in memory,20k X 20k RGB image could occupy more than 1G disk space, to make memory more 1G is very luxery.
for the second and third method, I think it only suit for creating navigation image.
swandream
|
|
|
|
|
You need to break your image up into say 1k x 1k tiles and process those separately. You'll notice most paint programs will render really large images in tiles.
Todd Smith
|
|
|
|
|
How to know whether a thread exist or not
Thanks
BOBY
|
|
|
|
|
Call GetExitCodeThread with your threads handle and compare with STILL_ACTIVE return value.
The thread's handle (m_hThread) is a member of CWinThread*, which is returned by AfxBeginThread.
Peter Molnar
|
|
|
|
|
How do you stop in the middle of a function and then wait for a given amount of time then resume without stopping the entire application?
Problem: In my application there are buttons which serve as a menu (drawn with GDI+ so they
are not controls). When clicked they should change color to indicate that it has been clicked. When I click a button it carries out it's function before the button changes color. I need the application to wait long enough before executing its action so that the button has a change to
change color.
Intention of the following code:
When a button is clicked the client area is invalidated and then SetDirty() handles
the double buffering. These lines of code force the screen to be redrawn. p->Action(...)
then performs whatever action it is supposed to.
How do I get the application to wait a bit for the redraw so that the button can change
colors before carrying out it's action? I know that you can't just call Sleep because that
stops the entire appication. I need to be able to wait a given amount of time then call the
p->Action() function.
What techique would work here?
std::vector<Button*>::iterator it;
Button *pB;
for (it = vButtons.begin(); it != vButtons.end(); ++it)
{
pB = *it;
if(pB->IsHit(pt, NULL, m_ActiveButton ))
{
CRect rect;
GetClientRect(&rect);
InvalidateRect(&rect ,false);
SetDirty();
pB->Action( m_hWnd );
}
}
-Steve Messer
|
|
|
|
|
I guess if you draw the button in onpaint event then you wont have this porblem, how are you changing the colour of the button anyway?
The World is getting smaller and so are the people.
|
|
|
|
|
I have a variable called m_ActiveButton. Each button has a draw function and in that function if the button is active it is drawn one color and if its not active it is drawn a different color.
I can't just draw in onpaint() directly or I will get flickering.
-Steve Messer
|
|
|
|
|
Call UpdateWindow() to force a repaint.
myButton.methodToChangeSomeVisibleProperty();
myButton.Invalidate();
myButton.UpdateWindow();
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I stated that this is not a real button and therefore it does not have the methods you mention. I must either invalidate the whole screen or portions of it. Everything on the dialog ( this is a dialog based project ) is drawn with GDI+ so there are no physical controls on the dialog. Everything is drawn using GDI+.
Even if I could do as you described the action() mentioned in my explaination would occur before the screen would have the change to redraw. The action()'s are calling a dialogs from other dll's.
-Steve Messer
|
|
|
|
|
In the Automating with office2000, I get a range in the word document,and in the range, there are a graph object, how can I get this graph object and programm with it?
where can I find some help document? code sample ? thank you advance.
|
|
|
|
|
In the use of
string str;
getline(cin, str);
if(str=="???" || str=="")
{
}
else
{
} The logic is always executing the invalid string segment, even when valid data is entered.
Why is this happening?
Thanks for any insight.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
if(str=="???" || str=="")
Change to:
if((str=="???") || (str==""))
that should help I think
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
if((str=="???") || (str==""))
what kinda of comparison is (str=="???") no one compares like this to test wheather the string holds a valid data or not.
this string should be initialised to zero or null before reading...
The World is getting smaller and so are the people.
|
|
|
|
|
Mr.Prakash wrote:
what kinda of comparison is (str=="???") no one compares like this to test wheather the string holds a valid data or not.
When you do more than one comparions like this you need to put them inside parenthesis. The compiler should even report an error or warning.
Mr.Prakash wrote:
this string should be initialised to zero or null before reading...
He uses std::string , that string gets empty when it gets constructed.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Enclosed, or not, within parentheses, the desired action does not occur.
William
Fortes in fide et opere!
|
|
|
|
|
Does not even merit a relevant response.
William
Fortes in fide et opere!
|
|
|
|
|
Works OK for me in VC++ 6.
Kevin
|
|
|
|
|
Strange! because I have VC++ 6, and I tried a dozen or more different techniques before posting the question, and I couldn't get any of them produce the desired behavior.
William
Fortes in fide et opere!
|
|
|
|
|
Hmmm. I'm puzzled then. I think my VC++ has SP3 applied. perhaps that makes a difference? And I tried it on NT4.
Kevin
|
|
|
|
|
Thanks for your reply.
Even stranger! that you have VC++ 6, SP3 and claim it works for you, while I with VC++ 6, SP5, cannot get the kind of behavior I'm looking for.
The problem (it looks more and more to be), is that 'getline() isn't receiving any data from the input queue, because a 'cout' of the string (which is the input buffer) reveals NOTHING in it. Consequently, when the test is made to see if data is absent, the test succeeds because NO data has been collected and is the reason why the invalid segment gets activated.
So the problem doesn't seem to rest with 'string', but more with 'getline()'.
To be honest with you, 'getline()' has been a problem child for me every time I try to use it, and this time is no exception.
William
Fortes in fide et opere!
|
|
|
|
|
I dont understand why the comparison with three "?"
is it a desired input??
or is it the comparison for uninitialised junk string?
The World is getting smaller and so are the people.
|
|
|
|
|
Here is just a guess since I don't use string.
Try changing str=="" to str== " ". note the space.
Or the string should have an isempty() method I presume.
-Steve
|
|
|
|
|
Try using strcmp() . I've had problems trying to use normal logical operators on strings and char arrays before but using the different compare functions sure saved me from headaches.
The question "Do computers think?" is the same as "Can submarines swim?"
DragonFire Software
Jeryth
|
|
|
|