views:

347

answers:

1

I'm trying to place a red tint on all the screens of my iPhone application. I've experimented on a bitmap and found I get the effect I want by compositing a dark red color onto the screen image using Multiply (kCGBlendModeMultiply).

So the question is how to efficiently do this in real time on the iPhone?

One dumb way might be to grab a bitmap of the current screen, composite into the bitmap and then write the composited bitmap back to the screen. This seems like it would almost certainly be too slow. In addition, I need some way of knowing when part of the screen has been redrawn so I can update the tinting.

I can almost get the effect I want by putting a red, translucent, fullscreen UIView above everything. That tints everything red within further intervention on my part, but the effect is much "muddier" than results from the composite.

So do any wizards out there know of some mechanism I can use to automatically composite the red over the app in similar fashion to what the translucent red UIView does?

A: 

You could try this: subclass UIView. Add code to -drawRect method to draw the overlay. Make your UIView subclass pose as UIView everywhere in your app with

class_poseAs ([CustomUIView class], [UIView class]);
luvieere
Pose as class is deprecated.
PeyloW
Yes, I was looking into poseAs, but as PeyloW says, Apple doesn't seem to want you to use it anymore. Even if it weren't I think it was not recommended to call the original routine you were overriding.
btschumy