本文整理汇总了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
}
示例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);
}
示例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;
}