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);
26 Vector2 content_scale = playground_->GetContentScale();
27 std::shared_ptr<Image> image = picture.
ToImage(
30 std::shared_ptr<Texture> texture = image->GetTexture();
31 id<MTLTexture> metal_texture =
32 std::static_pointer_cast<TextureMTL>(texture)->GetMTLTexture();
34 if (metal_texture.pixelFormat != MTLPixelFormatBGRA8Unorm) {
38 CIImage* ciImage = [[CIImage alloc] initWithMTLTexture:metal_texture
42 std::shared_ptr<Context> context = playground_->GetContext();
43 std::shared_ptr<ContextMTL> context_mtl =
44 std::static_pointer_cast<ContextMTL>(context);
45 CIContext* cicontext =
46 [CIContext contextWithMTLDevice:context_mtl->GetMTLDevice()];
49 CIImage* flipped = [ciImage
50 imageByApplyingOrientation:kCGImagePropertyOrientationDownMirrored];
52 CGImageRef cgImage = [cicontext createCGImage:flipped
53 fromRect:[ciImage extent]];