本文整理匯總了Python中FlagPainter.FlagPainter.background方法的典型用法代碼示例。如果您正苦於以下問題:Python FlagPainter.background方法的具體用法?Python FlagPainter.background怎麽用?Python FlagPainter.background使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FlagPainter.FlagPainter
的用法示例。
在下文中一共展示了FlagPainter.background方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paint_rounded_bar
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
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
示例2: paint_flag_united_kingdom
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_united_kingdom():
"""http://www.vexilla-mundi.com/united_kingdom_flag.html"""
f = FlagPainter(1 / 2)
colors = [(0, 36, 125), (207, 20, 43), (255, 255, 255)]
# Background color
f.background(colors[0])
# White diagonal stripes
X = (1 / math.cos(math.pi / 3)) / 60
Y = (1 / math.cos(math.pi / 6)) / 30
points = [(0, 0), (0, 3 * Y), (1 - 3 * X, 1), (1, 1), (1, 1 - 3 * Y), (3 * X, 0)]
f.draw_polygon(points, colors[2])
points = [(1, 0), (1 - 3 * X, 0), (0, 1 - 3 * Y), (0, 1), (3 * X, 1), (1, 3 * Y)]
f.draw_polygon(points, colors[2])
# Red diagonal stripes
points = [(0, 0), (0, 2 * Y), ((20 / 60) - 2 * X, 10 / 30), (20 / 60, 10 / 30)]
f.draw_polygon(points, colors[1])
points = [(1, 0), (1 - 2 * X, 0), (1 - (20 / 60) - 2 * X, 10 / 30), (1 - (20 / 60), 10 / 30)]
f.draw_polygon(points, colors[1])
points = [(1, 1), (1, 1 - 2 * Y), (1 - (20 / 60) + 2 * X, 1 - (10 / 30)),
(1 - (20 / 60), 1 - (10 / 30))]
f.draw_polygon(points, colors[1])
points = [(0, 1), (2 * X, 1), (20 / 60 + 2 * X, 1 - (10 / 30)), (20 / 60, 1 - (10 / 30))]
f.draw_polygon(points, colors[1])
# Horizontal and vertical stripes
f.draw_horizontal_band((10 / 30, 20 / 30), colors[2])
f.draw_vertical_band((25 / 60, 35 / 60), colors[2])
f.draw_horizontal_band((12 / 30, 18 / 30), colors[1])
f.draw_vertical_band((27 / 60, 33 / 60), colors[1])
f.save('united_kingdom')
示例3: paint_flag_cyprus
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_cyprus():
"""http://www.vexilla-mundi.com/cyprus_flag.html"""
f = FlagPainter(2 / 3)
white = (255, 255, 255)
f.background(white)
f.place_drawing('cyprus_detail.png', center=(9.5 / 18, 5.75 / 12), size=(10 / 18, 8.5 / 12))
f.save('cyprus')
示例4: paint_flag_montenegro
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
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')
示例5: paint_flag_sweden
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
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')
示例6: paint_flag_switzerland_fashioncheque
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_switzerland_fashioncheque():
"""http://vexilla-mundi.com/switserland_flag.html"""
f = FlagPainter(2 / 3)
colors = [(197, 5, 50), (255, 255, 255)]
f.background(colors[0])
f.place_drawing('switzerland', center=(1 / 2, 1 / 2), size=(None, 1))
f.save('switzerland_fashioncheque')
示例7: paint_flag_headspace
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_headspace():
f = FlagPainter(1 / 1)
colors = [(255, 255, 255), (255, 140, 0)]
f.background(colors[0])
f.draw_circle((1 / 2, 1 / 2), 1 / 3, colors[1])
f.save('headspace')
示例8: paint_flag_finland
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
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')
示例9: paint_flag_denmark
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
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')
示例10: paint_flag_iceland
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_iceland():
"""http://www.crwflags.com/fotw/flags/is.html"""
f = FlagPainter(18 / 25)
colors = [(0, 0, 204), (255, 255, 255), (255, 0, 0)]
f.background(colors[0])
f.draw_horizontal_band((7 / 18, 11 / 18), colors[1])
f.draw_vertical_band((7 / 25, 11 / 25), colors[1])
f.draw_horizontal_band((8 / 18, 10 / 18), colors[2])
f.draw_vertical_band((8 / 25, 10 / 25), colors[2])
f.save('iceland')
示例11: paint_flag_norway
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_norway():
"""http://www.crwflags.com/fotw/flags/no.html"""
f = FlagPainter(16 / 22)
colors = [(255, 0, 0), (255, 255, 255), (0, 51, 102)]
f.background(colors[0])
f.draw_horizontal_band((6 / 16, 10 / 16), colors[1])
f.draw_vertical_band((6 / 22, 10 / 22), colors[1])
f.draw_horizontal_band((7 / 16, 9 / 16), colors[2])
f.draw_vertical_band((7 / 22, 9 / 22), colors[2])
f.save('norway')
示例12: paint_flag_kosovo
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_kosovo():
"""http://www.vexilla-mundi.com/kosovo_flag.html"""
f = FlagPainter(2 / 3)
colors = [(0, 19, 131), (255, 255, 255)]
f.background(colors[0])
for i_star in range(6):
angle_in_degrees = 180 - 67.5 - i_star * 9
angle = math.radians(angle_in_degrees)
r_arc = 0.8
(x, y) = (225 / 420 + r_arc * math.cos(angle), 1 - r_arc * math.sin(angle))
f.draw_star(center=(x, y), radius_inner=8 / 420, radius_outer=17 / 420, nr_points=5,
starting_alpha=-math.pi / 2, color=colors[1])
f.place_drawing(img_name='kosovo_detail', center=(212 / 420, 163 / 280),
size=(156 / 420, 154 / 280))
f.save('kosovo')
示例13: paint_flag_switzerland
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_switzerland():
"""http://vexilla-mundi.com/switserland_flag.html"""
f = FlagPainter(1 / 1)
colors = [(197, 5, 50), (255, 255, 255)]
f.background(colors[0])
out_lu = 6 / 32
in_lu = 13 / 32
out_rl = 26 / 32
in_rl = 19 / 32
horizontal_box = (out_lu, in_lu, out_rl, in_rl)
vertical_box = (in_lu, out_lu, in_rl, out_rl)
f.draw_rectangle(horizontal_box, colors[1])
f.draw_rectangle(vertical_box, colors[1])
f.save('switzerland')
示例14: paint_flag_milan
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_milan():
f = FlagPainter(2 / 1)
colors = [(0, 255, 204), (255, 0, 0)]
# Background color
f.background(colors[0])
f.draw_star(center=(1 / 2, 1 / 2), radius_inner=1 / 4, radius_outer=1 / 2,
nr_points=5, starting_alpha=-math.pi / 2, color=colors[1])
f.draw_star(center=(1 / 2, 1 / 2), radius_inner=1 / 6, radius_outer=1 / 3,
nr_points=5, starting_alpha=-math.pi / 2, color=colors[0])
f.draw_text(text='ML', center=(1 / 2, 1 / 2), color=colors[1], font_size=192)
f.save('milan')
示例15: paint_flag_bosnia_herzegovina
# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import background [as 別名]
def paint_flag_bosnia_herzegovina():
"""http://www.vexilla-mundi.com/bosnia_and_herzegovina_flag.html"""
f = FlagPainter(1 / 2)
background_color = (14, 19, 150)
triangle_color = (251, 207, 0)
star_color = (255, 255, 255)
f.background(background_color)
points = [(106 / 400, 0), (306 / 400, 0), (306 / 400, 1)]
f.draw_polygon(points, triangle_color)
x_start = 60 / 400
x_end = 260 / 400
y_start = -5 / 200
y_end = 195 / 200
nr_stars = 9
for i in range(nr_stars):
X = x_start + (i / (nr_stars - 1)) * (x_end - x_start)
Y = y_start + (i / (nr_stars - 1)) * (y_end - y_start)
f.draw_star(center=(X, Y), radius_inner=7 / 400, radius_outer=19 / 400,
nr_points=5, starting_alpha=-math.pi / 2, color=star_color)
f.save('bosnia_herzegovina')