Skip to content

Instantly share code, notes, and snippets.

@hirokim
hirokim / BarGraphView.m
Created February 25, 2015 01:38
iOSで棒グラフ描画
#import "BarGraphView.h"
#define kOffsetX 10
#define kStepX 30
#define kGraphTop 0
#define kStepY 50
#define kOffsetY 10
#define kBarTop 10
#define kBarWidth 10
@hirokim
hirokim / PieChartView.m
Created February 25, 2015 01:36
iOSで円グラフ描画
/**
* 円グラフ描画
*
*/
- (void)drawGradCircle:(CGRect)dirtyRect context:(CGContextRef)context {
[[UIColor whiteColor] set];
// 画面サイズの小さい方の長さ
float dim = MIN(self.bounds.size.width, self.bounds.size.height);
@hirokim
hirokim / AVCaptureDeviceFormat of iPhone6
Created December 24, 2014 09:53
AVCaptureDeviceFormat of iPhone6
<AVCaptureDeviceFormat: 0x17001de90 'vide'/'420v' 192x 144, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @17.00), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x17001dea0 'vide'/'420f' 192x 144, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @17.00), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x17001deb0 'vide'/'420v' 352x 288, { 2- 30 fps}, HRSI:2992x2448, fov:53.203, max zoom:153.00 (upscales @8.50), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x17001dec0 'vide'/'420f' 352x 288, { 2- 30 fps}, HRSI:2992x2448, fov:53.203, max zoom:153.00 (upscales @8.50), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x17001ded0 'vide'/'420v' 480x 360, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @6.80), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x17001dee0 'vide'/'420f' 480x 360, { 2- 30 fps}, HR
@hirokim
hirokim / AVCaptureDeviceFormat of iPhone6Plus
Created December 24, 2014 09:39
AVCaptureDeviceFormat of iPhone6Plus
<AVCaptureDeviceFormat: 0x174005b30 'vide'/'420v' 192x 144, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @17.00), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x174005b40 'vide'/'420f' 192x 144, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @17.00), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x174005b50 'vide'/'420v' 352x 288, { 2- 30 fps}, HRSI:2992x2448, fov:53.203, max zoom:153.00 (upscales @8.50), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x174005b60 'vide'/'420f' 352x 288, { 2- 30 fps}, HRSI:2992x2448, fov:53.203, max zoom:153.00 (upscales @8.50), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x174005b70 'vide'/'420v' 480x 360, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @6.80), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000>
<AVCaptureDeviceFormat: 0x174005b80 'vide'/'420f' 480x 360, { 2- 30 fps}, HR
@hirokim
hirokim / AVCaptureDeviceFormat of iPhone5
Created December 24, 2014 07:04
AVCaptureDeviceFormat of iPhone5
<AVCaptureDeviceFormat: 0x14ea86b0 'vide'/'420v' 192x 144, { 1- 30 fps}, fov:56.700, binned, max zoom:76.50 (upscales @8.50), AF System:1, ISO:46.0-736.0, SS:0.000018-1.000000>
<AVCaptureDeviceFormat: 0x14ea8490 'vide'/'420f' 192x 144, { 1- 30 fps}, fov:56.700, binned, max zoom:76.50 (upscales @8.50), AF System:1, ISO:46.0-736.0, SS:0.000018-1.000000>
<AVCaptureDeviceFormat: 0x14ea7d20 'vide'/'420v' 352x 288, { 1- 30 fps}, fov:51.975, binned, max zoom:76.50 (upscales @4.25), AF System:1, ISO:46.0-736.0, SS:0.000018-1.000000>
<AVCaptureDeviceFormat: 0x14ea7d30 'vide'/'420f' 352x 288, { 1- 30 fps}, fov:51.975, binned, max zoom:76.50 (upscales @4.25), AF System:1, ISO:46.0-736.0, SS:0.000018-1.000000>
<AVCaptureDeviceFormat: 0x14ea73a0 'vide'/'420v' 480x 360, { 1- 30 fps}, fov:56.700, binned, max zoom:76.50 (upscales @3.40), AF System:1, ISO:46.0-736.0, SS:0.000018-1.000000>
<AVCaptureDeviceFormat: 0x14ea73b0 'vide'/'420f' 480x 360, { 1- 30 fps}, fov:56.700, binned, max zoom:76.50 (upscales @3.40), AF Syst
@hirokim
hirokim / AVCaptureDeviceFormat of iPhone5S
Last active October 5, 2015 13:34
AVCaptureDeviceFormat of iPhone5S
<AVCaptureDeviceFormat: 0x17000c1d0 'vide'/'420v' 192x 144, { 2- 60 fps}, fov:58.080, binned, max zoom:76.50 (upscales @8.50), AF System:1, ISO:34.0-544.0, SS:0.000011-0.500000>
<AVCaptureDeviceFormat: 0x17000c1c0 'vide'/'420f' 192x 144, { 2- 60 fps}, fov:58.080, binned, max zoom:76.50 (upscales @8.50), AF System:1, ISO:34.0-544.0, SS:0.000011-0.500000>
<AVCaptureDeviceFormat: 0x17000c1b0 'vide'/'420v' 352x 288, { 2- 60 fps}, fov:53.240, binned, max zoom:76.50 (upscales @4.25), AF System:1, ISO:34.0-544.0, SS:0.000011-0.500000>
<AVCaptureDeviceFormat: 0x17000c1a0 'vide'/'420f' 352x 288, { 2- 60 fps}, fov:53.240, binned, max zoom:76.50 (upscales @4.25), AF System:1, ISO:34.0-544.0, SS:0.000011-0.500000>
<AVCaptureDeviceFormat: 0x17000c190 'vide'/'420v' 480x 360, { 2- 60 fps}, fov:58.080, binned, max zoom:76.50 (upscales @3.40), AF System:1, ISO:34.0-544.0, SS:0.000011-0.500000>
<AVCaptureDeviceFormat: 0x17000c180 'vide'/'420f' 480x 360, { 2- 60 fps}, fov:58.080, binned, max zoom:76.50 (upscales @3.
@hirokim
hirokim / TakeBracketCapture.m
Created December 24, 2014 06:31
ブラケット撮影
NSArray *settings = @[
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 100) ISO:100.0],
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 200) ISO:400.0],
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 300) ISO:800.0]
];
[self.stillImageOutput
captureStillImageBracketAsynchronouslyFromConnection:videoConnection
withSettingsArray:settings
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, AVCaptureBracketedStillImageSettings *stillImageSettings, NSError *error) {
@hirokim
hirokim / resizeAspectFitWithSize.m
Created December 18, 2014 08:59
アスペクト比を保ってUIImageをリサイズ
/**
* アスペクト比を保ってUIImageをリサイズ
*
*/
+ (UIImage *)resizeAspectFitWithSize:(UIImage *)srcImg size:(CGSize)size
{
CGFloat widthRatio = size.width / srcImg.size.width;
CGFloat heightRatio = size.height / srcImg.size.height;
CGFloat ratio = (widthRatio < heightRatio) ? widthRatio : heightRatio;
@hirokim
hirokim / compositeImages.m
Created December 18, 2014 08:58
画像を合成する
/**
* 画像を合成する
*
*/
- (UIImage *)compositeImages:(NSArray *)array size:(CGSize)size
{
UIImage *image = nil;
// ビットマップ形式のグラフィックスコンテキストの生成
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
@hirokim
hirokim / splitDataWithData.m
Created December 18, 2014 08:56
NSDataを指定サイズに分割する
/**
* NSDataを指定サイズに分割する
*
*/
+ (NSArray *)splitDataWithData:(NSData *)data splitSize:(int)size
{
NSRange dataRange;
NSInteger dataSize = data.length;
NSInteger dataSplitCount = dataSize/size;