John van de Waeter 7 Posted January 14, 2022 (edited) Hi All, I use Metal in a iOS FMX project like: if TUIScreen.Wrap(TUIScreen.OCClass.mainScreen).nativeScale=TUIScreen.Wrap(TUIScreen.OCClass.mainScreen).Scale then begin GlobalUseMetal:=true; GlobalEventDrivenDisplayUpdates:=false; GlobalPreferredFramesPerSecond:=60; end; I use Media-Camera action TakePhotoFromCamera OnDidFinishTaking and assign the bitmap to a TImage.Bitmap. This used to work okay, but now on Delphi11 it produces an image in which Red and Blue are interchanged. Same thing happens if I paste an image from the clipboard. Same thing happens if I get an image from the gallery. Image.Bitmap.Loadfromfile('animage.jpg') and dito .png works okay. If I turn off Metal, all is okay. Tested on iPhone5 and iPhone8. Any thougts? tia, John Edited January 14, 2022 by John van de Waeter Share this post Link to post
Harry Stahl 1 Posted January 16, 2022 Do I understand you right, that with 10.4 all works fine, but now with Delphi 11 not? Then I think you should open a QR-Report at jira. In fact on macOS the bitmaps are in BGR order, but pasting images from the clipboard or getting images from the gallery should take this into account. Share this post Link to post
John van de Waeter 7 Posted January 16, 2022 Done 🙂 I'm always modest and reluctant before reporting an issue, cause most of the time it turns out to be my mistake.... Share this post Link to post
sjordi 39 Posted January 16, 2022 Did you try to move the metal initialization into the .dpr file? I think it's mandatory. Something like in this example (to adapt for your need) {$IF defined(MACOS)} if TCustomContextMetal.IsMetalSupported then GlobalUseMetal := True; {$ENDIF} Application.Initialize; Application.CreateForm(TFormMain, FormMain); Application.Run; I faced several problems when in the main application, it didn't work or even produced errors. Someone here told me that, according to the documentation this has to be set into the DPR file. 1 Share this post Link to post
qubits 20 Posted January 16, 2022 Hi John, First word that popped into my head was, endianness. Use to pass data between old mpus. looking at timage.LoadFromStream, it calls the TBitmapCodecManager.LoadFromStream who then passes it off to the CodecClass but that's where i stop as the function to get the correct CodecClass is in fact called GuessCodecClass() , so your guess is as good as mine.. frack it, flip all the bits.. Sorry, no help.. Share this post Link to post
ginnix 2 Posted January 31, 2022 This is also happening with my app taking photos. When I include Metal support some of the colors are off. When I disable it, the color are right. Thanks Share this post Link to post
vfbb 285 Posted February 12, 2022 This problem is automatically fixed when you replace the FMX canvas with the Skia4Delphi canvas. program Poject1; uses System.StartUpCopy, FMX.Forms, FMX.Types, Skia.FMX Unit1 in 'Unit1.pas' {Form1}; {$R *.res} begin GlobalUseMetal := True; GlobalUseSkia := True; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. Share this post Link to post
ginnix 2 Posted February 14, 2022 I used the Getit Package manager to install Skia. When I use GlobalUseSkia:=true I get [DCC Error] MultiPic.dpr(31): E2003 Undeclared identifier: 'GlobalUseSkia' Thanks Share this post Link to post
vfbb 285 Posted February 14, 2022 24 minutes ago, ginnix said: I used the Getit Package manager to install Skia. When I use GlobalUseSkia:=true I get [DCC Error] MultiPic.dpr(31): E2003 Undeclared identifier: 'GlobalUseSkia' Thanks The GetIt is out of date yet (version 2.0.1). You should download version 3, Skia4Delphi_3.0.0_Setup.exe, which you will find on the releases page: https://github.com/skia4delphi/skia4delphi/releases Share this post Link to post
ginnix 2 Posted February 14, 2022 I download version 3 and everything is working. Is there an example on how to move a Timage to the Skia canvas? Thanks for this great software 🙂 Share this post Link to post
vfbb 285 Posted February 14, 2022 (edited) Your TImage is already using Skia Canvas. When you replace the default Canvas of FMX to the Skia4Delphi Canvas (by setting GlobalUseSkia := True;), every control in form will be draw automatically using the Skia Canvas, including the TImage. Edited February 14, 2022 by vfbb Share this post Link to post
ginnix 2 Posted February 15, 2022 It does not seem to work with the CameraComponent. When I use Skia all the colors are wrong. When I disable Skia everything works. 1 Share this post Link to post
Rollo62 536 Posted February 16, 2022 (edited) ---- Edited February 16, 2022 by Rollo62 Share this post Link to post
vfbb 285 Posted February 16, 2022 13 hours ago, ginnix said: It does not seem to work with the CameraComponent. When I use Skia all the colors are wrong. When I disable Skia everything works. Thanks for the report. I'll check TCamera again. Any new issue you can report us in GitHub Share this post Link to post
vfbb 285 Posted February 17, 2022 (edited) @ginnix Fixed in new release v3.0.2 Edited February 18, 2022 by vfbb Share this post Link to post
ginnix 2 Posted March 16, 2022 There seems to be a problem with Skia and GlobalUseMetal under ios when you use both in a project. The problem happens when you send the image to the photos app. if not TPlatformServices.Current.SupportsPlatformService(IFMXPhotoLibrary, Service) then exit; Service.AddImageToSavedPhotosAlbum(Image1.Bitmap); The colors are wrong when you view the bitmap in Photos Thanks Share this post Link to post
vfbb 285 Posted March 16, 2022 @ginnix Confirmed the issue! I reported the problem on Github, you can follow it there: https://github.com/skia4delphi/skia4delphi/issues/81 Share this post Link to post
vfbb 285 Posted March 30, 2022 @ginnix Fixed this issue in new version v3.3.0 Quote - Fixed wrong colors in iOS with services when using Skia4Delphi Canvas: IFMXTakenImageService, IFMXCameraService, IFMXPhotoLibrary and IFMXShareSheetActionsService; Share this post Link to post
John van de Waeter 7 Posted April 5, 2022 Hi VFBB, What is the minimal Android version supported? On Android 6 I get an OpenGLES error (3009)... Cheers, John Share this post Link to post
vfbb 285 Posted April 6, 2022 11 hours ago, John van de Waeter said: What is the minimal Android version supported? On Android 6 I get an OpenGLES error (3009)... It supports Android 4.1 JellyBean+. I will test it ASAP. 1 Share this post Link to post
vfbb 285 Posted April 7, 2022 @John van de Waeter I confirmed the problem. I reported it on GitHub, you can follow it there: https://github.com/skia4delphi/skia4delphi/issues/94 1 Share this post Link to post
vfbb 285 Posted April 9, 2022 On 4/5/2022 at 10:20 AM, John van de Waeter said: Hi VFBB, What is the minimal Android version supported? On Android 6 I get an OpenGLES error (3009)... Cheers, John The problem was fixed in new version 3.3.2. Fix: We support Android 5+ Share this post Link to post
John van de Waeter 7 Posted April 11, 2022 Thanks VFBB, I'll give it a try! :) Share this post Link to post