本文整理汇总了C++中CImg::InitArray8方法的典型用法代码示例。如果您正苦于以下问题:C++ CImg::InitArray8方法的具体用法?C++ CImg::InitArray8怎么用?C++ CImg::InitArray8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImg
的用法示例。
在下文中一共展示了CImg::InitArray8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __Func_DrawLine
//根据得到的波峰点位绘制网格(仅供调试输出中间结果)
bool __Func_DrawLine(unsigned char** img, unsigned int topmost, unsigned int downmost, const long width, const long height, const unsigned char color) {
if (img == NULL || downmost <= topmost || downmost - topmost < 2)
return false;
unsigned char** preview = new unsigned char*[height];
for (unsigned long i = 0; i < height; ++i) {
preview[i] = new unsigned char[width];
}
for (unsigned long i = 0; i < height; ++i) {
memcpy(preview[i], img[i], width * sizeof(unsigned char));
}
for (long i = 0; i < width; ++i) {
preview[topmost][i] = (unsigned char)color;
preview[downmost][i] = (unsigned char)color;
}
CImg * pPreviewImg = create_image();
pPreviewImg->InitArray8(preview, height, width);
string filepath = NowTimeToFileName("..//results//bqt//DrawLineToArea", ".bmp");
pPreviewImg->SaveToFile(filepath.c_str());
for (unsigned long i = 0; i < height; ++i) {
delete[] preview[i];
}
delete[] preview;
preview = NULL;
return true;
}