本文整理汇总了C++中CImagePtr::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CImagePtr::getColor方法的具体用法?C++ CImagePtr::getColor怎么用?C++ CImagePtr::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImagePtr
的用法示例。
在下文中一共展示了CImagePtr::getColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: src
//.........这里部分代码省略.........
uint num_bytes_read = 0;
while (size > 0) {
while (size--) {
file->read(&data[num_bytes_read], 1);
++num_bytes_read;
}
file->read(&size, 1);
}
if (num_bytes_read < file_size)
memset(&data[num_bytes_read], 0, file_size - num_bytes_read);
//------
uchar *raw_data = new uchar [num_image_bytes];
decompressData(data, num_bytes_read, raw_data, num_image_bytes);
delete [] data;
if (image_header->interlaced)
deInterlace(raw_data, image_header);
//------
CImageNameSrc src("CImageGIF:" + file->getPath() + "/" + CStrUtil::toString(inum));
CImagePtr image = CImageMgrInst->createImage(src);
image->setType(CFILE_TYPE_IMAGE_GIF);
image->setDataSize(image_header->width, image_header->height);
int bottom = gif_data->header->height - image_header->height - image_header->top;
int right = gif_data->header->width - image_header->width - image_header->left;
image->setBorder(image_header->left, bottom, right, image_header->top);
if (gif_data->num_local_colors > 0) {
for (int i = 0; i < gif_data->num_local_colors; ++i)
image->addColorI(gif_data->local_colors[i].r,
gif_data->local_colors[i].g,
gif_data->local_colors[i].b);
}
else {
for (int i = 0; i < gif_data->num_global_colors; ++i)
image->addColorI(gif_data->global_colors[i].r,
gif_data->global_colors[i].g,
gif_data->global_colors[i].b);
image->setBackground(image->getColor(gif_data->header->background));
}
//------
if (transparent)
image->setTransparentColor(transparent_color);
//------
image->setColorIndexData(raw_data);
delete [] raw_data;
//------
CImageFrame *frame = new CImageFrame(image);
frame->setDelay(delay);
frame->setDispose(dispose);
frame->setUserInput(user_input);
image_anim->add(frame);
//------
delay = 0;
transparent = false;
transparent_color = 0;
dispose = 0;
user_input = 0;
//------
delete image_header;
image_header = 0;
}
catch (...) {
delete image_header;
CImage::errorMsg("Failed to read GIF file");
return false;
}
}
else if (id == CONTROL_ID) {