本文整理汇总了Python中blf.color方法的典型用法代码示例。如果您正苦于以下问题:Python blf.color方法的具体用法?Python blf.color怎么用?Python blf.color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blf
的用法示例。
在下文中一共展示了blf.color方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _draw
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def _draw(self, context, event):
# first draw to reset buffer
shader2Dcolor.uniform_float("color", (.5, .5, .5, .5))
batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((0,0), (0,0))}).draw(shader2Dcolor)
if self.draw_guide:
shader2Dcolor.uniform_float("color", (.5, .5, .5, .5))
batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((self._start_position[:]), (self._end_position[:]))}).draw(shader2Dcolor)
if self.allow_xy_keys:
if self.x_key:
shader2Dcolor.uniform_float("color", (1, 0, 0, .5))
batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((0, self._start_position.y), (context.area.width, self._start_position.y))}).draw(shader2Dcolor)
elif self.y_key:
shader2Dcolor.uniform_float("color", (0, 1, 0, .5))
batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((self._start_position.x, 0), (self._start_position.x, context.area.height))}).draw(shader2Dcolor)
示例2: draw
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw(self):
area_height = self.get_area_height()
self.shader_chb.bind()
if self.is_checked:
bgl.glLineWidth(3)
self.shader_chb.uniform_float("color", self._cross_color)
self.batch_cross.draw(self.shader_chb)
bgl.glLineWidth(2)
self.shader_chb.uniform_float("color", self._box_color)
self.batch_box.draw(self.shader_chb)
# Draw text
self.draw_text(area_height)
示例3: onscreen_warning
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def onscreen_warning(self, x, y):
gamma = self.gamma_correction
fontid = 1
blf.size(fontid, self.prefs.view_font_size_report, 72)
blf.color(fontid, *gamma((1.0, 0.3, 0.3, 1.0)))
_, font_h = blf.dimensions(fontid, "Row Height")
font_row_height = font_h * 2
y += font_h
for row in self.warn:
y -= font_row_height
blf.position(fontid, x, y, 0.0)
blf.draw(fontid, row)
return y
示例4: draw_text_2d
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_text_2d(self, context):
cur_stretch_settings = context.scene.mi_cur_stretch_settings
rh = context.region.height
rw = context.region.width
font_id = 0
font_size = 30
#Set font color
bgl.glEnable(bgl.GL_BLEND)
#bgl.glColor(1, 0.75, 0.1, 1)
blf.color(0, 1, 0.75, 0.1, 1)
bgl.glLineWidth(2)
#Draw text
blf.position(font_id, rw - 400, 210 - font_size, 0)
blf.size(font_id, font_size, 72)
blf.draw(font_id, str(cur_stretch_settings.points_number))
# restore opengl defaults
bgl.glLineWidth(1)
blf.color(0, 0.0, 0.0, 0.0, 1.0)
bgl.glDisable(bgl.GL_BLEND)
#bgl.glColor(0, 0.0, 0.0, 0.0, 1.0)
示例5: draw_callback_2d
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_callback_2d(self, op, context):
# Draw text for add object mode
header = "- Add Object Mode (Type: " + context.scene.add_object_type + ") -"
text = "Ctrl + Left Click = Add | Esc = Exit"
blf.color(1, 1, 1, 1, 1)
blf.size(0, 20, 72)
blf.size(1, 16, 72)
region = context.region
xt = int(region.width / 2.0)
blf.position(0, xt - blf.dimensions(0, header)[0] / 2, 50 , 0)
blf.draw(0, header)
blf.position(1, xt - blf.dimensions(1, text)[0] / 2, 20 , 0)
blf.draw(1, text)
示例6: draw_rect
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_rect(x, y, width, height, color):
xmax = x + width
ymax = y + height
points = [[x, y], # [x, y]
[x, ymax], # [x, y]
[xmax, ymax], # [x, y]
[xmax, y], # [x, y]
]
indices = ((0, 1, 2), (2, 3, 0))
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": points}, indices=indices)
shader.bind()
shader.uniform_float("color", color)
bgl.glEnable(bgl.GL_BLEND)
batch.draw(shader)
示例7: _draw_tiles
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def _draw_tiles(coords, passcounts, color, view_to_region):
if not coords or TileStats.film_width == 0 or TileStats.film_height == 0:
return
for i in range(len(coords) // 2):
# Pixel coords
x = coords[i * 2]
y = coords[i * 2 + 1]
width = min(TileStats.width, TileStats.film_width - x)
height = min(TileStats.height, TileStats.film_height - y)
# Relative coords in range 0..1
rel_x = x / TileStats.film_width
rel_y = y / TileStats.film_height
rel_width = width / TileStats.film_width
rel_height = height / TileStats.film_height
_draw_rect(rel_x, rel_y, rel_width, rel_height, color, view_to_region)
if passcounts:
_draw_text(str(passcounts[i]), rel_x, rel_y, color, view_to_region)
示例8: get_color_gizmo_primary
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def get_color_gizmo_primary(context):
color = context.preferences.themes[0].user_interface.gizmo_primary
return _color_to_list(color)
示例9: get_color_gizmo_secondary
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def get_color_gizmo_secondary(context):
color = context.preferences.themes[0].user_interface.gizmo_secondary
return _color_to_list(color)
示例10: get_color_axis_x
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def get_color_axis_x(context):
color = context.preferences.themes[0].user_interface.axis_x
return _color_to_list(color)
示例11: get_color_axis_y
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def get_color_axis_y(context):
color = context.preferences.themes[0].user_interface.axis_y
return _color_to_list(color)
示例12: get_color_axis_z
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def get_color_axis_z(context):
color = context.preferences.themes[0].user_interface.axis_z
return _color_to_list(color)
示例13: draw_rectangle
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_rectangle(shader, origin, size, color=(1.0, 1.0, 1.0, 1.0)):
vertices = (
(origin.x, origin.y),
(origin.x + size.x, origin.y),
(origin.x, origin.y + size.y),
(origin.x + size.x, origin.y + size.y),
)
indices = ((0, 1, 2), (2, 1, 3))
batch = batch_for_shader(shader, "TRIS", {"pos": vertices}, indices=indices)
shader.bind()
shader.uniform_float("color", color)
batch.draw(shader)
示例14: draw_triangle
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_triangle(shader, point_1, point_2, point_3, color=(1.0, 1.0, 1.0, 1.0)):
vertices = (point_1, point_2, point_3)
indices = ((0, 1, 2),)
batch = batch_for_shader(shader, "TRIS", {"pos": vertices}, indices=indices)
shader.bind()
shader.uniform_float("color", color)
batch.draw(shader)
示例15: draw_triangle_equilateral
# 需要导入模块: import blf [as 别名]
# 或者: from blf import color [as 别名]
def draw_triangle_equilateral(shader, center, radius, rotation=0.0, color=(1.0, 1.0, 1.0, 1.0)):
points = []
for i in range(3):
angle = i * math.pi * 2 / 3 + rotation
offset = Vector((radius * math.cos(angle), radius * math.sin(angle)))
points.append(center + offset)
draw_triangle(shader, *points, color)