2
votes

I'm currently working on a project using the Firemonkey framework. In this project, there is a TImageControl as a parent item, and it's children will be several TImage objects and possibly some TEdit objects.

What i'm wanting to do is when the user clicks on a button, it'll merge the contents of the TImage children objects into that of the TImageControl parent to form a scene which will then be saved to a file (and thus it's important that the relative position of the children is maintained in the final image). With the text property of the TEdit children controls, i'd like it to write the text in each TEdit at the relative position it is within the parent onto the final image.

One example of what i want to achieve is similar to the "Flatten Image" feature used in Adobe Photoshop, where it'll take all the layers, and flatten them into a single layer. This is precisely what i wish to achieve. With text, it simply flattens it as if it's a normal image layer, and you lose the ability to edit the text (as it's now all a single image layer).

So far, all i've been able to find are VCL examples which make use of the JPEG unit. Now, while it would certainly be possible to adapt such code to work with this Firemonkey application (such as the "MonkeyMixer" method), i'd be interested in knowing whether there's a cleaner method for achieving this that's more native to Firemonkey. Perhaps something along the lines of children as TImage?

I'm open to changing the TImageControl parent to a different component type if it's more suited, but i do require to be able to save the final image at the end.

1
Does the JPEG unit actually have other VCL dependencies? If not, then it could easily be used in FMX without even any hacks. If it does, perhaps the unit could be modified to remove VCL dependencies?Warren P

1 Answers

2
votes

This thread https://forums.embarcadero.com/thread.jspa?threadID=69764&tstart=30 suggests:

var BMP: TBitmap;
 BMP := FireMonkeyObject.MakeScreenShot;
 BMP.SaveToFile('MyScreenShot.png');
 BMP.Free;

Plus other possible solutions. (I have no experience personally).