hsauro
Members-
Content Count
88 -
Joined
-
Last visited
-
Days Won
2
Everything posted by hsauro
-
Newly released book: Delphi Legacy Projects
hsauro replied to Bill Meyer's topic in Tips / Blogs / Tutorials / Videos
How are you publishing it, kdp or something else like ingramspark or a separate publisher? -
Python installer ( with PIP) vs. Chocolatey vs. Conda vs. Anaconda vs. Microconda
hsauro replied to Rollo62's topic in Python4Delphi
I looked around and didn’t find any immediate answer but can the embedded python be used on Mac OS in a similar way? I’m interested in distributing python with a Delphi App on the Mac and windows. -
FMX has a TGradient non-visual class, I’ve used it in the past. Might be worth looking at, though I notice your referring to TColor rather than TAlphaColor so it might not be applicable.
-
Ah, I see what you mean.
-
I just tried it on D 11.1 Prof and I successfully replaced a TButton with a TEdit, no error message.
-
Thank for your hard work!
-
I'm using DelphiWrapper to expose an API in a Delphi application that Python can run methods from. So far it works ok. It's a very primitive plugin system. My question is whether there is a way for a Delphi method to return a python list to the python caller using delphiwrapper. eg In python: mylist = delphiAPI.getlist() where mylist might be a list of strings ['red', 'dog', 'rock'] At the moment I export two more primitive methods, one method to get the number of items and another method to get the ith item. I then create a small Python function that builds a python list using those more primitive methods. I was wondering if there was another way to do this using DelphiWrapper. In the long term, it would also be nice to return and pass to Delphi numpy arrays but I imagine that would be much more difficult.
-
Return list from Delphi to python using DelphiWrapper
hsauro replied to hsauro's topic in Python4Delphi
Thanks that worked. -
Return list from Delphi to python using DelphiWrapper
hsauro replied to hsauro's topic in Python4Delphi
Thanks, I'll take that into account One other question I have, how can I check if a python script I import has a given function? eg p = Import (mypythoncode) p.myfunction() Is there a check I make to see if myfunction() is defined in mypythoncode other than actually trying to call it and trapping the exception? I should add that myfunction() isn't part of a class. -
Return list from Delphi to python using DelphiWrapper
hsauro replied to hsauro's topic in Python4Delphi
That worked, thanks, I should have tried it first. For those who are interested. all I did was declare my method at the Delphi end as: function TObj.getlist : TStringList; begin result := TStringList.Create; result.Add ('abc); etc end I assume the TStringList is reference-counted at the python end and I shouldn't care about dreeing it? Then at the python end, I just called x = obj.getList() It comes back as a TString type but you can convert it to a python list using list(x) or x.ToList(). As a TString type, it does have all the methods you'd expect for a Delphi TString type, eg x.Add ('A long string') -
I would post it as an issue to the DelphiVCl GitHub repo. The error shows it can find the moduledefs.json file.
-
Any progress made on this? It looks like it's still not possible to handle the Mouse events.
-
I've been trying to figure out how I can allow a user to select a block of cells in a FMX TStringGrid with a mouse drag operation. If one creates a FMX TStringGrid and adds columns, it only lets you select one cell at a time. The VCL TStringGrid has a goRangeSelection option but I can't find any options to select multiple cells in the FMX TStringGrid. Any suggestions? Also if multiple cells can be selected how does one determine which block of cells were selected?
-
If you’ve done any 2d drawing with VCL it’s not too dissimilar to that. If you need interactive drawing, use a TPaintBox component and write your drawing code in the onpaint event. This control can also detect mouse actions so that you can respond to events like mousedown, mouse up and mouse move. https://stackoverflow.com/questions/40677671/how-to-draw-a-line-in-delphi-on-an-fmx-canvas
-
Thanks for the example, I think this will be useful to others as well.
-
All I actually want is to draw text that is orientated 90 degrees to the horizontally, ie vertical. No fancy paths to follow, just a straight line. I can currently do it by rotating the image first by 90 degress, writing the text horizontally, then rotate the image back -90 degrees.
-
I found this https://github.com/mono/SkiaSharp/issues/1183 looks like Google removed that functionality. Guess it’s rotate image, draw, rotate image back.
-
I’m trying to display rotated text using skiaDelphi but it appears that the recommended skia way is to rotate the underlying image, write your text, then rotate the image back again. That can work but it requires some thought with respect to coordinates. some users from the c# community suggested using a path as in using (SKPaint skPaint = new SKPaint()) { SKPath path = new SKPath(); path.MoveTo(original.Width / 10, original.Height - original.Height / 10); path.LineTo(original.Width - original.Width / 10, original.Height / 10); canvas.DrawTextOnPath(textToWrite, path, 0, 0, skPaint); path.Dispose() } but I don’t see the method drawtextonpath in the skia4delphi library.
-
If anyone is interested in comparing skia (using skia4delphi) versus VCL for drawing points/pixels, here is a quick demo that draws the Mandelbrot set. The VCL drawing code doesn't use scanlines which I know would be faster but just uses Pixel[i,j] which we know is notoriously slow. The skia code uses DrawPoint although I'm not sure if that is the equivalent to Pixels or not The code also illustrates how you can draw to a skia canvas then copy the result to a TImage. The code could certainly be updated to improve its organization but I didn't have the time. Code at: https://github.com/hsauro/Mandelbrot There is a binary release on Github, https://github.com/hsauro/Mandelbrot/releases/tag/1.0 I couldn't include the binaries here because the skia dll exceeds the size limit for attachments. Spoiler Alert: skia was faster.
-
Someone asked that I include the timings in the code and while I was at it I folded in the code provided by contributors here. I'll probably add TImage32 at some point as well. https://github.com/hsauro/Mandelbrot There is a new binary release on Github, https://github.com/hsauro/Mandelbrot/releases/tag/1.1
-
Is there an EMB procedure to get a given package available on GetIt? I was thinking that since skia4delphi is now available on GetIt it would be nice to also have TImage32. Of course, it's not hard to install these manually but it does make life a little easier.
-
To answer my own question, submissions can be proposed here: https://getitnow.embarcadero.com/submit/
-
@angusj I finally got round to looking more seriously Image32, and it's working well so far. In fact, I think I use this instead of GDI+ in the future. Plus as you mentioned earlier it's cross-platform.
-
Thanks for the example! I was wondering if there was a direct way to get direct access to the pixels from skia4delphi.
-
For some reason I didn't realize image32 was portable, sorry about that. Thanks for the code however, because I wanted to play around a bit more with pixel manipulation with image32.