Skip to content

Instantly share code, notes, and snippets.

@nolastan
nolastan / rough-circle.cocoascript
Last active October 18, 2015 23:55
Creates a really rough circle out of curves
var color = "#dd0000";
var doc = context.document;
var path = NSBezierPath.bezierPath();
var unit = 20;
path.moveToPoint(NSMakePoint(0,0));
[path curveToPoint:NSMakePoint(2*unit,-2*unit) controlPoint1:NSMakePoint(unit,0) controlPoint2:NSMakePoint(2*unit,-unit)];
[path curveToPoint:NSMakePoint(0,-4*unit) controlPoint1:NSMakePoint(2*unit,-3*unit) controlPoint2:NSMakePoint(unit,-4*unit)];
[path curveToPoint:NSMakePoint(-2*unit,-2*unit) controlPoint1:NSMakePoint(-unit,-4*unit) controlPoint2:NSMakePoint(-2*unit,-3*unit)];
var loadTypography = function (newStyles, sharedStyles) {
var alignmentHash = {
'left': 0,
'right': 1,
'center': 2,
'justified': 3
};
// removeAllStyles();

Great question! This is actually a fascinating quirk of how cameras and image formats work:

The Technical Reason

Camera sensors are physically fixed - they always capture images in the same orientation relative to the camera body. When you rotate your phone, the sensor doesn't physically rotate with it.

So every photo is technically captured in the camera's "native" orientation, and the phone just adds a metadata tag saying "hey, this should be rotated when displayed."

Why Not Just Rotate the Pixels?