void TextAnimator::updateObject(TextAnimObj& obj) { core::rect<s32> r = obj.pTextObj->getRect(); video::SColor textCol; // offset the object as expected switch ( obj.dir ) { case TAD_VERTICAL: offsetRect(r, 0, obj.offsetPerTick); break; case TAD_HORIZONTAL: offsetRect(r, obj.offsetPerTick, 0); break; } obj.pTextObj->setRect(r); // perform whatever effect we need to switch ( obj.effect ) { case TAE_NONE: break; case TAE_FADEOUT: { if ( obj.ticksBeforeEffect <= obj.numTicksAnimated ) { textCol = obj.pTextObj->getTextColor(); textCol.setAlpha( textCol.getAlpha() + obj.effectDelta); obj.pTextObj->setTextColor(textCol); } } break; case TAE_FADEIN: { if ( obj.ticksBeforeEffect >= obj.numTicksAnimated ) { textCol = obj.pTextObj->getTextColor(); textCol.setAlpha( textCol.getAlpha() + obj.effectDelta); obj.pTextObj->setTextColor(textCol); } } break; default: break; } obj.numTicksAnimated++; }
XBOOL XXObjectRectangle::SysCallMethod(int id,XSWFCONTEXT*pCnt,XXVARLIST&list) { switch(id) { case _SYSID(clone): pCnt->pStack->Push(Clone()); return XTRUE; case _SYSID(contains): contains(*pCnt,list); return XTRUE; case _SYSID(containsPoint): containsPoint(*pCnt,list); return XTRUE; case _SYSID(containsRectangle): containsRectangle(*pCnt,list); return XTRUE; case _SYSID(equals): equalsRect(*pCnt,list); return XTRUE; case _SYSID(inflate): inflate(*pCnt,list); return XTRUE; case _SYSID(inflatePoint): inflatePoint(*pCnt,list); return XTRUE; case _SYSID(intersection): intersection(*pCnt,list); return XTRUE; case _SYSID(intersects): intersects(*pCnt,list);return XTRUE; case _SYSID(isEmpty): pCnt->pStack->PushBool((width==0&&height==0)); return XTRUE; case _SYSID(offset): offsetRect(*pCnt,list); return XTRUE; case _SYSID(offsetPoint): offsetPoint(*pCnt,list); return XTRUE; case _SYSID(setEmpty): left=top=0; width=height=0; pCnt->pStack->PushConst(XOCT_UNDEFINE); return XTRUE; case _SYSID(toString): { XXVar var; GetString(var); pCnt->pStack->Push(var); }return XTRUE; case _SYSID(union): unionRect(*pCnt,list); return XTRUE; } return XXObject::SysCallMethod(id,pCnt,list); }
int main(int argc, char* argv[]) { bool bAlignment = false; int arg_base = 1; for (;arg_base < argc; ++arg_base) { const char *a = argv[arg_base]; if (a[0] != '-') break; if (std::strcmp(a+1, "alignment") == 0) { bAlignment = true; } } const char * outputFilePath = argv[arg_base]; const char * const * inputFilePaths = argv + arg_base + 1; int numInputs = argc - arg_base - 1; if (numInputs < 1) usage(argc, argv); // Read Images for (int i = 0; i < numInputs; ++i) { float shutter; if (!readExif(inputFilePaths[i], shutter)) { std::printf("%s : shutter ?\n > ", inputFilePaths[i]); std::scanf("%f", &shutter); } cv::Mat img = cv::imread(inputFilePaths[i], cv::IMREAD_COLOR); sourceImages.push_back(img); exposureTimes.push_back(shutter); indirectIndex.push_back(i); } // Sort by exposure time auto cmp = [](int a, int b){ return exposureTimes[a] < exposureTimes[b]; }; std::sort(indirectIndex.begin(), indirectIndex.end(), cmp); if (0) { char buf[128]; for (int i = 0; i < numInputs; ++i) { sprintf(buf, "input-%d", i); cv::imshow(buf, getImage(i)); } cv::waitKey(0); } // Perform Alignment if (bAlignment) { std::vector<cv::Mat> imgs(numInputs); for (int i = 0; i < numInputs; ++i) { imgs[i] = getImage(i); } std::vector<cv::Point> offsets; alignment(imgs, offsets); cv::Size minsize = getImage(0).size(); for (int i = 0; i < numInputs; ++i) { std::printf("offset[%d] = %d %d\n", i, offsets[i].x, offsets[i].y); imgs[i] = cv::Mat(imgs[i], offsetRect(offsets[i], i)); cv::Size sz = imgs[i].size(); minsize.width = std::min(minsize.width, sz.width); minsize.height = std::min(minsize.height, sz.height); } std::printf("minsize = %d %d\n", minsize.width, minsize.height); for (int i = 0; i < numInputs; ++i) { cv::Rect rect(cv::Point(0,0), minsize); sourceImages[indirectIndex[i]] = imgs[i](rect).clone(); } } // Recover Response Curve cv::Mat rc = recoverResponseCurve(); if (0) { std::printf("response curve:\n"); for (int i = 0; i < 256; ++i) { std::printf("%d, %f\n", i, rc.at<float>(i, 0)); } } // Generate Radiance Map cv::Mat hdr = generateRadianceMap(rc); // Write Output writeHDR(outputFilePath, hdr); if (1) { showHDR(hdr); cv::waitKey(0); } return 0; }
void GUIForumPostItem::setItemData(ForumThread* pThread) { std::wstringstream ss; core::rect<s32> itemRect(5, 0, RelativeRect.getWidth()-5, RelativeRect.getHeight()), startRect; IGUIFont* pFont = Environment->getSkin()->getFont(); startRect = itemRect; itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + FPI_AUTHOR_HEIGHT; if ( !m_pTxtAuthor ) { ss << L"Author: " << pThread->getAuthorName().c_str(); m_pTxtAuthor = Environment->addStaticText(ss.str().c_str(), itemRect, false, false, this); m_pTxtAuthor->setOverrideColor(m_colText); m_pTxtAuthor->setTextAlignment( EGUIA_UPPERLEFT, EGUIA_CENTER ); ss.str(L""); } if ( pThread->getTitle().size() ) { offsetRect(itemRect, 0, itemRect.getHeight() + 5); if ( !m_pTxtSubject ) { ss << L"Subject: " << pThread->getTitle().c_str(); m_pTxtSubject = Environment->addStaticText(ss.str().c_str(), itemRect, false, false, this); m_pTxtSubject->setOverrideColor(m_colText); m_pTxtSubject->setTextAlignment( EGUIA_UPPERLEFT, EGUIA_CENTER ); ss.str(L""); } } offsetRect(itemRect, 0, itemRect.getHeight() + 5); if ( !m_pTxtContent ) { ss << pThread->getContent().c_str(); m_pTxtContent = Environment->addStaticText(ss.str().c_str(), itemRect, true, true, this); m_pTxtContent->setBackgroundColor(m_colBkg); m_pTxtContent->setOverrideColor(m_colText); itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + m_pTxtContent->getTextHeight(); m_pTxtContent->setRelativePosition( itemRect ); ss.str(L""); } // if this is a mission thread, then we need to create the button to accept the mission if ( pThread->getMissionID() ) { // check which options should be shown MissionMgr& missionMgr = FCModel::instance().GetMissionMgr(); bool bAccepted = missionMgr.isMissionAccepted(pThread->getMissionID()); bool bCompleted = missionMgr.isMissionComplete(pThread->getMissionID()); if ( !bAccepted && !bCompleted ) { offsetRect(itemRect, 0, itemRect.getHeight() + 5); itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + 20; core::rect<s32> btnRect = itemRect; ss << "Accept"; btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + pFont->getDimension(ss.str().c_str()).Width + 20; m_pBtnAccept = Environment->addButton(btnRect, this, BTN_ACCEPT, ss.str().c_str()); } } core::rect<s32> myRect = getRelativePosition(); myRect.LowerRightCorner.Y = myRect.UpperLeftCorner.Y + ( itemRect.LowerRightCorner.Y - startRect.UpperLeftCorner.Y ) + 5; setRelativePosition(myRect); m_pThread = pThread; }