本文整理汇总了C++中PNG::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ PNG::getHeight方法的具体用法?C++ PNG::getHeight怎么用?C++ PNG::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNG
的用法示例。
在下文中一共展示了PNG::getHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rx_load_png
bool rx_load_png(Image& img, std::string filename, bool datapath) {
PNG png;
if(!png.load(filename, datapath)) {
return false;
}
switch(png.getColorType()) {
case PNG_COLOR_TYPE_GRAY: {
img.setPixelFormat(RX_FMT_GRAY8);
break;
}
case PNG_COLOR_TYPE_RGB: {
img.setPixelFormat(RX_FMT_RGB24);
break;
}
case PNG_COLOR_TYPE_RGB_ALPHA: {
img.setPixelFormat(RX_FMT_RGBA32);
break;
}
default: {
RX_ERROR(PNG_ERR_UNSUPPORTED_FORMAT);
return false;
}
}
img.setWidth(png.getWidth());
img.setHeight(png.getHeight());
return img.copyPixels(png.getPixels(), png.getWidth(), png.getHeight(), img.getPixelFormat());
}
示例2: subImageHelper
void
ImageSearch::search(PNG& srchImg) {
const PNGHelper subImageHelper(srchImg);
const int maxRow = mainImage.getHeight() - srchImg.getHeight();
const int maxCol = mainImage.getWidth() - srchImg.getWidth();
const int pixMatchNeeded = srchImg.getBufferSize() * matchPercent / 400;
for(int col = 0; (col <= maxCol); col++) {
for(int row = 0; (row <= maxRow); row++) {
const MatchedRect srchRegion(row, col, srchImg.getWidth(),
srchImg.getHeight());
if (mrl.isMatched(srchRegion)) {
// Current search rgion is already part of a region
// matched earlier in this method (same as thread).
continue;
}
// Search for a match between sub-images.
PNGHelper mainImgHelper(mainImage, row, col);
int pixMatch = getMatchingPixelCount(isMask, mainImgHelper, subImageHelper,
srchImg.getHeight(),
srchImg.getWidth(), tolerance);
if (pixMatch > pixMatchNeeded) {
// Found a matching region.
mrl += srchRegion;
}
}
}
}
示例3: ret
PNG
ImageSearch::rotate90(PNG& png) {
PNG retImg;
retImg.create(png.getHeight(), png.getWidth());
PNGHelper ret(retImg), src(png);
for(int row = 0; (row < png.getHeight()); row++) {
for(int col = 0; (col < png.getWidth()); col++) {
ret(col, png.getHeight() - row - 1) = src(row, col);
}
}
return retImg;
}