7 #include <CoreImage/CoreImage.h>
10 #define GLFW_INCLUDE_NONE
11 #include "third_party/glfw/include/GLFW/glfw3.h"
17 FML_CHECK(::glfwInit() == GLFW_TRUE);
25 const std::shared_ptr<Texture> texture) {
27 id<MTLTexture> metal_texture =
28 std::static_pointer_cast<TextureMTL>(texture)->GetMTLTexture();
30 CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
31 CIImage* ciImage = [[CIImage alloc]
32 initWithMTLTexture:metal_texture
33 options:@{kCIImageColorSpace : (__bridge id)color_space}];
34 CGColorSpaceRelease(color_space);
37 std::shared_ptr<Context> context = playground_->GetContext();
38 std::shared_ptr<ContextMTL> context_mtl =
39 std::static_pointer_cast<ContextMTL>(context);
40 CIContext* cicontext =
41 [CIContext contextWithMTLDevice:context_mtl->GetMTLDevice()];
44 CIImage* flipped = [ciImage
45 imageByApplyingOrientation:kCGImagePropertyOrientationDownMirrored];
47 CGImageRef cgImage = [cicontext createCGImage:flipped
48 fromRect:[ciImage extent]];