void cfg_menu_update_all_down() { if(menu_item==0) { setP(20, menu_cfg_items_x[MENU_CFG_SAVE], 25 + 20*8 , menu_cfg_items_x[MENU_CFG_SAVE]+15); drawRect(0, true, 0); //menu_cfg_update_items(); menu_item=12; draw_cfg_menu_items(); menu_item=0; setP(20, menu_cfg_items_x[menu_item], 25 + 20*8 , menu_cfg_items_x[menu_item]+15); drawRect(0, false, 0); } else { setP(20, menu_cfg_items_x[menu_item-1], 25 + 20*8 , menu_cfg_items_x[menu_item-1]+15); drawRect(0, true, 0); //menu_cfg_update_items(); menu_item-=1; draw_cfg_menu_items(); menu_item+=1; setP(20, menu_cfg_items_x[menu_item], 25 + 20*8 , menu_cfg_items_x[menu_item]+15); drawRect(0, false, 0); } draw_cfg_menu_items(); draw_cfg_menu(); }
void cfg_menu_update_all_up() { if(menu_item==12) { setP(20, menu_cfg_items_x[MENU_CFG_CPU], 25 + 20*8 , menu_cfg_items_x[MENU_CFG_CPU]+15); drawRect(0, true, 0); //menu_cfg_update_items(); menu_item=0; draw_cfg_menu_items(); menu_item=12; setP(20, menu_cfg_items_x[menu_item], 25 + 20*8 , menu_cfg_items_x[menu_item]+15); drawRect(0, false, 0); } else { setP(20, menu_cfg_items_x[menu_item+1], 25 + 20*8 , menu_cfg_items_x[menu_item+1]+15); drawRect(0, true, 0); //menu_cfg_update_items(); menu_item+=1; draw_cfg_menu_items(); menu_item-=1; setP(20, menu_cfg_items_x[menu_item], 25 + 20*8 , menu_cfg_items_x[menu_item]+15); drawRect(0, false, 0); } draw_cfg_menu_items(); draw_cfg_menu(); }
void Canhao::mover(){ if((key[KEY_RIGHT] || key[KEY_DOWN])&& this->tiro == false){ if(p.x < 1200){ this->proxBola->setP(proxBola->getP().x+10, proxBola->getP().y); // bola do canhao setP(this->p.x+10, this->p.y); } } else if((key[KEY_LEFT] || key[KEY_UP]) && this->tiro == false){ if(p.x > 40){ this->proxBola->setP(proxBola->getP().x-10, proxBola->getP().y); // bola do canhao setP(this->p.x-10, this->p.y); } } }
void generateEmployedP(Bees bees, int i) { float newP; if (isEmployed(bees, i)) newP = calcolateP(bees, i); setP(bees, i, newP); }
// Set from OpenSSL representation void OSSLDHPublicKey::setFromOSSL(const DH* inDH) { const BIGNUM* bn_p = NULL; const BIGNUM* bn_g = NULL; const BIGNUM* bn_pub_key = NULL; DH_get0_pqg(inDH, &bn_p, NULL, &bn_g); DH_get0_key(inDH, &bn_pub_key, NULL); if (bn_p) { ByteString inP = OSSL::bn2ByteString(bn_p); setP(inP); } if (bn_g) { ByteString inG = OSSL::bn2ByteString(bn_g); setG(inG); } if (bn_pub_key) { ByteString inY = OSSL::bn2ByteString(bn_pub_key); setY(inY); } }
bool RSAPrivateKey::deserialise(ByteString& serialised) { ByteString dP = ByteString::chainDeserialise(serialised); ByteString dQ = ByteString::chainDeserialise(serialised); ByteString dPQ = ByteString::chainDeserialise(serialised); ByteString dDP1 = ByteString::chainDeserialise(serialised); ByteString dDQ1 = ByteString::chainDeserialise(serialised); ByteString dD = ByteString::chainDeserialise(serialised); ByteString dN = ByteString::chainDeserialise(serialised); ByteString dE = ByteString::chainDeserialise(serialised); if ((dD.size() == 0) || (dN.size() == 0) || (dE.size() == 0)) { return false; } setP(dP); setQ(dQ); setPQ(dPQ); setDP1(dDP1); setDQ1(dDQ1); setD(dD); setN(dN); setE(dE); return true; }
// Set from OpenSSL representation void OSSLDSAPrivateKey::setFromOSSL(const DSA* dsa) { if (dsa->p) { ByteString p = OSSL::bn2ByteString(dsa->p); setP(p); } if (dsa->q) { ByteString q = OSSL::bn2ByteString(dsa->q); setQ(q); } if (dsa->g) { ByteString g = OSSL::bn2ByteString(dsa->g); setG(g); } if (dsa->priv_key) { ByteString x = OSSL::bn2ByteString(dsa->priv_key); setX(x); } }
Canhao::Canhao(Ponto p1){ setP(p1.x, p1.y); proxBola = new Bola(50); proxBola->randomColor(); proxBola->setP(p1.x+40, p1.y-5); tiro = false; }
// Set from OpenSSL representation void OSSLDSAPublicKey::setFromOSSL(const DSA* inDSA) { const BIGNUM* bn_p = NULL; const BIGNUM* bn_q = NULL; const BIGNUM* bn_g = NULL; const BIGNUM* bn_pub_key = NULL; DSA_get0_pqg(inDSA, &bn_p, &bn_q, &bn_g); DSA_get0_key(inDSA, &bn_pub_key, NULL); if (bn_p) { ByteString inP = OSSL::bn2ByteString(bn_p); setP(inP); } if (bn_q) { ByteString inQ = OSSL::bn2ByteString(bn_q); setQ(inQ); } if (bn_g) { ByteString inG = OSSL::bn2ByteString(bn_g); setG(inG); } if (bn_pub_key) { ByteString inY = OSSL::bn2ByteString(bn_pub_key); setY(inY); } }
bool SwDoor::moveDoorLine(QPointF &p, QPointF &what_moving) { calcCoef(p, what_moving); if (setP()) return true; else return false; }
// Set from Botan representation void BotanDHPublicKey::setFromBotan(const Botan::DH_PublicKey* dh) { ByteString p = BotanUtil::bigInt2ByteString(dh->group_p()); setP(p); ByteString g = BotanUtil::bigInt2ByteString(dh->group_g()); setG(g); ByteString y = BotanUtil::bigInt2ByteString(dh->get_y()); setY(y); }
// Set from Botan representation void BotanDSAPrivateKey::setFromBotan(const Botan::DSA_PrivateKey* inDSA) { ByteString inP = BotanUtil::bigInt2ByteString(inDSA->group_p()); setP(inP); ByteString inQ = BotanUtil::bigInt2ByteString(inDSA->group_q()); setQ(inQ); ByteString inG = BotanUtil::bigInt2ByteString(inDSA->group_g()); setG(inG); ByteString inX = BotanUtil::bigInt2ByteString(inDSA->get_x()); setX(inX); }
// Set from Botan representation void BotanDSAPrivateKey::setFromBotan(const Botan::DSA_PrivateKey* dsa) { ByteString p = BotanUtil::bigInt2ByteString(dsa->group_p()); setP(p); ByteString q = BotanUtil::bigInt2ByteString(dsa->group_q()); setQ(q); ByteString g = BotanUtil::bigInt2ByteString(dsa->group_g()); setG(g); ByteString x = BotanUtil::bigInt2ByteString(dsa->get_x()); setX(x); }
void gui_print(char *msg) { setP(0, 253, 480, 272); drawRect(0, true, 0); setP0(5, 265); drawString(msg, FSHADOW); setP0(400, 265); if(state & PSP_USB_ACTIVATED) drawString("USB: ON", FSHADOW); else drawString("USB: OFF", FSHADOW); }
int setParamsN(element *e){ int i,j,k; char buff[256]; if(organizeNodes(e->no)<0){ return(-1); } else{ if(setP(e)<0 || setQ(e)<0 || setR(e)<0) return(-1); } return(0); }
/** Sets a new value to the i-th parameter. * @param i :: The parameter index * @param value :: The new value * @param explicitlySet :: A boolean falgging the parameter as explicitly set (by user) */ void ChFun::setParameter(size_t i, const double& value, bool explicitlySet) { if (i >= nParams()) { throw std::out_of_range("ChFun parameter index out of range."); } setP( i, value ); if (explicitlySet) { m_explicitlySet[i] = true; } this->updateStateRequired(); }
bool DHParameters::deserialise(ByteString& serialised) { ByteString dP = ByteString::chainDeserialise(serialised); ByteString dG = ByteString::chainDeserialise(serialised); if ((dP.size() == 0) || (dG.size() == 0)) { return false; } setP(dP); setG(dG); return true; }
void draw_menu_section() { setP(20, 2, 300, 18); drawRect(0, true, 0); setP0(25, 12); if(menu_section == MENU_SECTION_MAIN) drawString("Main", FTHICK | FSHADOW); else drawString("Main", FSHADOW); #ifndef LIGHT setP0(75, 12); if(menu_section == MENU_SECTION_MUSIC) drawString("Music", FTHICK | FSHADOW); else drawString("Music", FSHADOW); #endif #ifdef VSH setP0(135, 12); if(menu_section == MENU_SECTION_TM) drawString("Tm", FTHICK | FSHADOW); else drawString("Tm", FSHADOW); setP0(175, 12); if(menu_section == MENU_SECTION_INFO) drawString("Infos", FTHICK | FSHADOW); else drawString("Infos", FSHADOW); setP0(235, 12); if(menu_section == MENU_SECTION_CFG) drawString("Config", FTHICK | FSHADOW); else drawString("Config", FSHADOW); #elif GAME #ifndef LIGHT setP0(130, 12); if(menu_section == MENU_SECTION_INFO) drawString("Infos", FTHICK | FSHADOW); else drawString("Infos", FSHADOW); setP0(185, 12); if(menu_section == MENU_SECTION_CFG) drawString("Config", FTHICK | FSHADOW); else drawString("Config", FSHADOW); #else setP0(75, 12); if(menu_section == MENU_SECTION_INFO) drawString("Infos", FTHICK | FSHADOW); else drawString("Infos", FSHADOW); setP0(135, 12); if(menu_section == MENU_SECTION_CFG) drawString("Config", FTHICK | FSHADOW); else drawString("Config", FSHADOW); #endif #endif }
// Set from Botan representation void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* inRSA) { ByteString inP = BotanUtil::bigInt2ByteString(inRSA->get_p()); setP(inP); ByteString inQ = BotanUtil::bigInt2ByteString(inRSA->get_q()); setQ(inQ); ByteString inDP1 = BotanUtil::bigInt2ByteString(inRSA->get_d1()); setDP1(inDP1); ByteString inDQ1 = BotanUtil::bigInt2ByteString(inRSA->get_d2()); setDQ1(inDQ1); ByteString inPQ = BotanUtil::bigInt2ByteString(inRSA->get_c()); setPQ(inPQ); ByteString inD = BotanUtil::bigInt2ByteString(inRSA->get_d()); setD(inD); ByteString inN = BotanUtil::bigInt2ByteString(inRSA->get_n()); setN(inN); ByteString inE = BotanUtil::bigInt2ByteString(inRSA->get_e()); setE(inE); }
bool DHPrivateKey::deserialise(ByteString& serialised) { ByteString dP = ByteString::chainDeserialise(serialised); ByteString dG = ByteString::chainDeserialise(serialised); ByteString dX = ByteString::chainDeserialise(serialised); if ((dP.size() == 0) || (dG.size() == 0) || (dX.size() == 0)) { return false; } setP(dP); setG(dG); setX(dX); return true; }
// Set from Botan representation void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* rsa) { ByteString p = BotanUtil::bigInt2ByteString(rsa->get_p()); setP(p); ByteString q = BotanUtil::bigInt2ByteString(rsa->get_q()); setQ(q); ByteString dp1 = BotanUtil::bigInt2ByteString(rsa->get_d1()); setDP1(dp1); ByteString dq1 = BotanUtil::bigInt2ByteString(rsa->get_d2()); setDQ1(dq1); ByteString pq = BotanUtil::bigInt2ByteString(rsa->get_c()); setPQ(pq); ByteString d = BotanUtil::bigInt2ByteString(rsa->get_d()); setD(d); ByteString n = BotanUtil::bigInt2ByteString(rsa->get_n()); setN(n); ByteString e = BotanUtil::bigInt2ByteString(rsa->get_e()); setE(e); }
// Set from OpenSSL representation void OSSLRSAPrivateKey::setFromOSSL(const RSA* inRSA) { if (inRSA->p) { ByteString inP = OSSL::bn2ByteString(inRSA->p); setP(inP); } if (inRSA->q) { ByteString inQ = OSSL::bn2ByteString(inRSA->q); setQ(inQ); } if (inRSA->dmp1) { ByteString inDP1 = OSSL::bn2ByteString(inRSA->dmp1); setDP1(inDP1); } if (inRSA->dmq1) { ByteString inDQ1 = OSSL::bn2ByteString(inRSA->dmq1); setDQ1(inDQ1); } if (inRSA->iqmp) { ByteString inPQ = OSSL::bn2ByteString(inRSA->iqmp); setPQ(inPQ); } if (inRSA->d) { ByteString inD = OSSL::bn2ByteString(inRSA->d); setD(inD); } if (inRSA->n) { ByteString inN = OSSL::bn2ByteString(inRSA->n); setN(inN); } if (inRSA->e) { ByteString inE = OSSL::bn2ByteString(inRSA->e); setE(inE); } }
void update_all_button() { setP(195, 75, 195 + 17*8 , 88); drawRect(0, true, 0); setP0(200, 85); gprintf("%s + %s", config->button_combo, config->button_menu); setP(195, 90, 195 + 20*8 , 103); drawRect(0, true, 0); setP0(200, 100); gprintf("%s + %s", config->button_combo, config->button_screenshot); setP(195, 105, 195 + 20*8 , 118); drawRect(0, true, 0); setP0(200, 115); gprintf("%s + %s", config->button_combo, config->button_cpu_plus); setP(195, 120, 195 + 20*8 , 133); drawRect(0, true, 0); setP0(200, 130); gprintf("%s + %s", config->button_combo, config->button_cpu_minus); setP(195, 135, 195 + 20*8 , 148); drawRect(0, true, 0); setP0(200, 145); gprintf("%s + %s", config->button_combo, config->button_brightness_plus); setP(195, 150, 195 + 20*8 , 163); drawRect(0, true, 0); setP0(200, 160); gprintf("%s + %s", config->button_combo, config->button_brightness_minus); setP(195, 165, 195 + 20*8 , 178); drawRect(0, true, 0); setP0(200, 175); gprintf("%s + %s", config->button_combo, config->button_music_menu); }
/*----------------------------------------------------------------------* | recreate this level (public) m.gee 01/05| | this function assumes, that the graph of the fine level problem has | | not changed since call to the constructor and therefore | | the graph and it's coloring do not have to be recomputed | | IMPORTANT: | | No matter on which level we are here, the vector xfine is ALWAYS | | a fine grid vector here! | *----------------------------------------------------------------------*/ bool ML_NOX::ML_Nox_MatrixfreeLevel::recreateLevel(int level, int nlevel, int plevel, ML* ml, ML_Aggregate* ag, Epetra_CrsMatrix** P, ML_NOX::Ml_Nox_Fineinterface& interface, const Epetra_Comm& comm, const Epetra_Vector& xfine) { // make some tests if (level != level_) { cout << "**ERR**: ML_Epetra::ML_Nox_MatrixfreeLevel::recreateLevel:\n" << "**ERR**: level_ " << level_ << " not equal level " << level << "\n" << "**ERR**: file/line: " << __FILE__ << "/" << __LINE__ << "\n"; throw -1; } if (nlevel != nlevel_) { cout << "**ERR**: ML_Epetra::ML_Nox_MatrixfreeLevel::recreateLevel:\n" << "**ERR**: nlevel_ " << nlevel_ << " not equal nlevel " << nlevel << "\n" << "**ERR**: file/line: " << __FILE__ << "/" << __LINE__ << "\n"; throw -1; } // printlevel might have changed ml_printlevel_ = plevel; ml_ = ml; ag_ = ag; destroyP(); // safer to use the new Ps setP(NULL); // we need the graph of the operator on this level. On the fine grid we can just ask the // fineinterface for it, on the coarser levels it has to be extracted from the ML-hierachy bool same; if (level_==0) { const Epetra_CrsGraph* graph = interface.getGraph(); // check whether the old graph matches the new one same = compare_graphs(graph,graph_); destroyFD(); // we are here to recompute the FD-operator (this destroys graph_) graph_ = ML_NOX::deepcopy_graph(graph); } else { // Note that ML has no understanding of global indices, so it makes up new GIDs // (This also holds for the Prolongators P) Epetra_CrsMatrix* tmpMat = 0; int maxnnz = 0; double cputime = 0.0; ML_Operator2EpetraCrsMatrix(&(ml_->Amat[level_]), tmpMat, maxnnz, false, cputime); // get a view from the graph const Epetra_CrsGraph& graph = tmpMat->Graph(); // compare the graph to the existing one same = compare_graphs(&graph,graph_); destroyFD(); // we are here to recompute the FD-operator (this destroys graph_) double t0 = GetClock(); graph_ = ML_NOX::deepcopy_graph(&graph); // delete the copy of the Epetra_CrsMatrix if (tmpMat) delete tmpMat; tmpMat = 0; double t1 = GetClock(); if (ml_printlevel_ > 0 && 0 == comm_.MyPID()) cout << "matrixfreeML (level " << level_ << "): extraction/copy of Graph in " << cputime+t1-t0 << " sec\n" << " max-nonzeros in Graph: " << maxnnz << "\n"; } // recreate this levels coarse interface if (same) coarseinterface_->recreate(ml_printlevel_,P,&(graph_->RowMap())); else { delete coarseinterface_; coarseinterface_ = new ML_NOX::Nox_CoarseProblem_Interface(fineinterface_,level_,ml_printlevel_, P,&(graph_->RowMap()),nlevel_); } // restrict the xfine-vector to this level Epetra_Vector* xthis = coarseinterface_->restrict_fine_to_this(xfine); if (!xthis) { cout << "**ERR**: ML_Epetra::ML_Nox_MatrixfreeLevel::ML_Nox_MatrixfreeLevel:\n" << "**ERR**: ML_Epetra::Nox_CoarseProblem_Interface::restrict_fine_to_this returned NULL on level " << level_ << "\n" << "**ERR**: file/line: " << __FILE__ << "/" << __LINE__ << "\n"; throw -1; } Epetra_Vector* xc = new Epetra_Vector(graph_->RowMap(),false); // FIXME: after intesive testing, this test might be obsolet #if 0 bool samemap = xc->Map().PointSameAs(xthis->Map()); if (samemap) { #endif xc->Update(1.0,*xthis,0.0); #if 0 } else { cout << "**WRN** Maps are not equal in\n" << "**WRN** file/line: " << __FILE__ << "/" << __LINE__ << "\n"; // import the xthis vector in the Map that ML produced for graph_ Epetra_Import* importer = new Epetra_Import(graph_->RowMap(),xthis->Map()); int ierr = xc->Import(*xthis,*importer,Insert); if (ierr) { cout << "**ERR**: ML_Epetra::ML_Nox_MatrixfreeLevel::ML_Nox_MatrixfreeLevel:\n" << "**ERR**: export from xthis to xc returned err=" << ierr <<"\n" << "**ERR**: file/line: " << __FILE__ << "/" << __LINE__ << "\n"; throw -1; } if (importer) delete importer; importer = 0; } #endif if (xthis) delete xthis; xthis = 0; // create the coloring of the graph if (ml_printlevel_>0 && comm_.MyPID()==0) { cout << "matrixfreeML (level " << level_ << "): Entering Recoloring on level " << level_ << "\n"; fflush(stdout); } double t0 = GetClock(); if (!same) // te graph has obviously changed, so we need to recolor { if (colorMap_) delete colorMap_; colorMap_ = 0; if (colorMapIndex_) delete colorMapIndex_; colorMapIndex_ = 0; if (colorcolumns_) delete colorcolumns_; colorcolumns_ = 0; colorMap_ = ML_NOX::ML_Nox_collapsedcoloring(graph_,bsize_,isDiagonalOnly_,ml_printlevel_); if (!colorMap_) colorMap_ = ML_NOX::ML_Nox_standardcoloring(graph_,isDiagonalOnly_); colorMapIndex_ = new EpetraExt::CrsGraph_MapColoringIndex(*colorMap_); colorcolumns_ = &(*colorMapIndex_)(*graph_); } else if (ml_printlevel_>0 && comm_.MyPID()==0) cout << "matrixfreeML (level " << level_ << "): Reusing existing Coloring on level " << level_ << "\n"; double t1 = GetClock(); if (ml_printlevel_>5) { cout << "matrixfreeML (level " << level_ << "): Proc " << comm_.MyPID() <<" (Re)Coloring time is " << (t1-t0) << " sec\n"; fflush(stdout); } #if 0 // print the colorMap_ if (comm_.MyPID()==0) cout << "colorMap_\n"; cout << *colorMap_; for (int i=0; i<colorcolumns_->size(); i++) { if (comm_.MyPID()==0) cout << "the " << i << " th colorcolumn_ - vector\n"; cout << colorcolumns_->operator[](i); } #endif // construct the FiniteDifferenceColoring-Matrix if (ml_printlevel_>0 && comm_.MyPID()==0) { cout << "matrixfreeML (level " << level_ << "): Entering Construction FD-Operator on level " << level_ << "\n"; fflush(stdout); } t0 = GetClock(); #if 1 // FD-operator with coloring (see the #if 1 in ml_nox_matrixfreelevel.H as well!) FD_ = new NOX::EpetraNew::FiniteDifferenceColoring(*coarseinterface_, *xc, *graph_, *colorMap_, *colorcolumns_, true, isDiagonalOnly_, fd_beta_,fd_alpha_); #else // FD-operator without coloring FD_ = new NOX::EpetraNew::FiniteDifference(*coarseinterface_, *xc, *graph_, fd_beta_,fd_alpha_); #endif // set differencing method if (fd_centered_) { FD_->setDifferenceMethod(NOX::EpetraNew::FiniteDifferenceColoring::Centered); } bool err = FD_->computeJacobian(*xc); if (err==false) { cout << "**ERR**: ML_Epetra::ML_Nox_MatrixfreeLevel::ML_Nox_MatrixfreeLevel:\n" << "**ERR**: NOX::Epetra::FiniteDifferenceColoring returned an error on level " << level_ << "\n" << "**ERR**: file/line: " << __FILE__ << "/" << __LINE__ << "\n"; throw -1; } t1 = GetClock(); if (ml_printlevel_>5) cout << "matrixfreeML (level " << level_ << "): Proc " << comm_.MyPID() <<" Finite Differencing operator constr. in " << (t1-t0) << " sec\n"; // get ref to computed Epetra_CrsMatrix A_ = dynamic_cast<Epetra_CrsMatrix*>(&(FD_->getUnderlyingMatrix())); // print number of calls to the coarse interface if (ml_printlevel_>5 && comm_.MyPID()==0) cout << "matrixfreeML (level " << level_ << "): Calls to coarse-computeF in FD-Operator: " << coarseinterface_->numcallscomputeF() << "\n"; // set counter for number of calls to the coarseinterface_->computeF back to zero coarseinterface_->resetnumcallscomputeF(); // tidy up if (xc) delete xc; xc = 0; return true; }
void RNAMencoding(IplImage *img, double epsilon, vector<GrayLevel> &P, vector<char> &Q, vector<CouplePoints> &blks, int &frag_num, int HWratio, int DIRpriority) { CvMat *R = cvCreateMat(img->height, img->width, CV_32FC1); CvMat *F = cvCreateMat(img->height, img->width, CV_32FC1); cvmSetZero(R); cvmSetZero(F); int r, c; int x1, y1, x2, y2; uchar *ptr; CouplePoints ps; for(r = 0; r < F->rows; r++) { ptr = (uchar *)(F->data.ptr + r*F->step); for(c = 0; c < F->cols; c++) { x1 = c; y1 = r; if(ptr[x1] != 0) continue; x2 = x1; y2 = y1; setPS(ps, x1, y1, x2, y2); if(DIRpriority == DIA_FIRST)//1.对角线搜索 { while(x2<img->width && y2<img->height && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { x2++; y2++; setPS(ps, x1, y1, x2, y2); } x2--; y2--; int temp_x2 = x2 + 1; int temp_y2 = y2 + 1; //对角线方向停止,横向继续 setPS(ps, x1, y1, temp_x2, y2); while(temp_x2<img->width && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { temp_x2++; setPS(ps, x1, y1, temp_x2, y2); } temp_x2--; //对角线方向停止,纵向继续 setPS(ps, x1, y1, x2, temp_y2); while(temp_y2<img->height && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { temp_y2++; setPS(ps, x1, y1, x2, temp_y2); } temp_y2--; if(temp_x2 - x2 > temp_y2 - y2)//[对角线 + 横向] 更大 { x2 = temp_x2; } else//[对角线 + 纵向] 更大 { y2 = temp_y2; } } else { if(DIRpriority == ROW_FIRST)//行优先 { while(x2<img->width && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { x2++; setPS(ps, x1, y1, x2, y2); } x2--; setPS(ps, x1, y1, x2, y2); while(y2<img->height && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { y2++; setPS(ps, x1, y1, x2, y2); } y2--; } else//列优先 { while(y2<img->height && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { y2++; setPS(ps, x1, y1, x2, y2); } y2--; setPS(ps, x1, y1, x2, y2); while(x2<img->width && IsHomogeneousBlock(img, ps, epsilon) == true && canF(F, ps)) { x2++; setPS(ps, x1, y1, x2, y2); } x2--; } } if(HWratio != NO_LIMIT)//有长宽比例限制 { if( (x2-x1+1)/(y2-y1+1) > HWratio ) { //宽度过大 x2 = (y2-y1+1)*HWratio + x1-1; } else { if( (y2-y1+1)/(x2-x1+1) >HWratio ) { //长度过大 y2 = (x2-x1+1)*HWratio + y1-1; } } } setPS(ps, x1, y1, x2, y2); blks.push_back(ps); setF(F, ps); setR(R, ps); setP(P, img, ps); } } frag_num = calFragNum(P, R); switch (METHOD) { case METHOD_NAM: CompressCoordinate(R, Q);//坐标矩阵压缩 break; case METHOD_FRAG_NAM: Fragment_CompressCoordinate(R, Q, frag_num);//分段编码压缩 break; case METHOD_AC_NAM: AC_CompressCoordinate(R, _nsym, _count); break; case METHOD_AC_FRAG_NAM: AC_Fragment_CompressCoordinate(R, _nsym, _count, frag_num); break; } // // // //copyMat(cm1, R); //dispIline(R, 484); }
void subtest1() { ButterFly *inP = getInP(); setP(inP); }
// Set from OpenSSL representation void OSSLDHPrivateKey::setFromOSSL(const DH* dh) { if (dh->p) { ByteString p = OSSL::bn2ByteString(dh->p); setP(p); } if (dh->g) { ByteString g = OSSL::bn2ByteString(dh->g); setG(g); } if (dh->priv_key) { ByteString x = OSSL::bn2ByteString(dh->priv_key); setX(x); } }
void draw_cfg_menu_init() { setP(15, 25, 480, 249); clearRect(0); setP(16, 25, 459, 240); drawRect(15, true, 0x0A0000FF); setP(20, MENU_CFG_CPU_X, 25 + 20*8 , MENU_CFG_CPU_X+15); drawRect(0, false, 0); draw_cfg_menu_items(); setP0(25, 55); drawString("Default Brightness :", FSHADOW); setP0(25, 70); drawString("Combo Button :", FSHADOW); setP0(25, 85); drawString("Menu Button :", FSHADOW); setP0(25, 100); drawString("Screenshot Button :", FSHADOW); setP0(25, 115); drawString("Cpu Speed+ Button :", FSHADOW); setP0(25, 130); drawString("Cpu Speed- Button :", FSHADOW); setP0(25, 145); drawString("Brightness+ Button :", FSHADOW); setP0(25, 160); drawString("Brightness- Button :", FSHADOW); setP0(25, 175); drawString("Music Menu Button :", FSHADOW); setP0(25, 190); drawString("Music Folder :", FSHADOW); setP0(25, 205); drawString("Capture Folder :", FSHADOW); setP0(25, 230); drawString("Save Configuration", FSHADOW); setP0(200, 40); gprintf("%i", config->default_cpu_speed); setP0(200, 55); gprintf("%i", config->default_brightness); setP0(200, 70); gprintf("%s", config->button_combo); setP0(200, 85); gprintf("%s + %s", config->button_combo, config->button_menu); setP0(200, 100); gprintf("%s + %s", config->button_combo, config->button_screenshot); setP0(200, 115); gprintf("%s + %s", config->button_combo, config->button_cpu_plus); setP0(200, 130); gprintf("%s + %s", config->button_combo, config->button_cpu_minus); setP0(200, 145); gprintf("%s + %s", config->button_combo, config->button_brightness_plus); setP0(200, 160); gprintf("%s + %s", config->button_combo, config->button_brightness_minus); setP0(200, 175); gprintf("%s + %s", config->button_combo, config->button_music_menu); setP0(200, 190); #ifdef LIGHT gprintf("Not Available"); #else gprintf("%s", config->music_folder); #endif setP0(200, 205); #ifdef LIGHT gprintf("Not Available"); #else gprintf("%s", config->capture_folder); #endif }
void draw_cfg_menu() { if(menu_item == MENU_CFG_CPU) { setP(195, 30, 195 + 4*8 , 43); drawRect(0, true, 0); setP0(200, 40); gprintf("%i", config->default_cpu_speed); } else if(menu_item == MENU_CFG_BRIGHTNESS) { setP(195, 45, 195 + 3*8 , 58); drawRect(0, true, 0); setP0(200, 55); gprintf("%i", config->default_brightness); } else if(menu_item == MENU_CFG_BT_COMBO) { setP(195, 60, 195 + 17*8 , 73); drawRect(0, true, 0); setP0(200, 70); gprintf("%s", config->button_combo); } else if(menu_item == MENU_CFG_BT_MENU) { setP(195, 75, 195 + 17*8 , 88); drawRect(0, true, 0); setP0(200, 85); gprintf("%s + %s", config->button_combo, config->button_menu); } else if(menu_item == MENU_CFG_BT_SCREENSHOT) { setP(195, 90, 195 + 20*8 , 103); drawRect(0, true, 0); setP0(200, 100); gprintf("%s + %s", config->button_combo, config->button_screenshot); } else if(menu_item == MENU_CFG_BT_CPU_PLUS) { setP(195, 105, 195 + 20*8 , 118); drawRect(0, true, 0); setP0(200, 115); gprintf("%s + %s", config->button_combo, config->button_cpu_plus); } else if(menu_item == MENU_CFG_BT_CPU_MINUS) { setP(195, 120, 195 + 20*8 , 133); drawRect(0, true, 0); setP0(200, 130); gprintf("%s + %s", config->button_combo, config->button_cpu_minus); } else if(menu_item == MENU_CFG_BT_BRIGHTNESS_PLUS) { setP(195, 135, 195 + 20*8 , 148); drawRect(0, true, 0); setP0(200, 145); gprintf("%s + %s", config->button_combo, config->button_brightness_plus); } else if(menu_item == MENU_CFG_BT_BRIGHTNESS_MINUS) { setP(195, 150, 195 + 20*8 , 163); drawRect(0, true, 0); setP0(200, 160); gprintf("%s + %s", config->button_combo, config->button_brightness_minus); } else if(menu_item == MENU_CFG_BT_MUSIC_MENU) { setP(195, 165, 195 + 20*8 , 178); drawRect(0, true, 0); setP0(200, 175); gprintf("%s + %s", config->button_combo, config->button_music_menu); } else if(menu_item == MENU_CFG_MUSIC_FOLDER) { setP(195, 180, 195 + 17*8 , 193); drawRect(0, true, 0); setP0(200, 190); #ifdef LIGHT gprintf("Not Available"); #else gprintf("%s", config->music_folder); #endif } else if(menu_item == MENU_CFG_CAPTURE_FOLDER) { setP(195, 195, 195 + 17*8 , 208); drawRect(0, true, 0); setP0(200, 205); #ifdef LIGHT gprintf("Not Available"); #else gprintf("%s", config->capture_folder); #endif } }