(color)
| 78 | |
| 79 | |
| 80 | def _showColor(color): |
| 81 | color = "(" + color + ")" |
| 82 | |
| 83 | colorToUse = color |
| 84 | isCF = _colorIsCGColorRef(color) |
| 85 | if isCF: |
| 86 | colorToUse = "[[UIColor alloc] initWithCGColor:(CGColorRef){}]".format(color) |
| 87 | else: |
| 88 | isCI = objectHelpers.isKindOfClass(color, "CIColor") |
| 89 | if isCI: |
| 90 | colorToUse = "[UIColor colorWithCIColor:(CIColor *){}]".format(color) |
| 91 | |
| 92 | imageSize = 58 |
| 93 | fb.evaluateEffect( |
| 94 | "UIGraphicsBeginImageContextWithOptions((CGSize)CGSizeMake({imageSize}, {imageSize}), NO, 0.0)".format( |
| 95 | imageSize=imageSize |
| 96 | ) |
| 97 | ) |
| 98 | fb.evaluateEffect("[(id){} setFill]".format(colorToUse)) |
| 99 | fb.evaluateEffect( |
| 100 | "UIRectFill((CGRect)CGRectMake(0.0, 0.0, {imageSize}, {imageSize}))".format( |
| 101 | imageSize=imageSize |
| 102 | ) |
| 103 | ) |
| 104 | |
| 105 | result = fb.evaluateExpressionValue( |
| 106 | "(UIImage *)UIGraphicsGetImageFromCurrentImageContext()" |
| 107 | ) |
| 108 | if result.GetError() is not None and str(result.GetError()) != "success": |
| 109 | print("got error {}".format(result)) |
| 110 | print(result.GetError()) |
| 111 | else: |
| 112 | image = result.GetValue() |
| 113 | _showImage(image) |
| 114 | |
| 115 | fb.evaluateEffect("UIGraphicsEndImageContext()") |
| 116 | |
| 117 | |
| 118 | def _showLayer(layer): |
no test coverage detected