本文整理汇总了C++中DynamicJpegStack::Push方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicJpegStack::Push方法的具体用法?C++ DynamicJpegStack::Push怎么用?C++ DynamicJpegStack::Push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicJpegStack
的用法示例。
在下文中一共展示了DynamicJpegStack::Push方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VException
Handle<Value>
DynamicJpegStack::Push(const Arguments &args)
{
HandleScope scope;
if (args.Length() != 5)
return VException("Five arguments required - buffer, x, y, width, height.");
if (!Buffer::HasInstance(args[0]))
return VException("First argument must be Buffer.");
if (!args[1]->IsInt32())
return VException("Second argument must be integer x.");
if (!args[2]->IsInt32())
return VException("Third argument must be integer y.");
if (!args[3]->IsInt32())
return VException("Fourth argument must be integer w.");
if (!args[4]->IsInt32())
return VException("Fifth argument must be integer h.");
DynamicJpegStack *jpeg = ObjectWrap::Unwrap<DynamicJpegStack>(args.This());
if (!jpeg->data)
return VException("No background has been set, use setBackground or setSolidBackground to set.");
Buffer *data_buf = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
int x = args[1]->Int32Value();
int y = args[2]->Int32Value();
int w = args[3]->Int32Value();
int h = args[4]->Int32Value();
if (x < 0)
return VException("Coordinate x smaller than 0.");
if (y < 0)
return VException("Coordinate y smaller than 0.");
if (w < 0)
return VException("Width smaller than 0.");
if (h < 0)
return VException("Height smaller than 0.");
if (x >= jpeg->bg_width)
return VException("Coordinate x exceeds DynamicJpegStack's background dimensions.");
if (y >= jpeg->bg_height)
return VException("Coordinate y exceeds DynamicJpegStack's background dimensions.");
if (x+w > jpeg->bg_width)
return VException("Pushed fragment exceeds DynamicJpegStack's width.");
if (y+h > jpeg->bg_height)
return VException("Pushed fragment exceeds DynamicJpegStack's height.");
jpeg->Push((unsigned char *)BufferData(data_buf), x, y, w, h);
return Undefined();
}