Skip to content

Instantly share code, notes, and snippets.

@claus
Created September 14, 2009 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claus/186722 to your computer and use it in GitHub Desktop.
Save claus/186722 to your computer and use it in GitHub Desktop.
//
// Shape1View.m
// Shape1View
//
// Created by Claus Wahlers on Mon Sep 14 2009.
// Copyright 2009 côdeazur brasil. All rights reserved.
//
#import "Shape1View.h"
@implementation Shape1View
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGContextRef ctx = UIGraphicsGetCurrentContext();
[self drawFill0:ctx];
[self drawFill1:ctx];
[self drawFill2:ctx];
[self drawFill3:ctx];
}
- (void)drawFill0:(CGContextRef)ctx {
CGContextSaveGState(ctx);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, 132.2f, 38.19999999999999f);
CGContextAddQuadCurveToPoint(ctx, 146.14999999999998f, 44.94999999999999f, 156.04999999999998f, 56.94999999999999f);
CGContextAddQuadCurveToPoint(ctx, 146.45f, 69.99999999999999f, 143.14999999999998f, 85.59999999999998f);
CGContextAddQuadCurveToPoint(ctx, 138.2f, 72.99999999999999f, 127.1f, 65.19999999999999f);
CGContextAddQuadCurveToPoint(ctx, 115.55f, 57.249999999999986f, 101.6f, 57.249999999999986f);
CGContextAddQuadCurveToPoint(ctx, 83.14999999999999f, 57.249999999999986f, 70.1f, 70.29999999999998f);
CGContextAddQuadCurveToPoint(ctx, 57.05f, 83.34999999999998f, 57.05f, 101.79999999999998f);
CGContextAddQuadCurveToPoint(ctx, 57.05f, 120.24999999999999f, 70.1f, 133.29999999999998f);
CGContextAddQuadCurveToPoint(ctx, 83.14999999999999f, 146.35f, 101.6f, 146.35f);
CGContextAddQuadCurveToPoint(ctx, 115.55f, 146.35f, 127.1f, 138.4f);
CGContextAddQuadCurveToPoint(ctx, 138.2f, 130.6f, 143.14999999999998f, 118.0f);
CGContextAddQuadCurveToPoint(ctx, 146.45f, 133.6f, 156.04999999999998f, 146.65f);
CGContextAddQuadCurveToPoint(ctx, 146.14999999999998f, 158.65f, 132.2f, 165.4f);
CGContextAddQuadCurveToPoint(ctx, 117.79999999999998f, 172.3f, 101.59999999999998f, 172.3f);
CGContextAddQuadCurveToPoint(ctx, 72.34999999999998f, 172.3f, 51.79999999999998f, 151.75f);
CGContextAddQuadCurveToPoint(ctx, 31.099999999999984f, 131.05f, 31.099999999999984f, 101.8f);
CGContextAddQuadCurveToPoint(ctx, 31.099999999999984f, 72.55f, 51.79999999999998f, 52.0f);
CGContextAddQuadCurveToPoint(ctx, 72.34999999999998f, 31.300000000000004f, 101.59999999999998f, 31.300000000000004f);
CGContextAddQuadCurveToPoint(ctx, 117.79999999999998f, 31.300000000000004f, 132.2f, 38.2f);
CGContextClosePath(ctx);
CGFloat c[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
CGContextSetFillColor(ctx, c);
CGContextFillPath(ctx);
CGContextRestoreGState(ctx);
}
- (void)drawFill1:(CGContextRef)ctx {
CGContextSaveGState(ctx);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, 128.75f, 74.65000000000002f);
CGContextAddQuadCurveToPoint(ctx, 140.0f, 85.90000000000002f, 140.0f, 101.80000000000003f);
CGContextAddQuadCurveToPoint(ctx, 140.0f, 117.85000000000002f, 128.75f, 128.95000000000002f);
CGContextAddQuadCurveToPoint(ctx, 117.65f, 140.20000000000002f, 101.60000000000001f, 140.20000000000002f);
CGContextAddQuadCurveToPoint(ctx, 85.55000000000001f, 140.20000000000002f, 74.30000000000001f, 128.95000000000002f);
CGContextAddQuadCurveToPoint(ctx, 63.05000000000001f, 117.70000000000002f, 63.05000000000001f, 101.80000000000001f);
CGContextAddQuadCurveToPoint(ctx, 63.05000000000001f, 85.9f, 74.30000000000001f, 74.65f);
CGContextAddQuadCurveToPoint(ctx, 85.55000000000001f, 63.400000000000006f, 101.60000000000001f, 63.400000000000006f);
CGContextAddQuadCurveToPoint(ctx, 117.65f, 63.400000000000006f, 128.75f, 74.65f);
CGContextMoveToPoint(ctx, 118.7f, 84.7f);
CGContextAddQuadCurveToPoint(ctx, 111.65f, 77.5f, 101.60000000000001f, 77.5f);
CGContextAddQuadCurveToPoint(ctx, 91.55000000000001f, 77.5f, 84.50000000000001f, 84.7f);
CGContextAddQuadCurveToPoint(ctx, 77.30000000000001f, 91.75f, 77.30000000000001f, 101.8f);
CGContextAddQuadCurveToPoint(ctx, 77.30000000000001f, 111.85f, 84.50000000000001f, 118.89999999999999f);
CGContextAddQuadCurveToPoint(ctx, 91.55000000000001f, 126.1f, 101.60000000000001f, 126.1f);
CGContextAddQuadCurveToPoint(ctx, 111.65f, 126.1f, 118.7f, 118.89999999999999f);
CGContextAddQuadCurveToPoint(ctx, 125.9f, 111.85f, 125.9f, 101.8f);
CGContextAddQuadCurveToPoint(ctx, 125.9f, 91.75f, 118.7f, 84.7f);
CGContextClosePath(ctx);
CGFloat c[4] = { 0.5254901960784314f, 0.7254901960784313f, 0.8823529411764706f, 1.0f };
CGContextSetFillColor(ctx, c);
CGContextFillPath(ctx);
CGContextRestoreGState(ctx);
}
- (void)drawFill2:(CGContextRef)ctx {
CGContextSaveGState(ctx);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, 288.80000000000007f, 101.49999999999997f);
CGContextAddLineToPoint(ctx, 288.80000000000007f, 172.59999999999997f);
CGContextAddLineToPoint(ctx, 262.55000000000007f, 172.59999999999997f);
CGContextAddLineToPoint(ctx, 262.70000000000005f, 101.64999999999998f);
CGContextAddQuadCurveToPoint(ctx, 262.55000000000007f, 83.19999999999997f, 249.50000000000006f, 70.14999999999998f);
CGContextAddQuadCurveToPoint(ctx, 236.45000000000005f, 57.09999999999998f, 218.00000000000006f, 57.09999999999998f);
CGContextAddQuadCurveToPoint(ctx, 199.55000000000007f, 57.09999999999998f, 186.50000000000006f, 70.29999999999998f);
CGContextAddQuadCurveToPoint(ctx, 173.30000000000007f, 83.34999999999998f, 173.30000000000007f, 101.79999999999998f);
CGContextAddQuadCurveToPoint(ctx, 173.30000000000007f, 120.24999999999999f, 186.35000000000008f, 133.29999999999998f);
CGContextAddQuadCurveToPoint(ctx, 199.4000000000001f, 146.35f, 217.85000000000008f, 146.5f);
CGContextAddLineToPoint(ctx, 256.8500000000001f, 146.5f);
CGContextAddLineToPoint(ctx, 256.8500000000001f, 172.6f);
CGContextAddLineToPoint(ctx, 217.70000000000007f, 172.6f);
CGContextAddQuadCurveToPoint(ctx, 188.45000000000007f, 172.45f, 167.90000000000006f, 151.75f);
CGContextAddQuadCurveToPoint(ctx, 147.20000000000007f, 131.05f, 147.20000000000007f, 101.80000000000001f);
CGContextAddQuadCurveToPoint(ctx, 147.20000000000007f, 72.4f, 167.90000000000006f, 51.7f);
CGContextAddQuadCurveToPoint(ctx, 188.60000000000005f, 31.000000000000004f, 218.00000000000006f, 31.000000000000004f);
CGContextAddQuadCurveToPoint(ctx, 247.25000000000006f, 31.000000000000004f, 267.95000000000005f, 51.7f);
CGContextAddQuadCurveToPoint(ctx, 288.65000000000003f, 72.4f, 288.8f, 101.5f);
CGContextClosePath(ctx);
CGFloat c[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
CGContextSetFillColor(ctx, c);
CGContextFillPath(ctx);
CGContextRestoreGState(ctx);
}
- (void)drawFill3:(CGContextRef)ctx {
CGContextSaveGState(ctx);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, 242.6f, 101.95f);
CGContextAddLineToPoint(ctx, 242.6f, 101.65f);
CGContextAddQuadCurveToPoint(ctx, 242.45f, 91.45f, 235.25f, 84.4f);
CGContextAddQuadCurveToPoint(ctx, 228.05f, 77.2f, 218.0f, 77.2f);
CGContextAddQuadCurveToPoint(ctx, 207.95f, 77.2f, 200.6f, 84.4f);
CGContextAddQuadCurveToPoint(ctx, 193.4f, 91.75f, 193.4f, 101.8f);
CGContextAddQuadCurveToPoint(ctx, 193.4f, 111.85f, 200.6f, 119.05f);
CGContextAddQuadCurveToPoint(ctx, 207.65f, 126.25f, 217.85f, 126.4f);
CGContextAddLineToPoint(ctx, 242.45f, 126.4f);
CGContextAddLineToPoint(ctx, 242.45f, 102.55f);
CGContextAddLineToPoint(ctx, 242.6f, 101.95f);
CGContextMoveToPoint(ctx, 218.0f, 62.95f);
CGContextAddQuadCurveToPoint(ctx, 234.05f, 62.95f, 245.45000000000002f, 74.2f);
CGContextAddQuadCurveToPoint(ctx, 256.85f, 85.60000000000001f, 256.85f, 101.65f);
CGContextAddLineToPoint(ctx, 256.85f, 140.65f);
CGContextAddLineToPoint(ctx, 217.85f, 140.65f);
CGContextAddQuadCurveToPoint(ctx, 201.79999999999998f, 140.65f, 190.39999999999998f, 129.25f);
CGContextAddQuadCurveToPoint(ctx, 179.14999999999998f, 117.85000000000001f, 179.14999999999998f, 101.80000000000001f);
CGContextAddQuadCurveToPoint(ctx, 179.14999999999998f, 85.75000000000001f, 190.54999999999998f, 74.35000000000001f);
CGContextAddQuadCurveToPoint(ctx, 201.95f, 62.95f, 218.0f, 62.95f);
CGContextClosePath(ctx);
CGFloat c[4] = { 0.5254901960784314f, 0.7254901960784313f, 0.8823529411764706f, 1.0f };
CGContextSetFillColor(ctx, c);
CGContextFillPath(ctx);
CGContextRestoreGState(ctx);
}
- (void)dealloc {
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment