At the beginning, it may be difficult for beginners of souI to figure out the process of displaying an image resource in souI. Here is a simple example.
First, prepare a picture for example.
Step 1: We first copy this image file to the demo's uires, and create a new directory JPG with only this file 9.jpg
Step 2: Introduce the image resource in uires. idx.
<jpg> <file name="girl" path="jpg\9.jpg"/> </jpg>
We name this resource "girl ".
Step 3: Define an imgframe object in the global or window skin node. It is defined in the partial skin of the main window.
<Skin> <! -- Local skin object --> <GIF name = "gif_horse" src = "GIF: gif_horse"/> <GIF name = "gif_penguin" src = "GIF: gif_penguin "/> </skin>
Note the reference to girl in the above Code. We keep 150 vertices in the X and Y directions without stretching.
Step 4: Define an IMG control object in the UI to display the image.
<page title="jpg:girl"> </page>
Success!
Run the program to check the effect.
The following is the zoom-in status:
We can see that the points on the edge and the center are stretched differently.
Let's look at the zoom-in status:
The effect looks better.
All the work is to modify the XML file and display an image without a line of C ++ code.
Loading images from a file is similar. You can refer to the example of loading GIF animation from a file in demo.