void MyFrame::OnFilter( wxCommandEvent& event )
{
        if( pImage == NULL )
        {
            wxMessageBox("Image is not loaded yet!", _T("Error"), wxOK | wxICON_INFORMATION,this);
        }
        else
        {
            wxImage *Filtered = NULL;

            switch(event.GetId())
            {
               case MENU_FILTER_LP: Filtered = LowPass(pImage); break;
			   case MENU_FILTER_HP: Filtered = HighPass(pImage); break;
			   case MENU_FILTER_NONLINEAR_MEDIAN: Filtered = NonLinear(pImage, MEDIAN); break;
			   case MENU_FILTER_NONLINEAR_MINIMUM: Filtered = NonLinear(pImage, MINIMUM); break;
			   case MENU_FILTER_NONLINEAR_MAXIMUM: Filtered = NonLinear(pImage,MAXIMUM); break;
			   case MENU_FILTER_EDGE: Filtered = Edge(pImage); break;
			   case MENU_FILTER_UNDO: Filtered = copy(masterImage); break;
			   //Lab 4
			   case MENU_FILTER_BINARIZE:{
									   makeSlider(BIN_SLIDER, 128,0,255);
									   Filtered = Binarize(masterImage,sliderValue );}
									   break;
               case MENU_FILTER_TEXTDETECTION: Filtered = TextDetection(pImage); break;
			}

            pImage = Filtered;
         }
    Refresh();
    return;
}
Example #2
0
void printScenarioOptions()
{
    static int firstTime = 1;
    static slider_t moneySlider;

     if (firstTime)
     {
         initializeSlider(&moneySlider, 493, 190, 442, 50, 4, 1, 700);
     }
    static MENUBUTTON forwardArrow;
    initializeButton(&forwardArrow, 920, 677, 57, 50, "Menu_Images/Forward Arrow.bmp");

    BITMAP *newBackground = makeBitmap("Menu_Images/Scenario Menu 01.bmp");

    draw_sprite(menuBuffer, newBackground, 0, 0);
    makeSlider(&moneySlider);

    if (menu_mouseIsOver(&forwardArrow))
           {
                 forwardArrow.picture = makeBitmap("Menu_Images/Forward ArrowH.bmp");
           }
           else if (!menu_mouseIsOver(&forwardArrow))
           {
               forwardArrow.picture = makeBitmap("Menu_Images/Forward Arrow.bmp");
           }

        if (mouse_b)
        {
             if (menu_mouseIsOver(&forwardArrow))
             {
                showAssignment();
               stop_sample(newAmbient);
               loadingPhase = 0;
               inGame = 1;
               initializeAllObjects();
               initializeMapSquares();
                SPQR_Game();
					emptyGame();
             }
        }
        draw_sprite(menuBuffer, forwardArrow.picture, forwardArrow.left, forwardArrow.top);
        firstTime = 0;
}
Example #3
0
void printBattleOptions()
{

     static slider_t aBattleSlider[3];

     static int firstTime = 1;
     static int characterClicked = 0;
    static BITMAP *godNames[3];

     if (firstTime)
     {
         initializeSlider(&aBattleSlider[0], 493, 190, 442, 50, 4, 1, 700);
         initializeSlider(&aBattleSlider[1], 493, 315, 442, 50, 4, 1, 700);
         initializeSlider(&aBattleSlider[2], 493, 600, 442, 50, 4, 1, 700);
         firstTime = 0;

    godNames[0] = makeBitmap("Menu_Images/Jupiter Name.bmp");
    godNames[1] = makeBitmap("Menu_Images/Mars Name.bmp");
    godNames[2] = makeBitmap("Menu_Images/Neptune Name.bmp");
     }

    BITMAP *newBackground = makeBitmap("Menu_Images/Single Battle Menu 01.bmp");
    int i = 0;
    int j = 0;
    static MENUBUTTON forwardArrow;
    initializeButton(&forwardArrow, 920, 677, 57, 50, "Menu_Images/Forward Arrow.bmp");

    static MENUBUTTON aGod[3];
    initializeButton(&aGod[0], 475, 434, 129, 66, "Menu_Images/Zeus.bmp");
    initializeButton(&aGod[1], 649, 434, 129, 66, "Menu_Images/Mars.bmp");
    initializeButton(&aGod[2], 825, 434, 129, 66, "Menu_Images/Neptune.bmp");

    static SAMPLE *aGodSound[3];
    aGodSound[0] = makeSample("Menu_Sounds/Jupiter.wav");
    aGodSound[1] = makeSample("Menu_Sounds/Mars.wav");
    aGodSound[2] = makeSample("Menu_Sounds/Neptune.wav");

    draw_sprite(menuBuffer, newBackground, 0, 0);

     for(i = 0; i <= 2; i++)
     {
     makeSlider(&aBattleSlider[i]);
     }

     if (menu_mouseIsOver(&forwardArrow))
           {
                 forwardArrow.picture = makeBitmap("Menu_Images/Forward ArrowH.bmp");
           }
           else
           {
               forwardArrow.picture = makeBitmap("Menu_Images/Forward Arrow.bmp");
           }

        if (mouse_b)
        {
           for (i=0; i<=2; i++)
           {
                 if (menu_mouseIsOver(&aGod[i]))
                 {
                       characterClicked = i;
                       for (j=0; j<=2; j++)
                       {
                            stop_sample(aGodSound[i]);
                       }
                       play_sample(aGodSound[i], 155, 0, 1000, 0);
                 }
           }
             if (menu_mouseIsOver(&forwardArrow))
             {
                return;
             }
        }
        aGod[0].picture = makeBitmap("Menu_Images/Zeus.bmp");
        aGod[1].picture = makeBitmap("Menu_Images/Mars.bmp");
        aGod[2].picture = makeBitmap("Menu_Images/Neptune.bmp");
        switch(characterClicked)
        {
            case 0:
                 aGod[0].picture = makeBitmap("Menu_Images/ZeusH.bmp");
            break;
            case 1:
                 aGod[1].picture = makeBitmap("Menu_Images/MarsH.bmp");
            break;
            case 2:
                 aGod[2].picture = makeBitmap("Menu_Images/NeptuneH.bmp");
            break;
        }
        for (i=0; i<=2; i++)
        {
                 draw_sprite(menuBuffer, aGod[i].picture, aGod[i].left, aGod[i].top);
        }
        draw_sprite(menuBuffer, godNames[characterClicked], 616, 515);
        draw_sprite(menuBuffer, forwardArrow.picture, forwardArrow.left, forwardArrow.top);
}