当前位置: 首页>>代码示例>>C++>>正文


C++ image::pixels方法代码示例

本文整理汇总了C++中image::pixels方法的典型用法代码示例。如果您正苦于以下问题:C++ image::pixels方法的具体用法?C++ image::pixels怎么用?C++ image::pixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


在下文中一共展示了image::pixels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: append_image_right

void image::append_image_right(image& image_to_append) {

	// Bring both images to the same height
	if (this->size_.height < image_to_append.size().height)
		append_height(image_to_append.size().height);
	else if (this->size_.height > image_to_append.size().height)
		image_to_append.append_height(this->size_.height);

	// Append new rows from other image to the right of each row
	for (int y = 0; y < (int) image_to_append.size().height; ++y) 
		for (int x = 0; x < (int) image_to_append.size().width; ++x) 
		     	this->pixels_.at(y).push_back(image_to_append.pixels().at(y).at(x));


	this->size_.width += image_to_append.size().width;

#if DEBUG
	cout << "images merged. array sizes: "
	     << this->pixels_.at(1).size()
	     << " width, "
	     << this->pixels_.size()
	     << " height. image size: "
	     << this->size_.width
	     << ", "
	     << this->size_.height
	     << endl;
#endif
}
开发者ID:halx99,项目名称:batchtool,代码行数:28,代码来源:image.cpp

示例2: insert_image

void image::insert_image(Pos& pos, image& image_to_insert) {
	// Check dimensions
	if (pos.x + image_to_insert.size().width > this->size_.width ||
	    pos.y + image_to_insert.size().height > this->size_.height) {
		cout << "Cant insert image: Size mismatch!" << endl;
		return;
	}

	for (int y = 0; y < image_to_insert.size().height; ++y)
		for (int x = 0; x < image_to_insert.size().width; ++x) 
			this->pixels_[y + pos.y][x + pos.x] = image_to_insert.pixels().at(y).at(x);
		
}
开发者ID:halx99,项目名称:batchtool,代码行数:13,代码来源:image.cpp

示例3: append_image_bot

void image::append_image_bot(image& image_to_append) {
	
	// Bring both images to the same width
	if (this->size_.width < image_to_append.size().width)
		append_width(image_to_append.size().width);
	else if (this->size_.width > image_to_append.size().width)
		image_to_append.append_width(this->size_.width);

	// Append new rows from other image at bottom
	for (vector<RGBA> row : image_to_append.pixels())
		this->pixels_.push_back(row);

	// Update height
	this->size_.height += image_to_append.size().height;
}
开发者ID:halx99,项目名称:batchtool,代码行数:15,代码来源:image.cpp


注:本文中的image::pixels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。