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


Python Draw.fill_opacity方法代码示例

本文整理汇总了Python中pgmagick.api.Draw.fill_opacity方法的典型用法代码示例。如果您正苦于以下问题:Python Draw.fill_opacity方法的具体用法?Python Draw.fill_opacity怎么用?Python Draw.fill_opacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pgmagick.api.Draw的用法示例。


在下文中一共展示了Draw.fill_opacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_rectangle

# 需要导入模块: from pgmagick.api import Draw [as 别名]
# 或者: from pgmagick.api.Draw import fill_opacity [as 别名]
    def draw_rectangle(self, x, y, width, height):
        draw = Draw()
        draw.fill_opacity(0.0)
        draw.stroke_color('white')
        draw.stroke_width(1)

        draw.rectangle(x, y, x + width, y + height)
        self.image.draw(draw.drawer)
开发者ID:diogomonica,项目名称:thumbor,代码行数:10,代码来源:graphicsmagick.py

示例2: DrawTestCase

# 需要导入模块: from pgmagick.api import Draw [as 别名]
# 或者: from pgmagick.api.Draw import fill_opacity [as 别名]
class DrawTestCase(unittest.TestCase):

    def setUp(self):
        self.im = Image((600, 400), 'red')
        self.d = Draw()

    def test_affine(self):
        self.d.affine(10, 10, 20, 20, 40, 40)
        self.im.draw(self.d.drawer)
        self.im.write('t.jpg')

    def test_arc(self):
        self.d.arc(30, 30, 40, 40, 40, 40)
        self.im.draw(self.d.drawer)
        self.im.write('t.jpg')

    def test_bezier(self):
        points = ((30, 30), (50, 75), (200, 100))
        self.d.bezier(points)
        self.im.draw(self.d.drawer)
        self.im.write('t.png')

    def test_circle(self):
        self.d.circle(40, 40, 50, 100)
        self.im.draw(self.d.drawer)
        self.im.write('t.png')

    def test_color(self):
        self.d.color(40, 40, 'point')
        self.im.draw(self.d.drawer)
        self.im.write('t.png')

    def test_composite(self):
        img1 = Image((20, 20), 'plasma:blue')
        self.d.composite(10, 10, 0, 0, img1)
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_draw_for_draw_class(self):
        self.d.color(40, 40, 'point')
        self.d.circle(100, 100, 50, 100)
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_ellipse(self):
        self.d.ellipse(150, 150, 120, 120, 0, 120)
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_fill_color(self):
        self.d.fill_color('#f09060')
        self.d.ellipse(150, 150, 120, 120, 0, 120)
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_fill_rule(self):
        self.d.fill_rule('evenodd')
        self.d.circle(150, 150, 50, 180)
        self.d.fill_rule('nonzero')
        self.d.circle(350, 150, 250, 180)
        self.im.draw(self.d.drawer)
        self.im.write('t.png')

    def test_fill_opacity(self):
        self.im = Image((600, 400), 'transparent')
        self.d.fill_color('red')
        self.d.fill_opacity(0.5)
        self.d.circle(150, 150, 50, 180)
        self.d.fill_color('green')
        self.d.fill_opacity(0.8)
        self.d.circle(160, 160, 50, 180)
        self.im.draw(self.d.drawer)
        self.im.write('t.png')

    def test_font_style_italic(self):
        self.d.font('vera.ttf', 'italic')
        self.d.text(30, 30, "hello pgmagick")
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_font_style_oblique(self):
        self.d.font('vera.ttf', 'oblique')
        self.d.text(30, 30, "hello pgmagick")
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_font_stretch_ultracondensed(self):
        self.d.font('vera.ttf', 'oblique', stretch='ultracondensed')
        self.d.text(30, 30, "hello pgmagick")
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_font_stretch_extraexpanded(self):
        self.d.font('vera.ttf', 'oblique', stretch='extraexpanded')
        self.d.text(30, 30, "hello pgmagick")
        self.im.draw(self.d)
        self.im.write('t.png')

    def test_font_weight100(self):
        self.d.font('vera.ttf', weight=100)
#.........这里部分代码省略.........
开发者ID:suoinguon,项目名称:pgmagick,代码行数:103,代码来源:test_pgmagick_api.py


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