本文整理汇总了C++中image::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ image::clear方法的具体用法?C++ image::clear怎么用?C++ image::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_draw
virtual BOOL on_draw(HELEMENT he, UINT draw_type, HDC hdc, const
RECT &rc)
{
if ((DRAW_EVENTS)draw_type != where)
return FALSE;
// do default draw
int w = rc.right - rc.left;
int h = rc.bottom - rc.top;
if (!surface)
{
surface = image::create(w, h);
redraw = true;
}
else if (w != surface->width() || h != surface->height())
{
delete surface;
surface = image::create(w, h);
redraw = true;
}
else if (redraw)
surface->clear();
if (redraw)
{
graphics gx(surface);
draw(he, gx, w, h);
redraw = false;
}
surface->blit(hdc, rc.left, rc.top);
return default_draw ? TRUE : FALSE;
}
示例2: decompress
static std::vector<double> decompress(image in){
auto width = in.header.width;
auto height = in.header.height;
assert(is_pow_of_two(width));
assert(is_pow_of_two(height));
auto q = in.header.get_quantization(quantization::type::logarithmic);
std::vector<double> image(width * height, 0.0);
// read in coefficient on coordinates
for(auto it = in.data.begin(); it != in.data.end(); ++it){
auto&& x = *it;
image[x.x + width*x.y] = q.backwards(x.c);
}
in.clear();
// inverse wavelet transform in y-direction
for(unsigned int i = 0; i < width; ++i){
unwavelet(&image[i], height, width);
}
// inverse wavelet transform in x-direction
for(unsigned int i = 0; i < height; ++i){
unwavelet(&image[i*width], width, 1);
}
return image;
}