This is a Camera Engine I designed. I think its flawless, but I'll let you decide. I call it the PAN CAM. It is simple code, but very powerful. You can customize it to fit the needs of your game/application with alterable values.
This download illustrates one way how it can be used.