New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TImage and SKIA #197
Comments
Are you using the latest version (4.0.2)? You can check your version in Skia.pas. |
I download it today from getit |
@kabiri I tested here with Android64 + Delphi 11.2 + Skia Enabled, using the code: unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
System.Net.HttpClient, System.Net.URLClient;
procedure TForm1.FormCreate(Sender: TObject);
begin
TURLStream.Create('https://cevahirsoft.com/flag/1.bmp',
procedure (AStream: TStream)
begin
Image1.Bitmap.LoadFromStream(AStream);
end);
end;
end. And the result was correct: Can you tell us more info, like your RAD Studio version. I really think that you are using an old version of the library. I'm not sure if Embarcadero continues to update the GetIt of RAD Studio versions prior to the lastest (Alexandria), so to be on the safe side, I recommend downloading the github setup instead of using the GetIt version, if you aren't in Delphi 11 Alexandria. |
i use Delphi 11 Alexandria. |
@kabiri Can you made a test? Just run the follow ShowMessage code: unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
Skia;
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(SkVersion);
end;
end. |
@kabiri To help you I have to be able to simulate your problem, so I need more information. Your Alexandria is 11.2 or previous?Can you tell me the device model and OS version? Perhaps the problem is in the way you load the image, so it would be interesting for you to run the same code that I used to test it so that we can compare the results. #197 (comment) |
I think I understand the problem. interface implementation end. initialization and use it uses Trouble happens |
@kabiri My test also set the |
@viniciusfbb this is my demo |
Can you take a print of the entire Library Path of your IDE? |
You mean that? |
I finally simulate the problem. It's occurs when you use the Skia but without it render (i.e, without the |
As a maybe related question. What do you mean ‘it does not work with alcinoe’ because:Im using the alicinoe vertical listbox with the Skia enabled and with the TskAnimated image which works great.
|
@Spelt Alcinoe is one of the few libraries that are not compatible with Skia's renderer, that is, with |
Of course I use GlobalUseSkia := True; I have set it in the Project.Startup.pas file. Because in the main program (the demo I uploaded was not like that) it was saying that the canvas service was already running, that's why I used this method. |
I think it's little more complicate than this. To be able to create bitmap in background thread, In alcinoe we use TTexture instead of TBitmap and we use directly the OS API (on Android/iOS) to create the bitmap. TTexture work under OpenGL and for this we must work with the TGPUCanvas. Of course we can maybe swap all of this to skia, but I doubt that in skia we can work with Tbitmap in background thread but need to check |
Thanks!Ps. I love Skia & Alcinoe.
|
@Zeus64 Thanks for considering this! TBitmap with or without Skia already supports drawing in background thread normally (there is only one or two issue, related to the fact that System.Messaging is not thread safe and TCanvas.Destroy and TTextLayout use the same, but it is extremely rare this type of error occurs). TBitmap's limitation for background thread drawing is that it is not done in a really parallel way, as TCanvas has a lock that locks all others (including the UI) to make drawings between BeginScene and EndScene, and this is a limitation of FMX, and even enabling Skia, nothing changes about it. However, it is possible to draw images in the background thread using only the Skia APIs, to don't lock the rendering, and then convert the resulting SkImage to a TBitmap, or even directly paint the resulting SkImage on the canvas, if it is of the TSkCanvasCustom type . In case you choose to draw using the Skia APIs, we can make something that facilitates this (on the Skia4Delphi side). A TSkFMXCanvasWrapper class that would be a TCanvas that would encapsulate a desired SkCanvas, and then every part of the drawing would be done by drawing on a TCanvas, without Skia APIs. There are several possibilities. |
@kabiri If you choose the 'replace .bmp format to .png or .jpg' workaround, it might only work if you add |
@viniciusfbb i change bmp to png and set GlobalDisableSkiaCodecsReplacement := True; |
Fixed in last release (v4.1.0) |
I have three photos. My app displayed them correctly.
I used to download them from the internet as a stream and display them in TImage.
I just activated SKIA in Windows, there is no problem and it is displayed correctly. In Android and iPhone, the color of the photo changes.
Link to download photos :
https://cevahirsoft.com/flag/1.bmp
https://cevahirsoft.com/flag/3.bmp
https://cevahirsoft.com/flag/3.bmp
What the program displays:
The text was updated successfully, but these errors were encountered: