本文整理汇总了C++中FlexImage::getPixelAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ FlexImage::getPixelAddress方法的具体用法?C++ FlexImage::getPixelAddress怎么用?C++ FlexImage::getPixelAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexImage
的用法示例。
在下文中一共展示了FlexImage::getPixelAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decompress
bool decompress(const Bytes& cimg, FlexImage& img) {
bool debug = false;
if (!active) {
init();
active = true;
}
cinfo.client_data = &error_buffer;
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = net_error_exit;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_finish_decompress(&cinfo);
return false;
}
jpeg_net_src(&cinfo,(char*)cimg.get(),cimg.length());
jpeg_save_markers(&cinfo, JPEG_COM, 0xFFFF);
jpeg_read_header(&cinfo, TRUE);
jpeg_calc_output_dimensions(&cinfo);
if(cinfo.jpeg_color_space == JCS_GRAYSCALE) {
img.setPixelCode(VOCAB_PIXEL_MONO);
}
else
{
img.setPixelCode(VOCAB_PIXEL_RGB);
}
if (debug) printf("Got image %dx%d\n", cinfo.output_width, cinfo.output_height);
img.resize(cinfo.output_width,cinfo.output_height);
jpeg_start_decompress(&cinfo);
//int row_stride = cinfo.output_width * cinfo.output_components;
int at = 0;
while (cinfo.output_scanline < cinfo.output_height) {
JSAMPLE *lines[1];
lines[0] = (JSAMPLE*)(img.getPixelAddress(0,at));
jpeg_read_scanlines(&cinfo, lines, 1);
at++;
}
if(readEnvelopeCallback && cinfo.marker_list && cinfo.marker_list->data_length > 0) {
Bytes envelope(reinterpret_cast<char*>(cinfo.marker_list->data), cinfo.marker_list->data_length);
readEnvelopeCallback(readEnvelopeCallbackData, envelope);
}
if (debug) printf("Read image!\n");
jpeg_finish_decompress(&cinfo);
return true;
}