in commands/FBVisualizationCommands.py [0:0]
def _showLayer(layer):
layer = "(" + layer + ")"
size = "((CGRect)[(id)" + layer + " bounds]).size"
width = float(fb.evaluateExpression("(CGFloat)(" + size + ".width)"))
height = float(fb.evaluateExpression("(CGFloat)(" + size + ".height)"))
if width == 0.0 or height == 0.0:
print(
"Nothing to see here - the size of this element is {} x {}.".format(
width, height
)
)
return
fb.evaluateEffect("UIGraphicsBeginImageContextWithOptions(" + size + ", NO, 0.0)")
fb.evaluateEffect(
"[(id)" + layer + " renderInContext:(void *)UIGraphicsGetCurrentContext()]"
)
result = fb.evaluateExpressionValue(
"(UIImage *)UIGraphicsGetImageFromCurrentImageContext()"
)
if result.GetError() is not None and str(result.GetError()) != "success":
print(result.GetError())
else:
image = result.GetValue()
_showImage(image)
fb.evaluateEffect("UIGraphicsEndImageContext()")