C methods for cairo