本文整理汇总了C++中BitmapData::notifyUsers方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapData::notifyUsers方法的具体用法?C++ BitmapData::notifyUsers怎么用?C++ BitmapData::notifyUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapData
的用法示例。
在下文中一共展示了BitmapData::notifyUsers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ASFUNCTIONBODY(BitmapData,dispose)
{
BitmapData* th = obj->as<BitmapData>();
th->width = 0;
th->height = 0;
th->data.clear();
th->data.shrink_to_fit();
th->disposed = true;
th->notifyUsers();
return NULL;
}
示例2: ctxt
ASFUNCTIONBODY(BitmapData,draw)
{
BitmapData* th = obj->as<BitmapData>();
if(th->disposed)
throw Class<ArgumentError>::getInstanceS("Disposed BitmapData");
_NR<ASObject> drawable;
_NR<Matrix> matrix;
_NR<ColorTransform> ctransform;
_NR<ASString> blendMode;
_NR<Rectangle> clipRect;
bool smoothing;
ARG_UNPACK (drawable) (matrix, NullRef) (ctransform, NullRef) (blendMode, NullRef)
(clipRect, NullRef) (smoothing, false);
if(!drawable->getClass() || !drawable->getClass()->isSubClass(InterfaceClass<IBitmapDrawable>::getClass()) )
throw Class<TypeError>::getInstanceS("Error #1034: Wrong type");
if(!ctransform.isNull() || !blendMode.isNull() || !clipRect.isNull() || smoothing)
LOG(LOG_NOT_IMPLEMENTED,"BitmapData.draw does not support many parameters");
if(drawable->is<BitmapData>())
{
BitmapData* data=drawable->as<BitmapData>();
//Compute the initial matrix, if any
MATRIX initialMatrix;
if(!matrix.isNull())
initialMatrix=matrix->getMATRIX();
CairoRenderContext ctxt(th->getData(), th->width, th->height);
//Blit the data while transforming it
ctxt.transformedBlit(initialMatrix, data->getData(),
data->getWidth(), data->getHeight(),
CairoRenderContext::FILTER_NONE);
}
else if(drawable->is<DisplayObject>())
{
DisplayObject* d=drawable->as<DisplayObject>();
//Compute the initial matrix, if any
MATRIX initialMatrix;
if(!matrix.isNull())
initialMatrix=matrix->getMATRIX();
th->drawDisplayObject(d, initialMatrix);
}
else
LOG(LOG_NOT_IMPLEMENTED,"BitmapData.draw does not support " << drawable->toDebugString());
th->notifyUsers();
return NULL;
}
示例3: ctxt
ASFUNCTIONBODY(BitmapData,draw)
{
BitmapData* th = obj->as<BitmapData>();
if(th->disposed)
throw Class<ArgumentError>::getInstanceS("Disposed BitmapData");
_NR<ASObject> drawable;
_NR<Matrix> matrix;
_NR<ColorTransform> ctransform;
_NR<ASString> blendMode;
_NR<Rectangle> clipRect;
bool smoothing;
ARG_UNPACK (drawable) (matrix, NullRef) (ctransform, NullRef) (blendMode, NullRef)
(clipRect, NullRef) (smoothing, false);
if(!drawable->getClass() || !drawable->getClass()->isSubClass(InterfaceClass<IBitmapDrawable>::getClass()) )
throw Class<TypeError>::getInstanceS("Error #1034: Wrong type");
if(!ctransform.isNull() || !blendMode.isNull() || !clipRect.isNull() || smoothing)
LOG(LOG_NOT_IMPLEMENTED,"BitmapData.draw does not support many parameters");
if(drawable->is<BitmapData>())
{
BitmapData* data=drawable->as<BitmapData>();
//Compute the initial matrix, if any
MATRIX initialMatrix;
if(!matrix.isNull())
initialMatrix=matrix->getMATRIX();
CairoRenderContext ctxt(th->getData(), th->width, th->height);
//Blit the data while transforming it
ctxt.transformedBlit(initialMatrix, data->getData(),
data->getWidth(), data->getHeight(),
CairoRenderContext::FILTER_NONE);
}
else if(drawable->is<DisplayObject>())
{
//Create an InvalidateQueue to store all the hierarchy of objects that must be drawn
SoftwareInvalidateQueue queue;
DisplayObject* d=drawable->as<DisplayObject>();
d->requestInvalidation(&queue);
CairoRenderContext ctxt(th->getData(), th->width, th->height);
//Compute the initial matrix, if any
MATRIX initialMatrix;
if(!matrix.isNull())
initialMatrix=matrix->getMATRIX();
for(auto it=queue.queue.begin();it!=queue.queue.end();it++)
{
DisplayObject* target=(*it).getPtr();
//Get the drawable from each of the added objects
IDrawable* drawable=target->invalidate(d, initialMatrix);
if(drawable==NULL)
continue;
//Compute the matrix for this object
uint8_t* buf=drawable->getPixelBuffer();
//Construct a CachedSurface using the data
CachedSurface& surface=ctxt.allocateCustomSurface(target,buf);
surface.tex.width=drawable->getWidth();
surface.tex.height=drawable->getHeight();
surface.xOffset=drawable->getXOffset();
surface.yOffset=drawable->getYOffset();
delete drawable;
}
d->Render(ctxt, false);
}
else
LOG(LOG_NOT_IMPLEMENTED,"BitmapData.draw does not support " << drawable->toDebugString());
th->notifyUsers();
return NULL;
}