- 更新
2024-05-22
- 作者
@voluntas
- バージョン
2024.1
- URL
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); |
2024-05-22
@voluntas
2024.1
typo などは https://x.com/voluntas までご連絡ください。
\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 |
/* | |
* 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. |
#!/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 |
/** | |
@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) { |
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 |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/features2d/features2d.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/video/video.hpp> | |
#include <iostream> | |
using namespace cv; | |
using namespace std; |