|
Any reason why you are using TIFF? Most developers stay away from TIFF because of the problems with the Unisys patent of LZW.
John
|
|
|
|
|
Because my advisor(in University) want to write a demo software to implement the senario I described above. We have lots of big tiff file(>22MB) on hands.
|
|
|
|
|
I work in a university and understand...
John
|
|
|
|
|
Thanks for the understand. I am a newer in image display
|
|
|
|
|
Also compression is probably not the way you want to go because it is too slow. If it takes 10 seconds to compress your file and 10 seconds to decompress it wouldn't it be faster if you just send the whole file in the first place. You want to send a lower resolution image to the screen. Magnify (by pixel replication) it so that it is the same size and while the user is viewing the image fill in the missing image information.
John
|
|
|
|
|
I agree with you, I think the compressed file is not similiar to the bmp file. I want to know what size it would be to store a same image in bmp(uncompressed image) for a 2048w x 1025h, true color image(which is 2.65MB in tiff format).
By the way, I am a newer in displaying image.
How to calculate the size of bmp for a given size image? could you give me a formula? thanks.
|
|
|
|
|
For 24 bit images:
2048 * 1025 * 3 = ~6.3MB
This is not exactly correct because lines must end on a DWORD boundry I think..
John
|
|
|
|
|
Hi, I am going to write a tiff file viewer, but I don't know the format of the
tiff file. Here I ask my questions,
(1). I googled the format of tiff and didn't find any help information, anyone
can show me an URL to learn the tiff format?
(2) can somebody show me the source code of tiff viewer? How is a tiff file
compressed and displayed?
(3). WHAT I WANT TO DO IS: to display the result of a window moving(1024*768)
on a very large picture(8192*4096). My goal is to MINIMIZE the data to be
transfered over ethernet at each display frame.
Say, I want to have my viewer display 1024*768 pixels at a time, my mouse
move smoothly to change the position of the window. Thus intuitively, at each
time I only need a small ammount of new pixels to be loaded in the viewer,
because the other part should overlap with the former frame. Is ther any
clever method to minimize the data transfer?? (If it were bmp file, I can
expect this is doable.)
---------------------------
| |-------| moving |
| |Window | --> |
| |-------| |
| whole pic |
|-------------------------|
|
|
|
|
|
Hi there. Does anyone know of any artcles that show how to create those Auto-Hide view that are featured in VS .net... the Toolbax, Server Expplorer, etc ?
Thanks for any help.
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
There's a Win32 API function called AnimateWindow() which provides this type of effect.
n!
|
|
|
|
|
I have some old perl code that I found in the book "Perl Database Programming" by Brent Michalski that I need to port to C++ for use with another project that needs in place array shuffling. I've analyzed the perl code back to front and am still not sure how implement the same thing in C++. For inspection, I have the full source for the perl subroutine with line by line comments verbatim from the book for those who don't have an understanding of perl following the source code:
<code>
1: sub fisher_yates_shuffle {
2: my $array = shift;
3: my $i;
4: for($i = @$array; --$i) {
5: my $j = int rand ($i+1);
6: next if $i == $j;
7: @$array[$i,$j] = @$array[$j,$i];
8: }
9: }
</code>
Line 1 begins the fisher_yates_shuffle subroutine. This subroutine is designed to take a reference to an array as the input, and it will randomize the items in the array in place. This means that we pass a reference to an array and the array gets randomized. This is a commonly used method for randomizing arrays, the "Fisher-Yates shuffle," named after Sir Ronald A. Fisher and Frank Yates, who introduced the algorithm in example 12 of their 1938 book Statistical Tables.
Line 2 declares a scalar variable named $array and shifts the value passed to the subroutine into it. This value should be a reference to an array.
Line 3 declares a scalar variable named $i
Line 4 begins a for loop that sets $i to the current value each time through the loop and also decrements $i. This has the effect of setting $i to the number of elements in the array @$array and then counting down one by one.
Line 5 declares a scalar variable named $j and sets it to a random integer between 1 and $i
Line 6 causes the for loop to skip to the next iteration if $i and $j are equal
Line 7 swaps the values at $array[$i] and $array[$j]
Line 8 ends the for loop that we began on Line 6
Line 9 ends this subroutine.
As I've said, I've been over this thing a dozen times, and a solution in C++ just isn't coming to me, so I'd appreciate any help that anyone woudl be will to provide. I think that the perl source I've included gives enough of a general idea of what needs to happen along with the source comments that a solution would be apparent to any seasoned programmer ( which when it comes to C I'm definately not ) Thanks in advance for any help that you folks can provide.
It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now...
[Shog9 on Kid Programmers]
|
|
|
|
|
template <class T>
inline void fisher_yates_shuffle(T* array, int size)
{
::srand(static_cast<unsigned int>(::time(0)));
//could be
for(int i = size - 1;i > -1;--i)
{
int j = ::rand() % i;//could be "::rand() % i + 1" I am not sure what "rand ($i+1)" stands for
if(i != j)
{
T temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
|
|
|
|
|
Almost...
The rand() % i should be rand() % (i+1) . Other than that, well done .
template <class T>
inline void fisher_yates_shuffle(T* array, int size)
{
srand(static_cast<unsigned int>(time(0)));
for(int i=size-1; i>-1; --i)
{
int j = rand() % (i + 1);
if(i != j)
{
T temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Very similar to Alex's reply above, except the rand() % i
should be rand() % (i+1) :
template <class T>
inline void fisher_yates_shuffle(T* array, int size)
{
srand(static_cast<unsigned int>(time(0)));
for(int i=size-1; i>-1; --i)
{
int j = rand() % (i + 1);
if(i != j)
{
T temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
m_fileList.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_MULTIPLESEL | LBS_EXTENDEDSEL | WS_VSCROLL | WS_BORDER | LBS_HASSTRINGS, rect, this, IDC_FILEFRAME_LISTBOX);
This CListBox Create works great and does everything that I ask it to do, but when I change it to:
m_fileList.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_MULTIPLESEL | LBS_EXTENDEDSEL | WS_VSCROLL | WS_BORDER | LBS_HASSTRINGS | LBS_OWNERDRAWFIXED, rect, this, IDC_FILEFRAME_LISTBOX);
I get a debug error in WINCTRL1.CPP:
void CListBox::MeasureItem(LPMEASUREITEMSTRUCT)
{ ASSERT(FALSE); }
Any suggestions on how to fix this?
|
|
|
|
|
if you ownder draw the listbox (with LBS_OWNERDRAWFIXED) you need to add your own MeasureItem method.
It's best if you create your own class for it.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Thanks for the quick reply. Your suggestion did it!
|
|
|
|
|
Quick Q.
Are paths expressed in UNC form e.g: "\\network\some folder\file.txt"
accessed faster than when it is explicitly mapped:
e.g: "S:\some folder\file.txt"?
I vaguely remember reading somewhere that this is the case in which your pc does not have to re-find the UNC path everytime there is a connection.
--
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Hi,
Still extremely new to MFC programming, so i am just trying to play around with some of the controls. I made a app that has a few dialogs...which I later put into a property sheet. I was wondering how I could make the window modeless...I don't have the MSDN library so I can't look up how to do this. I hear about a Create() function?
Any help would be appreciated.
Thanks in advance.
|
|
|
|
|
<br />
this->m_pPSEstacio = new CPSEstacio("", this, 0);<br />
<br />
this->m_pPSEstacio->Create(this, WS_CHILD | WS_TABSTOP | WS_VISIBLE);<br />
this->m_pPSEstacio->ModifyStyleEx(0,WS_EX_CONTROLPARENT);
this would be useful for creating a child property sheet... (take out the WS_CHILD and the WS_TABSTOP and the last code line...
then you'll get it...
Hope this helps...
|
|
|
|
|
Hi,
I got the propertysheet to come up with the correct look of what i want, but its still not modeless.
I am using the code:
sheet.AddPage(&tab1);
sheet.AddPage(&tab2);
sheet.AddPage(&tab3);
sheet.Create (this, WS_CHILD | WS_VISIBLE , 0);
sheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
sheet.ModifyStyle( 0, WS_TABSTOP, 0);
sheet.UpdateData(FALSE);
sheet.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
I thought to make a modal i would have to do sheet.DoModal? how come the create is doing a modal window too? Can some help me be modeless AND give an explanation why?
Any help is much appreciated. THANKS in advance.
|
|
|
|
|
If you want it modeless, and still "look" modal, just leave out WS_CHILD in the Create() call. You also won't need any of the lines under this one. This set of lines creates a property sheet that is embedded inside another dialog/window/property page.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
Thanks for all your help.
I did what you suggested, but to no avail. It compiled, but when i went to the app it gave a couple of errors and then popped both windows up. First a blank dialog came up, and then the property sheet came up. Both are closed once I close the blank window. What I have as the code now is:
sheet.AddPage(&tab1);
sheet.AddPage(&tab2);
sheet.AddPage(&tab3);
sheet.Create (this, WS_VISIBLE , 0);
//sheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
//sheet.ModifyStyle( 0, WS_TABSTOP, 0);
//sheet.UpdateData(FALSE);
//sheet.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
BTW, sheet is instantiated like this:
CPropertSheet sheet;
tab1, tab2, tab3 are all Dialogs with base class of CPropertyPage
Am I doing something wrong?
PLEASE HELP.
Thanks in advance everyone.
|
|
|
|
|
Your code looks right.
What are the errors that come up? If they are MFC ASSERTs, can you get the filename and line number? From these, you should be able to trace back to see what the problem is. This code should work:
CPropertySheet sheet(_T("Sheet Title"));
sheet.AddPage(&m_Page1);
sheet.AddPage(&m_Page2);
sheet.AddPage(&m_Page3);
sheet.Create(); If this doesn't work, then I can't really help any more unless you can find out what's causing the errors.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi All,
I'm the first to admit that I'm not to good at the design aspect of programming. So first I was wondering if anyone had any good suggestions on books that I could read that would help out with this topic. All comments are appreciated.
Second, I have a design question. I'm currently writing a program that uses a tabcontrol and I'd like end user to be able to dynamically add/remove/insert tabs into the program, now the problem is I'm not sure of the best way to implement this. I did design one version that used a checked listbox (in an options form) to allow the user to add/remove/insert "items", when the user clicked ok I would check what "items" had a check and create the tabs for them. Where I ran into a problem was that even items without a check need to be kept in memory so that when the user opens the options again they are still there (and it they check them they should be created, and vice versa) the other problem is that each tab has to have some data associated with it. What I did in the first design was have an array that I threw back and forth between the two forms, but that proved to be a very poor design. I'm just wondering if anyone has any better design that I could try I would really love to hear it. Any ideas or simple things to try would be extremely appreciated.
Thanks All!
- monrobot13
|
|
|
|