本文整理汇总了C++中cairo::RefPtr::set_filter方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::set_filter方法的具体用法?C++ RefPtr::set_filter怎么用?C++ RefPtr::set_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::set_filter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_draw
bool ScreenAreaCairo::on_draw(const Cairo::RefPtr<Cairo::Context>& poContext)
{
DrawingArea::on_draw(poContext);
Cairo::RefPtr<Cairo::ImageSurface> poImage;
Cairo::RefPtr<Cairo::SurfacePattern> poPattern;
Cairo::Matrix oMatrix;
const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32);
//poContext->set_identity_matrix();
poContext->scale(m_dScaleFactor, m_dScaleFactor);
poImage = Cairo::ImageSurface::create((u8*)m_puiPixels, Cairo::FORMAT_RGB24,
m_iScaledWidth, m_iScaledHeight, iScaledPitch);
//cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop);
poPattern = Cairo::SurfacePattern::create(poImage);
poPattern->set_filter(Cairo::FILTER_NEAREST);
//poPattern->set_matrix (oMatrix);
poContext->set_source_rgb(0.0, 0.0, 0.0);
poContext->paint();
poContext->set_source(poPattern);
poContext->paint();
return true;
}
示例2: redrawWithoutChanges
void ImageWidget::redrawWithoutChanges(Cairo::RefPtr<Cairo::Context> cairo, unsigned width, unsigned height)
{
if(_isInitialized) {
cairo->set_source_rgb(1.0, 1.0, 1.0);
cairo->set_line_width(1.0);
cairo->rectangle(0, 0, width, height);
cairo->fill();
int
destWidth = width - (int) floor(_leftBorderSize + _rightBorderSize),
destHeight = height - (int) floor(_topBorderSize + _bottomBorderSize),
sourceWidth = _imageSurface->get_width(),
sourceHeight = _imageSurface->get_height();
cairo->save();
cairo->translate((int) round(_leftBorderSize), (int) round(_topBorderSize));
cairo->scale((double) destWidth / (double) sourceWidth, (double) destHeight / (double) sourceHeight);
Cairo::RefPtr<Cairo::SurfacePattern> pattern = Cairo::SurfacePattern::create(_imageSurface);
pattern->set_filter(_cairoFilter);
cairo->set_source(pattern);
cairo->rectangle(0, 0, sourceWidth, sourceHeight);
cairo->clip();
cairo->paint();
cairo->restore();
cairo->set_source_rgb(0.0, 0.0, 0.0);
cairo->rectangle(round(_leftBorderSize), round(_topBorderSize), destWidth, destHeight);
cairo->stroke();
if(_showColorScale)
_colorScale->Draw(cairo);
if(_showXYAxes)
{
_vertScale->Draw(cairo);
_horiScale->Draw(cairo);
}
if(_plotTitle != 0)
_plotTitle->Draw(cairo);
}
}