I'm starting to develop projects in Lazarus IDE, and I'm not adapted to the new platform. How can I import audio media, images, videos and other resources in the project and so use them (without the need to use a specific directory of the operating system).
Taking advantage of the same situation, it would be feasible to create a zip file type and import it into the project or create a package containing these resources.
NOTE: I want to use the images in a TImage object and define the resources imported into the picture property.
for images:
myImage.picture.LoadFromFile('img.bmp');
or
myImage.picture.LoadFromFile('folder1/img.bmp'); // not only .bmp is allowed
at the beggining you are in the same folder as the application is
about sounds:
the sound's format is required to be .wav
in youtube are some good tutorials
https://www.youtube.com/watch?v=SkhV7FuUpI4
good luck
Related
For Xamarin.Android it's simple as it only involves 1 platform (and resources are stored in Projectname.Android/Resources/mipmap-{hdpi|mdpi|xhdpi...}). For Xamarin.Forms on the other hand the code refers to single resources/images and as far as they work on different platforms (the same code and the same resources), I can't find a way to provide resources for different resolutions to be automatically picked up based on the screen size/dpi?
Is there a way to achieve that in common Xamarin.Forms project or shall I go and handle it in platform-specific projects' (Android, iOS) code?
The best thing so far is this plugin Resizetizer. You can have all your images in shared project and all images are generated during build time for all platforms (don't worry about the build time, it is similar to incremental build). This approach will also be in .NET Maui which will be launched with .NET 6.
There is also super nice video which really helpful!
As Xamarin.Forms does not seem to support loading image resources from a mipmap folder at this time,you could put different dpi images into the drawable folder like (Resources/drawable--{hdpi|mdpi|xhdpi...}) like mipmap.Then it will pick up the image based on the screen size/dpi automatically.
I'd like to use the same images in multiple device apps in Xamarin.
I have a PCL core library and have started using MVVMCross.
What's the best approach to accomplish this? Can I embed them as a resource in the Core library and access it in my Andriod/iOs project, or is it better to use add as link?
You can in theory embed these as binary resources in the PCL project and can then access them as byte[] via GetResourceStream and from there can then get them decoded in your UI projects. This would require some work to setup and would make it impossible to use the images in the xib editor, in the android XML, etc
More easily, you can also share these image files using 'Add as link' and then allow each individual platform to optimize and package the files - each platform is good at this - eg Android with its different dpi drawable folders and IOS with its 2x image packaging. This technique also works well with the xib and XML designers.
However, in practice I generally find I don't share these image files between projects - instead on most commercial projects, the PhotoShop guys insist on giving me icons, dividers, and other chrome images which are unique to each platform.
Although I am using Doxygen for some years, there are lots of other methods used to create documentation: PowerPoint files, Word files, UML files. Although every file type has its advantages (e.g. PowerPoint is easy to create and ideal for presentations), this quickly leads to lots of different files, in different locations, and no overview.
I now want to merge all these files into one entry point. My idea is to use Doxygen to generate HTML files that contain the source code documentation, and to write overview documentation in Doxygen (just as Qt does), and include images based on the other files. I am also trying to automate the whole system.
What I am now looking for is a way to convert these other files to images, so my automated system can include these images in the generated HTML (and finally in the generated QCH (Qt Help) file).
For PowerPoint I found some tools, but I don't seem to get the free ones working correctly, and a trial version of a commercial one fails on some of my PPTX files.
For Enterprise Architect I didn't find a way to automate the generation of images.
Does anybody know how to automatically generate images from Enterprise Architect files and from PowerPoint files?
Found it.
Enterprise architect has a Java Archive (eaapi.jar) which you can use to access the EAP files from Java.
What you need to do is get the repository, open the file and getting all top-level packages from it (I've omitted all error handling code from this sample):
org.sparx.Repository repo = new org.sparx.Repository();
org.sparx.Project project = repo.GetProjectInterface();
repo.OpenFile(args[0]);
org.sparx.Collection packages = repo.GetModels();
Then loop over all the packages and call your own method (because you will need to call yourself recursively):
for (short i=0;i<packages.GetCount();i++)
{
org.sparx.Package pack = (org.sparx.Package)packages.GetAt(i);
handlePackage (project, pack, currentdir);
}
Then in the method, loop over all diagrams and generate the images, and loop over all sub-packages recursively:
public static void handlePackage (org.sparx.Project project, org.sparx.Package pack, String output)
{
for (org.sparx.Diagram diagram : pack.GetDiagrams())
{
project.PutDiagramImageToFile (diagram.GetDiagramGUID(), output + diagram.GetName() + ".png", 1);
}
for (org.sparx.Package subpack : pack.GetPackages())
{
handlePackage(project,subpack,output);
}
}
That's it.
Some pitfalls:
You must pass a fully qualified path to the OpenFile method. Even if the file is in your local folder, you still have to pass the full path.
Same for the output files
I am working on a Java project that requires the use of several images. I'm on ubuntu linux So I have an images folder inside my src directory. So far so good but try as I might I can't seem to find a way to load or import image files into that images folder. ( I want to be able to simply go something like loadImage("images/imageToLoad.png"); )
I have tried to just drag and drop. I know that I could of course leave the program and use the linux filesystem to transfer the images but that's a pain and defeats the purpose of an IDE.
You will have to do it in a file manager, outside of IntelliJ IDEA. To ensure that images are available in the application classpath check Settings | Compiler | Resource Patterns, .png extension needs to be listed there.
I need to rebrand my application, that means create another application resource file with different strings, slash screen and icons.
My application is also localized for a second language, i have another resource file with all application string which is translated, that creates me additional, satellite dll.
I need to build 4 setup project 2 for each language and 2 for each brand name.
What will the elegant solution for this? Is there any way to create additional application resource file same way I did with language translation and how I include a satellite (resource in a second language dll) in my setup project and not including resources in the original, neutral language.
Thank you.
I assume that those branding resources are not in setup project, but in main project, and that main project is C++.
In C++ you can have several .rc files in a project. This is most likely true for C# resources too. Move all branding material to second resource file. Create another project, shallow in nature, that references all files (including .rc) from original, but uses its own versions of branding files. Apart from strings, icons, and images maybe you will have some dialogs copied and branded as well. Make sure they all have resource identifiers in sync.
Creating another project can be done by just copying original project and fiddling with paths in text editor. Just make sure you change the project GUID, so that two project can coexist in the same solution.