いつまで経ってもPrivate Frameworksに引き蘢っているiOSのOpenCL APIは果たして本当に使えるのか? というわけでアプリから引き摺り出してみます。Jailbreakはしません。
Private Frameworksは基本的にSDK配下のものと同じパスでランタイムにdlopen(3)する事が出来るので、実機で開いてみます。
#import "AppDelegate.h"
| func colorWithGradient(frame: CGRect, colors: [UIColor]) -> UIColor { | |
| // create the background layer that will hold the gradient | |
| let backgroundGradientLayer = CAGradientLayer() | |
| backgroundGradientLayer.frame = frame | |
| // we create an array of CG colors from out UIColor array | |
| let cgColors = colors.map({$0.CGColor}) | |
| backgroundGradientLayer.colors = cgColors |
| /** | |
| @brief Returns true if images have same meta. Width, Height, bit depth. | |
| @discussion Assumes images are non null. | |
| */ | |
| func doImagesHaveSameMeta(#image1:CGImage, #image2:CGImage) -> Bool { | |
| if CGImageGetWidth(image1) != CGImageGetWidth(image2) { | |
| return false | |
| } | |
| if CGImageGetHeight(image1) != CGImageGetHeight(image2) { |
| #!/bin/sh | |
| UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
| # make sure the output directory exists | |
| mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
| # Step 1. Build Device and Simulator versions | |
| xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
| xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
| /* | |
| * GifRecorder - makes it easy to record a sketch in animated GIF | |
| * (c) 2014 cocopon. | |
| */ | |
| import gifAnimation.*; | |
| /* | |
| * Usage: | |
| * | |
| * 0. Install a required library before using GifRecorder. |
| \lstdefinelanguage{swift} | |
| { | |
| morekeywords={ | |
| func,if,then,else,for,in,while,do,switch,case,default,where,break,continue,fallthrough,return, | |
| typealias,struct,class,enum,protocol,var,func,let,get,set,willSet,didSet,inout,init,deinit,extension, | |
| subscript,prefix,operator,infix,postfix,precedence,associativity,left,right,none,convenience,dynamic, | |
| final,lazy,mutating,nonmutating,optional,override,required,static,unowned,safe,weak,internal, | |
| private,public,is,as,self,unsafe,dynamicType,true,false,nil,Type,Protocol, | |
| }, | |
| morecomment=[l]{//}, % l is for line comment |
| 更新: | 2026-01-17 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2026.1 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
| static CGPathRef createClosedPathWithPoints(const CGPoint *points, size_t count) { | |
| CGMutablePathRef path = CGPathCreateMutable(); | |
| CGPathAddLines(path, NULL, points, count); | |
| CGPathCloseSubpath(path); | |
| return path; | |
| } | |
| static CGRect integralFrameForPath(CGPathRef path) { | |
| CGRect frame = CGPathGetBoundingBox(path); | |
| return CGRectIntegral(frame); |