当前位置: 首页>>代码示例>>C++>>正文


C++ RefPtr::set_filter方法代码示例

本文整理汇总了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;
}
开发者ID:ElementW,项目名称:visualboyadvance-m,代码行数:26,代码来源:screenarea-cairo.cpp

示例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);
	}
}
开发者ID:pkgw,项目名称:aoflagger,代码行数:38,代码来源:imagewidget.cpp


注:本文中的cairo::RefPtr::set_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。