void TimgFilterLogoaway::Tplane::process(const TlogoawaySettings *cfg) { createBorder(cfg,TlogoawaySettings::NORTH,cfg->bordn_mode); createBorder(cfg,TlogoawaySettings::EAST ,cfg->borde_mode); createBorder(cfg,TlogoawaySettings::SOUTH,cfg->bords_mode); createBorder(cfg,TlogoawaySettings::WEST ,cfg->bordw_mode); saveLogoBorder(TlogoawaySettings::NORTH); saveLogoBorder(TlogoawaySettings::SOUTH); saveLogoBorder(TlogoawaySettings::EAST ); saveLogoBorder(TlogoawaySettings::WEST ); switch (cfg->mode) { case TlogoawaySettings::MODE_XY: setAverageVH(cfg); for (int i=1; i<=cfg->blur; i++) { blurLogotemp(false); } break; case TlogoawaySettings::MODE_UGLARM: uwe(cfg); break; case TlogoawaySettings::MODE_SOLIDFILL: setSolid(cfg); break; case TlogoawaySettings::MODE_SHAPEXY: if (parambitmapdata) { renderShapeXY(cfg); for (int i=1; i<=cfg->blur; i++) { blurLogotemp(true); } break; } else { return; } case TlogoawaySettings::MODE_SHAPEUGLARM: if (parambitmapdata) { renderShapeUwe(cfg); for (int i=1; i<=cfg->blur; i++) { blurLogotemp(true); } break; } else { return; } } loadLogo(cfg, cfg->bordn_mode==TlogoawaySettings::BM_INTERPOLATE, cfg->borde_mode==TlogoawaySettings::BM_INTERPOLATE, cfg->bords_mode==TlogoawaySettings::BM_INTERPOLATE, cfg->bordw_mode==TlogoawaySettings::BM_INTERPOLATE); }
void WidgetCheckBox::load(const Aurora::GFF3Struct &gff) { KotORWidget::load(gff); Border border = createBorder(gff); Graphics::Aurora::TextureHandle texture = TextureMan.get(border.fill); float squareLength = _quad->getHeight(); float _quadPosCorrect = (squareLength - (texture.getTexture().getHeight() * 0.625f)) / 2; float x, y, z; if (_quad) { _quad->getPosition(x, y, z); _quad->setPosition(x + _quadPosCorrect, y + _quadPosCorrect, z); _quad->setHeight(texture.getTexture().getHeight() * 0.625f); _quad->setWidth(texture.getTexture().getWidth() * 0.625f); } if (_text) { _text->getPosition(x, y, z); _text->setPosition(x + squareLength, y, z); _text->setSize(_text->getWidth() - squareLength, _text->getHeight()); } if (getTextHighlightableComponent() != 0) { setTextHighlighting(getTextHighlightableComponent()); } if (getQuadHighlightableComponent() != 0) { setQuadHighlighting(getQuadHighlightableComponent()); } }
void PhotoView::createBorders() { _topLeftCorner = createBorder( "TopLeftCorner" ); _topBorder = createBorder( "TopBorder" ); _topRightCorner = createBorder( "TopRightCorner" ); _rightBorder = createBorder( "RightBorder" ); _bottomRightCorner = createBorder( "BottomRightCorner" ); _bottomBorder = createBorder( "BottomBorder" ); _bottomLeftCorner = createBorder( "BottomLeftCorner" ); _leftBorder = createBorder( "LeftBorder" ); }
void WidgetCheckBox::load(const Aurora::GFF3Struct &gff) { gff.getVector("COLOR", _r, _g, _b); _a = gff.getDouble("ALPHA", 1.0); Extend extend = createExtend(gff); _width = extend.w; _height = extend.h; Widget::setPosition(extend.x, extend.y, 0.0f); Border border = createBorder(gff); if (!border.fill.empty()) { _quad = new Graphics::Aurora::HighlightableGUIQuad(border.fill, 0.0f, 0.0f, extend.h * .62, extend.h * .62); } else { _quad = new Graphics::Aurora::GUIQuad(border.fill, 0.0f, 0.0f, extend.h * .62, extend.h * .62); } _quad->setPosition(extend.x, extend.y, 0.0f); _quad->setTag(getTag()); _quad->setClickable(true); if (border.fill.empty()) _quad->setColor(0.0f, 0.0f, 0.0f, 0.0f); Text text = createText(gff); if (!text.text.empty() && !text.font.empty()) { _text = new Graphics::Aurora::HighlightableText(FontMan.get(text.font), text.text, text.r, text.g, text.b, 1.0f); const float hspan = extend.w - _text->getWidth(); const float vspan = extend.h - _text->getHeight(); const float x = extend.x + text.halign * hspan; const float y = extend.y + text.valign * vspan; _text->setPosition(x, y, -1.0f); _text->setTag(getTag()); _text->setClickable(true); } if (getTextHighlightableComponent() != 0) { setDefaultHighlighting(getTextHighlightableComponent()); } if (getQuadHighlightableComponent() != 0) { setDefaultHighlighting(getQuadHighlightableComponent()); } }
int main(int argc, char *argv[]) { FILE * fin = NULL; FILE * fout = NULL; char ltr[MAX]; char lineOne[MAX]; char lineTwo[MAX]; char outputName[MAX]; int edgeWidth, centerRow, centerColumn, radius; int ** imageNumbers = NULL; int rows, columns, intensity; int i; fin = openFile(argc, argv, ltr, &edgeWidth, ¢erRow, ¢erColumn, &radius, outputName); fout = fopen(outputName, "w"); readFileHeader(fin, &rows, &columns, &intensity, lineOne, lineTwo); imageNumbers = (int**) malloc(rows * sizeof(int*)); for(i = 0; i < rows; i++) imageNumbers[i] = (int*)malloc(columns * sizeof(int)); fill2DArray(imageNumbers, rows, columns, fin); if(strcmp(ltr, "-e") == 0) createBorder(imageNumbers, rows, columns, edgeWidth); else createCircle(imageNumbers, centerRow, centerColumn, radius, rows, columns); intensity = findMax2DArray(imageNumbers,rows,columns); printArray2DToFile(imageNumbers, rows, columns, fout, lineOne, outputName, intensity); cleanUp(imageNumbers,rows); if(fin != NULL) fclose(fin); if(fout != NULL) fclose(fout); return 0; }
void Portrait::setPosition(float x, float y, float z) { GfxMan.lockFrame(); float width = ABS(_qPortrait.vX[0] - _qPortrait.vX[1]); float height = ABS(_qPortrait.vY[0] - _qPortrait.vY[2]); x += _border; y += _border; _qPortrait.vX[0] = x ; _qPortrait.vY[0] = y ; _qPortrait.vX[1] = x + width; _qPortrait.vY[1] = y ; _qPortrait.vX[2] = x + width; _qPortrait.vY[2] = y + height; _qPortrait.vX[3] = x ; _qPortrait.vY[3] = y + height; createBorder(); _distance = z; resort(); GfxMan.unlockFrame(); }
bool GameScene24::init() { if ( !Layer::init() ) { return false; } m_ui = UISimple::create(); this->addChild(m_ui, 30); Size visibleSize = Director::getInstance()->getWinSize(); Point origin = Director::getInstance()->getVisibleOrigin(); zidan = false; time = 5.0; //背景 auto bg = Sprite::create("level_24/bg.jpg"); bg->setPosition(Point(visibleSize.width* 0.5f,visibleSize.height * 0.5f)); this->addChild(bg); //创建月亮 moon = Sprite::create("level_24/hand1.png"); moon->setPosition(Point(visibleSize.width * 0.5f,visibleSize.height * 0.5f)); moon->setAnchorPoint(Point::ANCHOR_MIDDLE); moon->setTag(13); this->addChild(moon); auto body = PhysicsBody::createCircle(moon->getContentSize().width * 0.5f); body->getShape(0)->setFriction(0.0f); body->getShape(0)->setRestitution(1.001f); body->getShape(0)->setDensity(1.0f); body->setCategoryBitmask(1); // 0001 body->setCollisionBitmask(1); // 0001 body->setContactTestBitmask(1); // 0001 body->setGravityEnable(false); moon->setPhysicsBody(body); body->applyImpulse(Vect(3500000, 0)); //创建锯齿边缘 auto border = Sprite::create("level_24/border.png"); Size borderSize = border->getContentSize(); auto border1 = createBorder(Point(borderSize.width * 0.9f, borderSize.height * 0.7f)); this->addChild(border1); auto border2 = createBorder(Point(visibleSize.width - borderSize.width * 0.5f, borderSize.height * 0.7f)); border2->setFlippedX(true); this->addChild(border2); auto border3 = createBorder(Point(visibleSize.width * 0.5f, visibleSize.height * 0.15f)); borderSize = border3->getContentSize(); border3->setRotation(90.0f); this->addChild(border3); auto border4 = createBorder(Point(visibleSize.width * 0.5f, visibleSize.height * 0.8f)); borderSize = border4->getContentSize(); border4->setRotation(90.0f); this->addChild(border4); //子弹 shoot = Sprite::create("level_24/zidan1.png"); shoot->setPosition(Point( visibleSize.width * 0.5f,visibleSize.height * 0.15f+40)); shoot->setVisible(false); shoot->setAnchorPoint(Point::ANCHOR_MIDDLE); shoot->setTag(14); this->addChild(shoot); body1 = PhysicsBody::createCircle(shoot->getContentSize().width * 0.5f); body1->setCategoryBitmask(1); // 0001 body1->setCollisionBitmask(1); // 0001 body1->setContactTestBitmask(1); // 0001 shoot->setPhysicsBody(body1); //加载初始文字 boss = Sprite::create("new/text_she.png"); boss->setAnchorPoint(Point::ANCHOR_MIDDLE_BOTTOM); boss->setPosition(Point(visibleSize.width/2,visibleSize.height+100)); this->addChild(boss,30); auto pSequence2 = Sequence::create(CallFunc::create( [&]() { auto bossAct = MoveTo::create(0.5f, Point(Director::getInstance()->getVisibleSize().width/2, 680)); auto bossEase = EaseBackInOut::create(bossAct); boss->runAction(bossEase); }), DelayTime::create(1.0f), CallFunc::create( [&]() { boss->runAction(MoveTo::create(0.5f, Point(Director::getInstance()->getVisibleSize().width/2, Director::getInstance()->getVisibleSize().height+200))); }),NULL); this->runAction(pSequence2); //触摸监听 auto listener = EventListenerTouchOneByOne::create(); //listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(GameScene24::onTouchBegan,this); listener->onTouchEnded = CC_CALLBACK_2(GameScene24::onTouchEnded,this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); //碰撞监听 auto contactListener = EventListenerPhysicsContact::create(); contactListener->onContactBegin = CC_CALLBACK_1(GameScene24::onContactBegin, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this); //5秒内无动作失败 this->schedule(schedule_selector(GameScene24::update)); return true; }