本文整理汇总了C++中overlay函数的典型用法代码示例。如果您正苦于以下问题:C++ overlay函数的具体用法?C++ overlay怎么用?C++ overlay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了overlay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jump
void jump(int start_x,int x_end,int start_y,cv::Mat character,cv::Mat back,int width,int height){
cv::Mat blend;
cv::Mat img;
char c;
int walk_end_x = x_end-start_x-329;
int top_x =(start_x+x_end)/2;
int y = start_y-50;
int x = start_x;
int up_y=start_y+character.rows;
std::cout<<"y="<<y<<",start_y"<<start_y<<std::endl;
std::cout<<"x="<<x<<std::endl;
img = character;
x= 0;
std::cout<<"top_x"<<top_x<<std::endl;
while(start_x<=x_end){
overlay(img, back, blend, cv::Point(start_x+200,start_y));
cv::Mat anime(blend,cv::Rect(x+start_x,0,width,height));
//std::cout<<"x="<<start_x<<",y="<<start_y<<std::endl;
imshow(winname,anime);
if(start_y >= 255-img.rows){
start_y=start_y-6;
}else if(start_x<x_end){
start_x=start_x+6;
//std::cout<<"x_2="<<x+start_x<<std::endl;
}
c=cv::waitKey(10);
if(c==27){
break;
}
}
while(start_x>=x_end){
overlay(img, back, blend, cv::Point(start_x+200,start_y));
cv::Mat anime(blend,cv::Rect(x+start_x,0,width,height));
//std::cout<<"x="<<start_x<<",y="<<start_y<<std::endl;
imshow(winname,anime);
if(start_y <= y){
start_y=start_y+6;
}
else if(start_y>=y){
break;
}
c=cv::waitKey(10);
if(c==27){
break;
}
}
}
示例2: default_data
void Theme::build_transport(char *title,
unsigned char *png_overlay,
VFrame **bg_data,
int third)
{
if(!png_overlay) return;
VFrame default_data(png_overlay);
VFrame *data[3];
data[0] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
data[1] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
data[2] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
data[0]->clear_frame();
data[1]->clear_frame();
data[2]->clear_frame();
for(int i = 0; i < 3; i++)
{
int in_x1;
int in_x2;
if(!bg_data[i]) break;
switch(third)
{
case 0:
in_x1 = 0;
in_x2 = default_data.get_w();
break;
case 1:
in_x1 = (int)(bg_data[i]->get_w() * 0.33);
in_x2 = in_x1 + default_data.get_w();
break;
case 2:
in_x1 = bg_data[i]->get_w() - default_data.get_w();
in_x2 = in_x1 + default_data.get_w();
break;
}
overlay(data[i],
bg_data[i],
in_x1,
in_x2);
overlay(data[i],
&default_data);
}
new_image_set_images(title, 3, data[0], data[1], data[2]);
}
示例3: build_gcsa_lcp
void build_gcsa_lcp(const HandleGraph& graph,
gcsa::GCSA*& gcsa,
gcsa::LCPArray*& lcp,
int kmer_size,
size_t doubling_steps,
size_t size_limit,
const string& base_file_name) {
// Add an overlay with the source and sink nodes for GCSA
SourceSinkOverlay overlay(&graph, kmer_size);
gcsa::ConstructionParameters params;
params.setSteps(doubling_steps);
params.setLimit(size_limit);
// Generate the kmers and reduce the size limit by their size.
size_t kmer_bytes = params.getLimitBytes();
string tmpfile = write_gcsa_kmers_to_tmpfile(overlay, kmer_size,
kmer_bytes,
overlay.get_id(overlay.get_source_handle()),
overlay.get_id(overlay.get_sink_handle()),
base_file_name);
params.reduceLimit(kmer_bytes);
// set up the input graph using the kmers
gcsa::InputGraph input_graph({ tmpfile }, true);
// run the GCSA construction
gcsa = new gcsa::GCSA(input_graph, params);
// and the LCP array construction
lcp = new gcsa::LCPArray(input_graph, params);
// delete the temporary debruijn graph file
temp_file::remove(tmpfile);
// results returned by reference
}
示例4: TreeView
START_NS
ModelViewReadOnly::ModelViewReadOnly(QWidget * parent):
TreeView(parent)
{
setHeaderHidden(true);
//header()->setResizeMode(QHeaderView::Stretch);
setRootIsDecorated(false);
setIndentation(0);
setExpandsOnDoubleClick(true);
setItemDelegateForColumn(0, new ModelTreeDelegate());
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setSelectionMode( SingleSelection );
setSelectionBehavior(SelectRows);
// we disable the provided dnd features,
// as we use a proprietary solution
setDragDropMode(QAbstractItemView::DragDrop);
setDragEnabled(true);
setAcceptDrops(false);
overlay()->setText(tr("Please load a model"));
connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(__clicked(QModelIndex)));
}
示例5: balls
balls()
{
overlay(treescrn, treescrn2);
mvwaddch(treescrn2, 3, 9, (chtype)'@');
mvwaddch(treescrn2, 3, 15, (chtype)'@');
mvwaddch(treescrn2, 4, 8, (chtype)'@');
mvwaddch(treescrn2, 4, 16, (chtype)'@');
mvwaddch(treescrn2, 5, 7, (chtype)'@');
mvwaddch(treescrn2, 5, 17, (chtype)'@');
mvwaddch(treescrn2, 7, 6, (chtype)'@');
mvwaddch(treescrn2, 7, 18, (chtype)'@');
mvwaddch(treescrn2, 8, 5, (chtype)'@');
mvwaddch(treescrn2, 8, 19, (chtype)'@');
mvwaddch(treescrn2, 10, 4, (chtype)'@');
mvwaddch(treescrn2, 10, 20, (chtype)'@');
mvwaddch(treescrn2, 11, 2, (chtype)'@');
mvwaddch(treescrn2, 11, 22, (chtype)'@');
mvwaddch(treescrn2, 12, 1, (chtype)'@');
mvwaddch(treescrn2, 12, 23, (chtype)'@');
wrefresh(treescrn2);
wrefresh(w_del_msg);
return( 0 );
}
示例6: fdog_filter
texture_2d fdog_filter(const texture_2d& src,
const texture_2d& tfm,
int n,
float sigma_e,
float sigma_r,
float tau,
float sigma_m,
float phi)
{
texture_2d tmp(src.clone_format());
texture_2d dst(src.clone_format());
for (int i = 0; i < n; ++i) {
texture_2d img = (i == 0)? src : overlay(dst, src);
glsl_program fdog0("fdog0_fs.glsl");
fdog0.use();
fdog0.bind_sampler("img", img, GL_LINEAR);
fdog0.bind_sampler("tfm", tfm, GL_NEAREST);
fdog0.set_uniform_1f("sigma_e", sigma_e);
fdog0.set_uniform_1f("sigma_r", sigma_r);
fdog0.set_uniform_1f("tau", tau);
fdog0.set_uniform_2f("img_size", (float)src.get_width(), (float)src.get_height());
fdog0.draw(&tmp);
glsl_program fdog1("fdog1_fs.glsl");
fdog1.use();
fdog1.bind_sampler("img", tmp, GL_LINEAR);
fdog1.bind_sampler("tfm", tfm, GL_NEAREST);
fdog1.set_uniform_1f("sigma_m", sigma_m);
fdog1.set_uniform_1f("phi", phi);
fdog1.set_uniform_2f("img_size", (float)src.get_width(), (float)src.get_height());
fdog0.draw(&dst);
}
return dst;
}
示例7: walk
void walk(int start_x,int end_x,int y,cv::Mat character1,cv::Mat character2,cv::Mat back,int width,int height){
int x=0;
char c;
cv::Mat blend;
cv::Mat img;
while(start_x+x<=end_x){
if(x%3==0){
if(!img.data) img = character1;
else if(img.data==character1.data) img = character2;
else if(img.data==character2.data) img = character1;
}
// std::cout<<"x="<<x+start_x<<",y="<<y<<std::endl;
// std::cout<<"width="<<width<<",height="<<height<<std::endl;
overlay(img, back, blend, cv::Point(200+x+start_x,225)); //合成
cv::Mat anime(blend,cv::Rect(start_x+x,0,width,height));
imshow(winname,anime);
x=x+4;
c=cv::waitKey(10);
if(c==27){
break;
}
}
}
示例8: QTreeWidget
START_NS
ProposalTreeWidget::ProposalTreeWidget(QWidget * p)
: QTreeWidget(p),
mOverlay(new Overlay(this)),
mAddRemoveEnabled(false),
mSolutionSelectionMultiple(true)
//mSolutionDelegate(new SolutionCheckDelegate(this) )
{
setDragEnabled(true);
setDragDropMode(InternalMove);
viewport()->setAcceptDrops(true);
setDropIndicatorShown(true);
setSelectionMode(SingleSelection);
setEditTriggers(AllEditTriggers);
// maintain order accordingly to ColumnId, ColumnProposalText, etc.
setHeaderLabels( QStringList() << tr("Id") << tr("Text") << tr("Solution") );
setRootIsDecorated(false);
setWordWrap(true);
overlay()->setText( tr("Right click to add new proposal") );
connect(this, SIGNAL(itemSelectionChanged()),this, SLOT(onSelectionChange()));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(onItemChange(QTreeWidgetItem*,int)));
connect(this,SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onClicked(QTreeWidgetItem*,int)));
}
示例9: overlay
void item_palette::setup(const config& cfg)
{
for (const config& group : cfg.child_range("item_group")) {
groups_.push_back(item_group(group));
for (const config& item : group.child_range("item")) {
item_map_.insert(std::pair<std::string, overlay>(item["id"], overlay(item)));
group_map_[group["id"]].push_back(item["id"]);
if (!group["core"].to_bool(false))
non_core_items_.insert(item["id"]);
}
nmax_items_ = std::max(nmax_items_, group_map_[group["id"]].size());
}
select_fg_item("anvil");
select_bg_item("altar");
// Set the default group
set_group("items");
if(active_group().empty()) {
ERR_ED << "No items found." << std::endl;
}
}
示例10: overlay
gui::OverlayPtr_T UIFactory::createOverlay(const gui::Coords& position, const gui::Coords& size)
{
gui::OverlayPtr_T overlay(new gui::Overlay());
overlay->setPosition(position);
overlay->setSize(size);
return overlay;
}
示例11: Q_ASSERT_X
void ProposalTreeWidget::onActionRemove()
{
Q_ASSERT_X(mClickedIndex.isValid(), "ProposalTreeWidget::onActionRemove","Invalid model index");
model()->removeRow( mClickedIndex.row() );
overlay()->setVisible( model()->rowCount()==0 );
renumber();
}
示例12: findCollision
bool IMGUI::findCollision(Box &r, Box &out){
for(auto &it : m_collRects){
if(overlay(it, r)){
out = it;
return true;
}
}
return false;
}
示例13: QImage
void QBlittablePixmapData::mergeOverlay()
{
if (m_unmergedCopy || !showRasterOverlay)
return;
m_unmergedCopy = new QImage(buffer()->copy());
QPainter p(buffer());
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.drawImage(0,0,*overlay());
p.end();
}
示例14: prehash_search_and_replace
// trivial implementation to highlight how to use
// wildcard search combined with exchange.
bool prehash_search_and_replace(const char *file) {
if (FILE *f = fopen(file, "rb")) {
fseek(f, 0, SEEK_END);
size_t size = ftell(f);
fseek(f, 0, SEEK_SET);
size_t buffer_size = size + PHASH_MAX_MARGIN;
if (void *buffer = malloc(buffer_size)) {
fread(buffer, size, 1, f);
fclose(f);
// create an overlay string to start scanning
strovl overlay((char*)buffer, (strl_t)buffer_size, (strl_t)size);
// calculate hash of entire file
unsigned int original_hash = overlay.fnv1a();
// find all instances of PHASH token
// extra quotes inserted to allow running tool over this file
strref pattern("P""HASH(*{ \t}\"*@\"*{!\n\r/})");
strref match;
strown<PHASH_MAX_LENGTH> replace;
while ((match = overlay.wildcard_after(pattern, match))) {
// get the keyword to hash
strref keyword = match.between('"', '"');
// generate a replacement to the original string
replace.sprintf("PHASH(\"" STRREF_FMT "\", 0x%08x)", STRREF_ARG(keyword), keyword.fnv1a());
// exchange the match with the evaluated string
overlay.exchange(match, replace.get_strref());
// if about to run out of space, early out.
if (overlay.len()>(overlay.cap()-PHASH_EXTEND_CHARACTERS))
break;
}
// check if there was a change to the data
if (size != overlay.len() || original_hash != overlay.fnv1a()) {
// write back if possible
if ((f = fopen(file, "wb"))) {
fwrite(overlay.get(), overlay.len(), 1, f);
fclose(f);
} else {
free(buffer);
return false;
}
}
free(buffer);
return true;
} else
fclose(f);
}
return false;
}
示例15: QDialog
plotsDialog::plotsDialog(QString startPlot, bool fromTable, QWidget *parent) :
QDialog(parent),
ui(new Ui::plotsDialog)
{
ui->setupUi(this);
tabs = ui->tabWidget;
// setContextMenuPolicy(Qt::NoContextMenu);
setWindowFlags(Qt::Window);
setWindowModality(Qt::WindowModal);
setWindowTitle("Plots");
connect(tabs,SIGNAL(currentChanged(int)),SLOT(resetZoomer(int)));
contextMenu = new QMenu(this);
QAction *actionZoom = new QAction("Zoom",this);
actionZoom->setCheckable(true);
connect(actionZoom,SIGNAL(toggled(bool)),this,SLOT(enableZoomMode(bool)));
contextMenu->addAction(actionZoom);
QAction *actionFormat = new QAction("Format Plot",this);
connect(actionFormat,SIGNAL(triggered()),this,SLOT(edit()));
contextMenu->addAction(actionFormat);
ui->overlayButton->setText("Overlay");
connect(ui->overlayButton,SIGNAL(clicked()),SLOT(overlay()));
ui->deleteButton->setText("Delete");
connect(ui->deleteButton,SIGNAL(clicked()),SLOT(deleteCurrentPlot()));
statusBar = new QStatusBar;
ui->statusBarLayout->addWidget(statusBar);
QMenu* exportMenu = new QMenu;
exportMenu->addAction("Print");
exportMenu->addAction("pdf File");
exportButton = ui->exportMenuButton;
exportButton->setPopupMode(QToolButton::MenuButtonPopup);
exportButton->setMenu(exportMenu);
startPName = startPlot;
isFromTable = fromTable;
ui->zoomButton->setCheckable(true);
setupPlots(true);
theMainwindow->setTPMenu();
actionZoom->setChecked(false);
}