Exemplo n.º 1
0
//--------------------------------------------------------------
void testApp::ColorTable(){
    if(License(YEAR,MON,DAY,HOUR,MINUTE))
    {
        if(colorArray.size() > 0)
        {
            for (int i=0; i<colorArray.size(); i++)
            {
                palette(colorArray[i]);
            }
            //ofSort(colorTable,compareHue);
            //ofSort(colorTable,compareHue);
            for (int i=0; i<colorArray.size(); i++)
            {
                for (int j=0; j< colorTable.size(); j++)
                {
                    if(colorArray[i] == colorTable[j])
                    {
                        colorNumber.push_back(j);
                        break;
                    }
                }
            }
        }
        bPushAnal = false;
    }
}
Exemplo n.º 2
0
//--------------------------------------------------------------
int testApp::palette(ofColor c){
    if(License(YEAR,MON,DAY,HOUR,MINUTE)){
        ofColor tmpColor;
        tmpColor = c;
        
        if(colorTable.size() == 0)
        {
            colorTable.push_back(tmpColor);
        }
        else if(colorTable.size() > 0)
        {
            bool bCheck = true;
            for (int i=0; i<colorTable.size(); i++)
            {
                if(colorTable[i] == tmpColor)
                {
                    bCheck = false;
                    return colorTable.size();
                }
            }
            if(bCheck){
                colorTable.push_back(tmpColor);
            }
            ofSort(colorTable,compareHue);
        }
        return colorTable.size();
    }
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void testApp::printColor(){
    if(License(YEAR,MON,DAY,HOUR,MINUTE))
    {
        try {
            
            //for TEXT
            if(colorInfomationArray.size()>0)
            {
                ofstream file;
                file.open ("result.txt", ios::out);
                for (int i=0; i< colorInfomationArray.size() ; i++)
                {
                    file << colorInfomationArray[i] << colorNumber[i]+1 << "/" << endl;
                }
                file.close();
                bFileDone = true;
            }
            
            //for HTML
            if(colorInfomationHTML.size()>0)
            {
                ofstream file;
                file.open ("result.html", ios::out);
                file << "<html><head><title>Result</title></head><body><table border =\"1\"><tr align =\"center\"><td>Pixel</td><td>Image</td><td>X</td><td>Y</td><td>Color</td><td>Match</td></tr>" << endl;
                for (int i=0; i< colorInfomationHTML.size() ; i++)
                {
                    file << colorInfomationHTML[i] << "<td align =\"right\">" << colorNumber[i]+1 << "</td></tr>" << endl;
                }
                file << "</td></tr></table></body></html>" << endl;
                file.close();
                bFileDone = true;
            }
            
            //for HTML
            if(colorTable.size()>0)
            {
                ofstream file;
                file.open ("colorTable.html", ios::out);
                file << "<html><head><title>Color Table</title></head><body><table border =\"1\"><tr align =\"center\"><td>Number</td><td>Color</td><td>RGB</td></tr>" << endl;
                for (int i=0; i< colorTable.size() ; i++)
                {
                    file << "<tr>" << endl;
                    file << "<td align =\"right\">" << i+1 << "</td>" << endl;
                    file << "<td bgcolor=\"#" << ofToHex(colorTable[i].r)+ofToHex(colorTable[i].g)+ofToHex(colorTable[i].b) << "\"/>" << endl;
                    file << "<td align =\"center\">" << ofToString((int)colorTable[i].r) << "," << ofToString((int)colorTable[i].g) << "," << ofToString((int)colorTable[i].b) << "</td></tr>" << endl;
                }
                file << "</table></body></html>" << endl;
                file.close();
                bFileDone = true;
            }
            bPushCreate = false;
        }catch(exception e){
            
        }
    }
}
Exemplo n.º 4
0
void
WebBox::UserWantsSomething ()
{
  QPoint here = theButton->pos();
  QAction * userWants = userMenu.exec(mapToGlobal(here));
  if (userWants == userQuit) {
    quit();
  } else if (userWants == userNevermind) {
    return;
  } else if (userWants == userOpen) {
    EnableNewUrl ();
  } else if (userWants == userSettings) {
    SettingsMenu();
  } else if (userWants == userHelp) {
    Help ();
  } else if (userWants == userLicense) {
    License ();
  } else if (userWants == userVersion) {
    SetPage ("qrc:/version.html");
  }
}
Exemplo n.º 5
0
void glitex_lic(sqlite3_context* ctx, int argc, sqlite3_value** values)
{
	GoString lic = License();
	sqlite3_result_text(ctx, lic.p, lic.n, NULL);
}
Exemplo n.º 6
0
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
    if(License(YEAR,MON,DAY,HOUR,MINUTE))
    {
        if(mouseX >= 10 && mouseX <= (10 + 100) &&
           mouseY >= 10 && mouseY <= 50)
        {
            bLoad = false;
            bAnal = false;
            bPushLoad = false;
            bCreate = false;
            bFileDone = false;
            pos      = 0;
            imageCnt = 0;
            colorCnt = 0;
            folderPath = "";
            colorTable.clear();
            
            openFileResult = ofSystemLoadDialog("Select a Folder",true);
            folderPath = openFileResult.getPath();
        }
        
        if(mouseX >= 120 && mouseX <= (120 + 100) &&
           mouseY >= 10 && mouseY <= 50)
        {
            bPushLoad = true;
        }
        
        if(mouseX >= 230 && mouseX <= (230 + 100) &&
           mouseY >= 10 && mouseY <= 50)
        {
            bPushAnal = true;
        }
        
        
        if(mouseX >= 340 && mouseX <= (340 + 100) &&
           mouseY >= 10 && mouseY <= 50)
        {
            bPushCreate = true;
        }
        
        if(mouseX >= 10 && mouseX <= (10 + 60) &&
           mouseY >= 278 && mouseY <= (278+40))
        {
            bImageMakePush = true;
        }
        
        
        
        if(mouseX >= 204+36*0+4*0 && mouseX <= (204+36*0+4*0 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth += 100;
        }
        
        if(mouseX >= 204+36*1+4*1 && mouseX <= (204+36*1+4*1 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth -= 100;
        }
        
        if(mouseX >= 204+36*2+4*2 && mouseX <= (204+36*2+4*2 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth += 10;
        }
        
        if(mouseX >= 204+36*3+4*3 && mouseX <= (204+36*3+4*3 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth -= 10;
        }
        
        if(mouseX >= 204+36*4+4*4 && mouseX <= (204+36*4+4*4 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth += 1;
        }
        
        if(mouseX >= 204+36*5+4*5 && mouseX <= (204+36*5+4*5 + 36) &&
           mouseY >= 58 && mouseY <= 74)
        {
            imgWidth -= 1;
        }
        
        
        if(mouseX >= 204+36*0+4*0 && mouseX <= (204+36*0+4*0 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight += 100;
        }
        
        if(mouseX >= 204+36*1+4*1 && mouseX <= (204+36*1+4*1 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight -= 100;
        }
        
        if(mouseX >= 204+36*2+4*2 && mouseX <= (204+36*2+4*2 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight += 10;
        }
        
        if(mouseX >= 204+36*3+4*3 && mouseX <= (204+36*3+4*3 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight -= 10;
        }
        
        if(mouseX >= 204+36*4+4*4 && mouseX <= (204+36*4+4*4 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight += 1;
        }
        
        if(mouseX >= 204+36*5+4*5 && mouseX <= (204+36*5+4*5 + 36) &&
           mouseY >= 78 && mouseY <= 94)
        {
            imgHeight -= 1;
        }
        
        
        
        
        if(mouseX >= 204+36*0+4*0 && mouseX <= (204+36*0+4*0 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r += 100;
        }
        
        if(mouseX >= 204+36*1+4*1 && mouseX <= (204+36*1+4*1 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r -= 100;
        }
        
        if(mouseX >= 204+36*2+4*2 && mouseX <= (204+36*2+4*2 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r += 10;
        }
        
        if(mouseX >= 204+36*3+4*3 && mouseX <= (204+36*3+4*3 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r -= 10;
        }
        
        if(mouseX >= 204+36*4+4*4 && mouseX <= (204+36*4+4*4 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r += 1;
        }
        
        if(mouseX >= 204+36*5+4*5 && mouseX <= (204+36*5+4*5 + 36) &&
           mouseY >= 266 && mouseY <= 282)
        {
            wantColor.r -= 1;
        }
        
        
        if(mouseX >= 204+36*0+4*0 && mouseX <= (204+36*0+4*0 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g += 100;
        }
        
        if(mouseX >= 204+36*1+4*1 && mouseX <= (204+36*1+4*1 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g -= 100;
        }
        
        if(mouseX >= 204+36*2+4*2 && mouseX <= (204+36*2+4*2 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g += 10;
        }
        
        if(mouseX >= 204+36*3+4*3 && mouseX <= (204+36*3+4*3 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g -= 10;
        }
        
        if(mouseX >= 204+36*4+4*4 && mouseX <= (204+36*4+4*4 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g += 1;
        }
        
        if(mouseX >= 204+36*5+4*5 && mouseX <= (204+36*5+4*5 + 36) &&
           mouseY >= 286 && mouseY <= 302)
        {
            wantColor.g -= 1;
        }
        
        if(mouseX >= 204+36*0+4*0 && mouseX <= (204+36*0+4*0 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b += 100;
        }
        
        if(mouseX >= 204+36*1+4*1 && mouseX <= (204+36*1+4*1 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b -= 100;
        }
        
        if(mouseX >= 204+36*2+4*2 && mouseX <= (204+36*2+4*2 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b += 10;
        }
        
        if(mouseX >= 204+36*3+4*3 && mouseX <= (204+36*3+4*3 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b -= 10;
        }
        
        if(mouseX >= 204+36*4+4*4 && mouseX <= (204+36*4+4*4 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b += 1;
        }
        
        if(mouseX >= 204+36*5+4*5 && mouseX <= (204+36*5+4*5 + 36) &&
           mouseY >= 306 && mouseY <= 322)
        {
            wantColor.b -= 1;
        }
        
    }
}