CABackdropLayer is a subclass of CALayer that clones the content behind it as its own contents. It's useful for applying effects that only apply to some part of the screen, which might be made up of any number of layers behind it.
Gathering Statistics With CABackdropLayer
CABackdropLayer supports gathering various statistics about the contents it clones. Several "statistics types" might be supported, although, currently, it seems (from reversing this feature), that only one type is supported: "type1".
This information was gathered by inspecting the -[CABackdropLayer statisticsValues] method. More info is in the screenshot.
Error creating thumbnail: File missing
type1 statistics
type1 statistics gathers:
- time
- color average (separated to red, green and blue values).
- luminance standard deviation
How to enable example (this is pseudo code at best):
// 1) create a window from a subclass that has its layerClass defined as CABackdropLayer.
MyWindow *w = [[MyWindow alloc] initWithFrame:f];
w.hidden = NO;
// 2) Set the type
w.layer.statisticsType = @"type1";
// optional: set the interval, by default it is 0.25 seconds.
w.layer.statisticsInterval = 5;
// finally just call -statisticsValues. An NSDictionary is returned.
[w.layer statisticsValues]
@{"type":"type1","time":46141.687733625,"blueAverage":0.1781699346405229,"greenAverage":0.1045315904139434,"luminanceStandardDeviation":0.1162156672244852,"redAverage":0.06554829339143065}
|