本文整理汇总了Python中cairo.ANTIALIAS_NONE属性的典型用法代码示例。如果您正苦于以下问题:Python cairo.ANTIALIAS_NONE属性的具体用法?Python cairo.ANTIALIAS_NONE怎么用?Python cairo.ANTIALIAS_NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cairo
的用法示例。
在下文中一共展示了cairo.ANTIALIAS_NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paint
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def paint(self):
w, h = self.get_size()
if self.surface is None or self.width != w or self.height != h:
self.surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w, h)
self.width, self.height = w, h
self.ctx = cairo.Context(self.surface)
self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0))
self.ctx.set_source_rgb(*config.ruler_bg)
self.ctx.paint()
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash([])
self.ctx.set_source_rgb(*config.ruler_fg)
if self.horizontal:
self.hrender(w, h)
else:
self.vrender(w, h)
self.draw_bitmap(wal.copy_surface_to_bitmap(self.surface))
示例2: _draw_page
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def _draw_page(self):
self.ctx.set_line_width(1.0 / self.zoom)
offset = 5.0 / self.zoom
w, h = self.printer.get_page_size()
# ---Page shadow
self.ctx.rectangle(-w / 2.0 + offset, -h / 2.0 - offset, w, h)
self.ctx.set_source_rgba(*CAIRO_GRAY)
self.ctx.fill()
# ---Page
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.rectangle(-w / 2.0, -h / 2.0, w, h)
self.ctx.set_source_rgb(*CAIRO_WHITE)
self.ctx.fill()
self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
示例3: _render_page
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def _render_page(self):
self.ctx.save()
w, h = self.printer.get_page_size()
t, r, b, l = self.printer.margins
rect = (-w / 2.0 + l, -h / 2.0 + b, w - l - r, h - t - b)
self.ctx.rectangle(*rect)
self.ctx.clip()
groups = self.pages[self.page_index].childs
for group in groups:
self.renderer.render(self.ctx, group.childs)
self.ctx.restore()
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_source_rgb(*CAIRO_RED)
width = 1.0 / self.zoom
self.ctx.set_line_width(1.0 / self.zoom)
self.ctx.set_dash([3 * width, 3 * width])
self.ctx.rectangle(*rect)
self.ctx.stroke()
self.ctx.set_dash([])
self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
示例4: render_guides
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def render_guides(self):
guide_layer = self.presenter.methods.get_guide_layer()
if not self.presenter.methods.is_layer_visible(guide_layer):
return
guides = [child for child in guide_layer.childs if child.is_guide]
self.ctx.set_matrix(self.direct_matrix)
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash(config.guide_line_dash)
self.ctx.set_source_rgba(*guide_layer.color)
for item in guides:
x_win, y_win = self.canvas.point_doc_to_win(2 * [item.position])
if item.orientation == uc2const.HORIZONTAL:
self.ctx.move_to(0, y_win)
self.ctx.line_to(self.width, y_win)
else:
self.ctx.move_to(x_win, 0)
self.ctx.line_to(x_win, self.height)
self.ctx.stroke()
# ------GRID RENDERING
示例5: reflect_snap
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def reflect_snap(self):
if self.canvas.show_snapping:
snap = self.presenter.snap.active_snap
if not snap[0] is None or not snap[1] is None:
self.ctx.set_matrix(self.direct_matrix)
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash(config.snap_line_dash)
self.ctx.set_source_rgba(*config.snap_line_color)
if not snap[0] is None:
x_win = self.canvas.point_doc_to_win([snap[0], 0])[0]
self.ctx.move_to(x_win, 0)
self.ctx.line_to(x_win, self.height)
self.ctx.stroke()
if not snap[1] is None:
y_win = self.canvas.point_doc_to_win([0, snap[1]])[1]
self.ctx.move_to(0, y_win)
self.ctx.line_to(self.width, y_win)
self.ctx.stroke()
self.presenter.snap.active_snap = [None, None]
示例6: paint_guide_dragging
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def paint_guide_dragging(self, point=None, orient=uc2const.HORIZONTAL):
point = point or []
self.start_soft_repaint()
self.ctx.set_matrix(self.direct_matrix)
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash(config.guide_line_dash)
self.ctx.set_source_rgba(*config.guide_line_dragging_color)
if point:
if orient == uc2const.HORIZONTAL:
y_win = self.canvas.point_doc_to_win(point)[1]
self.ctx.move_to(0, y_win)
self.ctx.line_to(self.width, y_win)
self.ctx.stroke()
else:
x_win = self.canvas.point_doc_to_win(point)[0]
self.ctx.move_to(x_win, 0)
self.ctx.line_to(x_win, self.height)
self.ctx.stroke()
self.reflect_snap()
self.end_soft_repaint()
示例7: _draw_frame
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def _draw_frame(self, path):
self.start_soft_repaint()
self.reflect_snap()
self.ctx.set_matrix(self.direct_matrix)
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash([])
self.ctx.set_source_rgb(*CAIRO_WHITE)
self.ctx.new_path()
self.ctx.append_path(path)
self.ctx.stroke()
self.ctx.set_dash(config.sel_frame_dash)
self.ctx.set_source_rgb(*config.sel_frame_color)
self.ctx.new_path()
self.ctx.append_path(path)
self.ctx.stroke()
self.end_soft_repaint()
示例8: paint
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def paint(self):
if self.presenter is None:
return
w, h = self.dc.get_size()
fmt = cairo.FORMAT_RGB24
if self.surface is None or self.width != w or self.height != h:
self.surface = cairo.ImageSurface(fmt, w, h)
self.width, self.height = w, h
self.ctx = cairo.Context(self.surface)
self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0))
self.ctx.set_source_rgb(*config.ruler_bg)
self.ctx.paint()
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash([])
self.ctx.set_source_rgb(*config.ruler_fg)
if self.vertical:
self.vrender(w, h)
else:
self.hrender(w, h)
self.dc.draw_surface(self.surface, 0, 0)
示例9: draw
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def draw(self, context, rect, *args):
"""
This method is called by the parent Chart instance. It
calls _do_draw.
@type context: cairo.Context
@param context: The context to draw on.
@type rect: gtk.gdk.Rectangle
@param rect: A rectangle representing the charts area.
"""
res = None
if self._show:
if not self._antialias:
context.set_antialias(cairo.ANTIALIAS_NONE)
res = self._do_draw(context, rect, *args)
context.set_antialias(cairo.ANTIALIAS_DEFAULT)
return res
示例10: _draw_page_border
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def _draw_page_border(self):
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
w, h = self.printer.get_page_size()
self.ctx.rectangle(-w / 2.0, -h / 2.0, w, h)
self.ctx.set_source_rgb(*CAIRO_BLACK)
self.ctx.stroke()
self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
示例11: paint
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def paint(self):
w, h = self.get_size()
fmt = cairo.FORMAT_RGB24
self.surface = cairo.ImageSurface(fmt, w, h)
self.ctx = cairo.Context(self.surface)
self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0))
self.ctx.set_source_rgb(*self.prefs.bg_btn.get_value())
self.ctx.paint()
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_line_width(1.0)
self.ctx.set_dash([])
self.ctx.set_source_rgb(*self.prefs.fg_btn.get_value())
self.ctx.move_to(0, h)
self.ctx.line_to(w, h)
self.ctx.stroke()
small_l = self.prefs.ruler_small_tick.get_value()
for item in SMALL_TICKS:
self.ctx.move_to(item, h - small_l)
self.ctx.line_to(item, h - 1)
large_l = self.prefs.ruler_large_tick.get_value()
for pos, txt in TEXT_TICKS:
self.ctx.move_to(pos, h - large_l)
self.ctx.line_to(pos, h - 1)
self.ctx.stroke()
vshift = self.prefs.ruler_text_vshift.get_value()
hshift = self.prefs.ruler_text_hshift.get_value()
for pos, txt in TEXT_TICKS:
for character in txt:
data = self.font[character]
position = int(pos) + hshift
self.ctx.set_source_surface(data[1], position, vshift)
self.ctx.paint()
pos += data[0]
self.draw_surface(self.surface)
示例12: draw_text_cursor
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def draw_text_cursor(self, start, end):
self.set_direct_matrix()
self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
if start[0] == end[0] or start[1] == end[1]:
self.ctx.set_antialias(cairo.ANTIALIAS_NONE)
self.ctx.set_dash([])
self.ctx.set_source_rgb(*config.text_cursor_color)
self.ctx.set_line_width(config.text_cursor_width)
self.ctx.move_to(*start)
self.ctx.line_to(*end)
self.ctx.stroke()
# ------DIRECT DRAWING
示例13: cdc_set_ctx
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def cdc_set_ctx(self, ctx, color=CAIRO_BLACK, dash=None):
dash = dash or []
ctx.set_antialias(cairo.ANTIALIAS_NONE)
ctx.set_line_width(1.0)
ctx.set_dash(dash)
ctx.set_source_rgba(*color)
示例14: draw
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def draw(self, context, rect, yaxis):
"""
This method is called by the parent Plot instance. It
calls _do_draw.
"""
if self._show:
if not self._antialias:
context.set_antialias(cairo.ANTIALIAS_NONE)
self._do_draw(context, rect, yaxis)
context.set_antialias(cairo.ANTIALIAS_DEFAULT)
示例15: render
# 需要导入模块: import cairo [as 别名]
# 或者: from cairo import ANTIALIAS_NONE [as 别名]
def render(self, ctx, objs=None):
objs = objs or []
if self.antialias_flag:
ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
else:
ctx.set_antialias(cairo.ANTIALIAS_NONE)
if objs:
for obj in objs:
self.render_object(ctx, obj)