本文整理汇总了Python中AppKit.NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_方法的典型用法代码示例。如果您正苦于以下问题:Python NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_方法的具体用法?Python NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_怎么用?Python NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKit.NSColor
的用法示例。
在下文中一共展示了NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawline
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceCyan_magenta_yellow_black_alpha_ [as 别名]
def drawline(x1, y1, x2, y2, colour, strokewidth, dashed):
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(colour[0], colour[1], colour[2], colour[3], 1).set()
Path = NSBezierPath.bezierPath()
Path.moveToPoint_((x1, y1))
Path.lineToPoint_((x2, y2))
Path.setLineWidth_(strokewidth)
if dashed:
Path.setLineDash_count_phase_(dashed, 2, 0.0)
Path.stroke()
示例2: drawrect
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceCyan_magenta_yellow_black_alpha_ [as 别名]
def drawrect(x1, y1, x2, y2, fillcolour, strokecolour, strokewidth, dashed, rounded):
Rect = NSMakeRect(x1, y1, x2 - x1, y2 - y1)
Path = NSBezierPath.bezierPathWithRoundedRect_xRadius_yRadius_(Rect, rounded, rounded)
if fillcolour:
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(fillcolour[0], fillcolour[1], fillcolour[2], fillcolour[3], 1).set()
Path.fill()
if strokecolour:
Path.setLineWidth_(strokewidth)
if dashed:
Path.setLineDash_count_phase_(dashed, 2, 0.0)
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(strokecolour[0], strokecolour[1], strokecolour[2], strokecolour[3], 1).set()
Path.stroke()
示例3: DrawGlyph
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceCyan_magenta_yellow_black_alpha_ [as 别名]
def DrawGlyph(f, glyph, PSCommands, xoffset, yoffset, ratio, fillcolour, strokecolour, strokewidth, dashed):
if not PSCommands:
layer = glyph.layers[0]
p = layer.drawBezierPath
transform = NSAffineTransform.new()
transform.translateXBy_yBy_(xoffset*mm, yoffset*mm)
transform.scaleBy_(ratio)
p.transformUsingAffineTransform_(transform)
else:
p = NSBezierPath.bezierPath()
for command in PSCommands:
if command[0] == 'moveTo':
try:
p.close()
except:
pass
x = xoffset*mm + command[1][0] * ratio
y = yoffset*mm + command[1][1] * ratio
p.moveToPoint_((x, y))
#print "('moveTo', (%s, %s))," % (command[1][0], command[1][1])
if command[0] == 'lineTo':
x = xoffset*mm + command[1][0] * ratio
y = yoffset*mm + command[1][1] * ratio
p.lineToPoint_((x, y))
#print "('lineTo', (%s, %s))," % (command[1][0], command[1][1])
if command[0] == 'curveTo':
points = []
for point in command[1:]:
points.append( (xoffset*mm + point[0] * ratio, yoffset*mm + point[1] * ratio) )
p.curveToPoint_controlPoint1_controlPoint2_(points[0], points[1], points[2])
p.closePath()
if fillcolour:
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(fillcolour[0], fillcolour[1], fillcolour[2], fillcolour[3], 1).set()
p.fill()
if strokecolour:
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(strokecolour[0], strokecolour[1], strokecolour[2], strokecolour[3], 1).set()
if dashed:
p.setLineDash_count_phase_(dashed, 2, 0.0)
p.setLineWidth_(strokewidth)
p.stroke()
示例4: DrawTableLines
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceCyan_magenta_yellow_black_alpha_ [as 别名]
def DrawTableLines(list, colour, thickness):
global myDialog
for i, point in enumerate(list):
try:
drawline(list[i][1]*mm, list[i][2]*mm, list[i+1][1]*mm, list[i+1][2]*mm, colour, thickness, None)
except:
pass
NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(colour[0], colour[1], colour[2], colour[3], 1).set()
Rect = NSMakeRect(point[1]*mm-(thickness), point[2]*mm-(thickness), thickness*2, thickness*2)
NSBezierPath.bezierPathWithOvalInRect_(Rect).fill()
if Glyphs.boolDefaults["com_yanone_Autopsy_drawpointsvalues"]:
DrawText(pdffont['Regular'], pointsvaluefontsize, glyphcolour, point[1]*mm + (thickness/6+1)*mm, point[2]*mm - (thickness/6+2.5)*mm, str(int(round(point[0]))))
示例5: DrawText
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceCyan_magenta_yellow_black_alpha_ [as 别名]
def DrawText(font, fontsize, fontcolour, x, y, text):
attributes = {NSFontAttributeName : NSFont.fontWithName_size_(font, fontsize), NSForegroundColorAttributeName: NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(fontcolour[0], fontcolour[1], fontcolour[2], fontcolour[3], 1)}
String = NSAttributedString.alloc().initWithString_attributes_(text, attributes)
String.drawAtPoint_((x, y))