Archived

This topic is now archived and is closed to further replies.

Switch problem?

This topic is 6598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,
I am 'trying' to make my program work better, but it just doesn't work. I stumbled upon a real weird problem.

I've got 2 unsigned char arrays like

unsigned char *bit = new unsigned char[width * height * 3]; // 24 bits bitmap
unsigned char *Buffer = new unsigned char[width * height * 3];

These two arrays are used for 24 bits bitmap storage. And one of them is temporarily. Anyway.

I used a switch statement like:

switch(UseFilter)
{
case 0:
FFindEdges(bits, Buffer);
break;
case 1:
FBOOLMap(bits, Buffer);
break;
case 2:
F3DFILE World;
break;
}

In which UseFilter is an integer number representing which filter to use.

Now, if I use onle 0, it shows a nice Edge detected Image on the screen. if I use both 0 and 1, it shows a grayscale image (black or white) ont he screen.
And if I use 0, 1 and 2......it represents a black screen.

it is called like

CPictureDoc *pDoc;
pDoc = GetDocument();
if(pDoc->Filter(0) == FALSE) MessageBox("oops","again");
Invalidate();
if(pDoc->Filter(1) == FALSE) MessageBox("oops","again");
Invalidate();
if(pDoc->Filter(2) == FALSE) MessageBox("oops","again");

Invalidate();

And the F3DFILE doesn't do anything, it's just a

class F3DFILE
{
public:
F3DFILE();
protected:

};

So, what can be the problem here?

------------------
Dance with me......

Share this post


Link to post
Share on other sites