Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * 画像を合成する
- *
- */
- - (UIImage *)compositeImages:(NSArray *)array size:(CGSize)size
- {
- UIImage *image = nil;
- // ビットマップ形式のグラフィックスコンテキストの生成
- UIGraphicsBeginImageContextWithOptions(size, NO, 0);
- // 描画領域
- CGRect rect = CGRectMake(0, 0, size.width, size.height);
- for (id item in array) {
- if (![item isKindOfClass:[UIImage class]]) {
- continue;
- }
- UIImage *img = item;
- [img drawInRect:rect];
- }
- // 現在のグラフィックスコンテキストの画像を取得する
- image = UIGraphicsGetImageFromCurrentImageContext();
- // 現在のグラフィックスコンテキストへの編集を終了
- // (スタックの先頭から削除する)
- UIGraphicsEndImageContext();
- return image;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement