本文整理匯總了Python中FlagPainter.FlagPainter類的典型用法代碼示例。如果您正苦於以下問題:Python FlagPainter類的具體用法?Python FlagPainter怎麽用?Python FlagPainter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FlagPainter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paint_flag_netherlands
def paint_flag_netherlands():
"""http://www.vexilla-mundi.com/netherlands_flag.html"""
f = FlagPainter(2 / 3)
colors = [(190, 0, 36), (255, 255, 255), (0, 36, 151)]
ratios = [1, 1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('netherlands')
示例2: paint_flag_poland
def paint_flag_poland():
"""http://www.vexilla-mundi.com/poland_flag.html"""
f = FlagPainter(5 / 8)
colors = [(255, 255, 255), (198, 8, 32)]
ratios = [1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('poland')
示例3: paint_flag_monaco
def paint_flag_monaco():
"""http://www.vexilla-mundi.com/monaco_flag.html"""
f = FlagPainter(4 / 5)
colors = [(190, 0, 36), (255, 255, 255)]
ratios = [1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('monaco')
示例4: paint_flag_ukraine
def paint_flag_ukraine():
"""http://www.vexilla-mundi.com/ukraine_flag.html"""
f = FlagPainter(2 / 3)
colors = [(6, 68, 173), (253, 207, 15)]
ratios = [1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('ukraine')
示例5: paint_flag_russia
def paint_flag_russia():
"""http://www.vexilla-mundi.com/russia_flag.html"""
f = FlagPainter(2 / 3)
colors = [(255, 255, 255), (4, 49, 157), (209, 17, 24)]
ratios = [1, 1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('russia')
示例6: paint_flag_lithuania
def paint_flag_lithuania():
"""http://www.vexilla-mundi.com/lithuania_flag.html"""
f = FlagPainter(3 / 5)
colors = [(253, 168, 17), (11, 87, 46), (178, 37, 37)]
ratios = [1, 1, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.save('lithuania')
示例7: paint_flag_romania
def paint_flag_romania():
"""http://www.vexilla-mundi.com/romania_flag.html"""
f = FlagPainter(2 / 3)
colors = [(0, 25, 98), (254, 194, 14), (190, 0, 36)]
ratios = [1, 1, 1]
f.stripes(colors, ratios, StripeDirection.vertical)
f.save('romania')
示例8: paint_flag_latvia
def paint_flag_latvia():
"""http://www.vexilla-mundi.com/latvia_flag.html"""
f = FlagPainter(5 / 10)
colors = [(143, 32, 43), (255, 255, 255)]
ratios = [2, 1, 2]
f.stripes(colors=[colors[0], colors[1], colors[0]], ratios=ratios,
stripe_direction=StripeDirection.horizontal)
f.save('latvia')
示例9: paint_flag_montenegro
def paint_flag_montenegro():
"""http://www.vexilla-mundi.com/montenegro_flag.html"""
f = FlagPainter(1 / 2)
colors = [(283, 12, 43), (254, 191, 37)]
f.background(colors[1])
f.draw_rectangle(box=(3 / 120, 3 / 60, 1 - 3 / 120, 1 - 3 / 60), color=colors[0])
f.place_drawing('montenegro_detail', (1 / 2, 1 / 2), (None, 40 / 60))
f.save('montenegro')
示例10: paint_flag_sweden
def paint_flag_sweden():
"""http://www.crwflags.com/fotw/flags/se.html"""
f = FlagPainter(10 / 16)
colors = [(0, 102, 153), (255, 204, 0)]
f.background(colors[0])
f.draw_horizontal_band((4 / 10, 6 / 10), colors[1])
f.draw_vertical_band((5 / 16, 7 / 16), colors[1])
f.save('sweden')
示例11: paint_flag_finland
def paint_flag_finland():
"""http://www.crwflags.com/fotw/flags/fi.html"""
f = FlagPainter(11 / 18)
colors = [(255, 255, 255), (0, 51, 153)]
f.background(colors[0])
f.draw_horizontal_band((4 / 11, 7 / 11), colors[1])
f.draw_vertical_band((5 / 18, 8 / 18), colors[1])
f.save('finland')
示例12: paint_flag_denmark
def paint_flag_denmark():
"""http://www.crwflags.com/fotw/flags/dk.html"""
f = FlagPainter(14 / 17)
colors = [(216, 30, 5), (255, 255, 255)]
f.background(colors[0])
f.draw_horizontal_band((6 / 14, 8 / 14), colors[1])
f.draw_vertical_band((6 / 17, 8 / 17), colors[1])
f.save('denmark')
示例13: paint_flag_belarus
def paint_flag_belarus():
f = FlagPainter(1 / 2)
colors = [(213, 39, 34), (46, 174, 103)]
white = (255, 255, 255)
ratios = [2, 1]
f.stripes(colors, ratios, StripeDirection.horizontal)
f.draw_vertical_band((0, 70 / 630), white)
f.place_drawing('belarus_detail.png', center=(35 / 630, 1 / 2), size=(70 / 630, 1))
f.save('belarus')
示例14: paint_flag_andorra
def paint_flag_andorra():
f = FlagPainter(7 / 10)
colors = [(28, 63, 148), (255, 238, 0), (237, 22, 79)]
ratios = [64, 72, 64]
f.stripes(colors, ratios, StripeDirection.vertical)
f.place_drawing('andorra_detail.png', (1 / 2, 1 / 2), (62 / 200, 66 / 140))
f.save('andorra')
示例15: paint_rounded_bar
def paint_rounded_bar():
"""Return an image of a bar that is required for the construction of a Bolnur-Kathskuri cross"""
f = FlagPainter(1)
transparent = (255, 255, 255, 0)
red = (223, 0, 39)
f.background(red)
H = 35
I = 74
K = 56
L = 104
W = 40
# Remove top and bottom part
f.draw_circle(center=(1 / 2, 1 / 2 - (I + H) / W), radius=L / W, color=transparent)
f.draw_circle(center=(1 / 2, 1 / 2 + (I + H) / W), radius=L / W, color=transparent)
# Remove left and right part
f.draw_circle(center=(1 / 2 - I / W, 1 / 2), radius=K / W, color=transparent)
f.draw_circle(center=(1 / 2 + I / W, 1 / 2), radius=K / W, color=transparent)
img = PainterUtils.trim_img(f.img)
filename_out = 'transparent_bar'
PainterUtils.write_flag_drawing(img, filename_out)
return filename_out