在我们当前的项目中,我们有一个不断增长的 Gitlab CI 变量集合(大约 40-50)。所有这些变量都在我们的 CI/CD 管道中使用,对我们的生产环境至关重要。
我想定期生成备份,以防有人弄乱这些变量。
不幸的是,我没有看到任何将变量导出到Project -> Settings -> CI / CD -> Environment variables. 我所能做的就是查看/编辑/删除变量。
这些变量是否有隐藏的导出功能?我们自托管我们的 Gitlab 实例(GitLab 社区版 11.8.1)。
我正在尝试使用iOS Metal框架和Swift 4 / iOS 11 / XCode 9绘制(并经常更新)折线。对于最终项目,我希望能够用手指“绘制”一条线,以捕获触摸事件。我基本上是在改编本教程《金属教程Swift 3第1部分》中的代码,只是更改了我将在此处描述的部分。尤其是片段和顶点着色器保持不变:
vertex float4 basic_vertex(
const device packed_float3* vertex_array [[ buffer(0) ]],
unsigned int vid [[ vertex_id ]]) {
return float4(vertex_array[vid],1.0);
}
fragment half4 basic_fragment() {
return half4(1.0);
}
Run Code Online (Sandbox Code Playgroud)
基本上,我只是在每个传入的触摸事件上扩展vertexData数组(我将其重命名为stroke):
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let t = touches.first {
let pos = t.location(in: view).applying(transformMatrix)
stroke = []
addStrokePoint(point: pos)
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: …Run Code Online (Sandbox Code Playgroud) 我正在使用iOS 11,XCode 9和Metal2。我MTLTexture使用像素格式bgra8Unorm。我无法更改此像素格式,因为根据pixelFormat文档:
金属层的像素格式必须为bgra8Unorm,bgra8Unorm_srgb,rgba16Float,BGRA10_XR或bgra10_XR_sRGB。
其他像素格式不适合我的应用程序。
现在,我想UIImage从纹理创建一个。我可以通过从纹理(doc)中提取像素字节来做到这一点:
getBytes(_:bytesPerRow:bytesPerImage:from:mipmapLevel:slice:)
Run Code Online (Sandbox Code Playgroud)
我正在处理这些字节以获取UIImage:
func getUIImageForRGBAData(data: Data) -> UIImage? {
let d = (data as NSData)
let width = GlobalConfiguration.textureWidth
let height = GlobalConfiguration.textureHeight
let rowBytes = width * 4
let size = rowBytes * height
let pointer = malloc(size)
memcpy(pointer, d.bytes, d.length)
let colorSpace = CGColorSpaceCreateDeviceRGB()
let context = CGContext(data: pointer, width: width, height: height, bitsPerComponent: 8, bytesPerRow: rowBytes, space: colorSpace, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue)! …Run Code Online (Sandbox Code Playgroud)