缩放表面而不使其模糊
我尝试将从文件派生的图像缩放到任何(合理的)比例。
问题是,开罗不知如何自动模糊它。我该如何修复/删除它?目的是查看各个像素。
感谢您的任何回复。
编辑:一些代码,在 "draw"
事件上触发,父级是 GtkDrawingArea
static gboolean
cb_event_draw (GtkWidget *obj, cairo_t *cr, gpointer data)
{
guint width, height;
width = gtk_widget_get_allocated_width (obj);
height = gtk_widget_get_allocated_height (obj);
_priv = ...; //some struct
// cairo_save (cr);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_scale (cr, _priv->zoom, _priv->zoom);
cairo_set_source_surface (cr, _priv->image, 0., 0.);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_pattern_set_filter (cr, CAIRO_FILTER_FAST); // no matter if this is there or not
// it does actually, matter, works with this:
// cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_FAST);
cairo_paint (cr);
// print some markers at defined locations
return FALSE;
}
I try to scale an image derivedfrom a file, to any (sensible) scale.
The problem is, cairo somhow autoblurrs it. How can I fix/remove it? The aim is to see the individual pixels.
Thanks for any reply.
Edit: Some code, triggering on "draw"
event, parent is a GtkDrawingArea
static gboolean
cb_event_draw (GtkWidget *obj, cairo_t *cr, gpointer data)
{
guint width, height;
width = gtk_widget_get_allocated_width (obj);
height = gtk_widget_get_allocated_height (obj);
_priv = ...; //some struct
// cairo_save (cr);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_scale (cr, _priv->zoom, _priv->zoom);
cairo_set_source_surface (cr, _priv->image, 0., 0.);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_pattern_set_filter (cr, CAIRO_FILTER_FAST); // no matter if this is there or not
// it does actually, matter, works with this:
// cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_FAST);
cairo_paint (cr);
// print some markers at defined locations
return FALSE;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑你需要:
I suspect that you need: