本文整理汇总了C++中FlexImage::getRowSize方法的典型用法代码示例。如果您正苦于以下问题:C++ FlexImage::getRowSize方法的具体用法?C++ FlexImage::getRowSize怎么用?C++ FlexImage::getRowSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexImage
的用法示例。
在下文中一共展示了FlexImage::getRowSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
bool MjpegCarrier::write(ConnectionState& proto, SizedWriter& writer) {
WireImage rep;
FlexImage *img = rep.checkForImage(writer);
if (img==NULL) return false;
int w = img->width();
int h = img->height();
int row_stride = img->getRowSize();
JOCTET *data = (JOCTET*)img->getRawImage();
JSAMPROW row_pointer[1];
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
cinfo.client_data = &proto;
jpeg_create_compress(&cinfo);
jpeg_net_dest(&cinfo);
cinfo.image_width = w;
cinfo.image_height = h;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
//jpeg_set_quality(&cinfo, 85, TRUE);
dbg_printf("Starting to compress...\n");
jpeg_start_compress(&cinfo, TRUE);
if(!envelope.empty()) {
jpeg_write_marker(&cinfo, JPEG_COM, reinterpret_cast<const JOCTET*>(envelope.c_str()), envelope.length() + 1);
envelope.clear();
}
dbg_printf("Done compressing (height %d)\n", cinfo.image_height);
while (cinfo.next_scanline < cinfo.image_height) {
dbg_printf("Writing row %d...\n", cinfo.next_scanline);
row_pointer[0] = data + cinfo.next_scanline * row_stride;
jpeg_write_scanlines(&cinfo, row_pointer, 1);
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
return true;
}