(layer)
| 116 | |
| 117 | |
| 118 | def _showLayer(layer): |
| 119 | layer = "(" + layer + ")" |
| 120 | size = "((CGRect)[(id)" + layer + " bounds]).size" |
| 121 | |
| 122 | width = float(fb.evaluateExpression("(CGFloat)(" + size + ".width)")) |
| 123 | height = float(fb.evaluateExpression("(CGFloat)(" + size + ".height)")) |
| 124 | if width == 0.0 or height == 0.0: |
| 125 | print( |
| 126 | "Nothing to see here - the size of this element is {} x {}.".format( |
| 127 | width, height |
| 128 | ) |
| 129 | ) |
| 130 | return |
| 131 | |
| 132 | fb.evaluateEffect("UIGraphicsBeginImageContextWithOptions(" + size + ", NO, 0.0)") |
| 133 | fb.evaluateEffect( |
| 134 | "[(id)" + layer + " renderInContext:(void *)UIGraphicsGetCurrentContext()]" |
| 135 | ) |
| 136 | |
| 137 | result = fb.evaluateExpressionValue( |
| 138 | "(UIImage *)UIGraphicsGetImageFromCurrentImageContext()" |
| 139 | ) |
| 140 | if result.GetError() is not None and str(result.GetError()) != "success": |
| 141 | print(result.GetError()) |
| 142 | else: |
| 143 | image = result.GetValue() |
| 144 | _showImage(image) |
| 145 | |
| 146 | fb.evaluateEffect("UIGraphicsEndImageContext()") |
| 147 | |
| 148 | |
| 149 | def _showPixelBuffer(target): |
no test coverage detected