11.9 Image Labels
The content of the Image file in the Image and Inactive domains is written into the. cxx file. If multiple components share the same image, only one copy is written. Because image data is generated in the source code, you only need to distribute the C ++ source code without the image file itself.
However, the image file name is stored in the. fl file, so you need the image file when reading the. fl file. The image file name path is relative to the fl file path instead of the current path. We recommend that you either put the image and the fl file in the same directory or use the absolute path name.
Notes for all file types
Notes for All Image Types
FLUID runs [?] using the default image of your X server 【??]. This may be an 8-bit image that provides the jitters image. Add the code "Fl: visual (FL_RGB)" to your actual program in the first window of your code. All components that use the same image share the same code and source X image. Therefore, once you have put an image in a component, it is almost easy to put the same image into other components.
If you edit this image when FLUID is using an image, the only way to enable FLUID to read the image file again is to remove the image from all its components or reload the image from the fl file.
Do not rely on FLTK to crop images beyond the component, because it may not work in future versions. The cropping in the label may not change.
To place images more accurately, you can create a new box component and place the image as a tag.
XBM (X-Bitmap) File
FLUID reads the X bitmap file [?] that uses the bitmap defined by C source code 【??]. Sometimes the file is saved with the extension. h or. bm instead of the standard. xbm.
FLUID uses code to construct the Fl_Bitmap image and uses it as the component tag. Use the color of the component label to draw the bit1 field in the bitmap. You can change the color in the component property panel of FLUID. Bit 0 is transparent.
The bitmap program in the X distribution is enough to edit the bitmap task.
XPM (X image) File
FLUID reads X image files like the libxpm library. These files use the C source file to define the image. The file extension is usually. xpm.
FLUID uses code to construct the Fl_Pixmap image and uses it as the component tag. The label color of the component will not be ignored. Even two colors of the image can be bitmap 【??]. The XPM file can mark a separate color as transparent color. FLTK uses this information to generate a transparent mask for the image.
We do not have the discovery icon image editor. We have used the XPaint and KDE icon editors for the image.
BMP file
FLUID reads windows BMP files. BMP images are often used as WIN32 program icons. FLUID converts the BMP file to XPM format, and uses the Fl_VMP_Image image as the component label. For transparent processing, like XPM files, all the image data written into the source file is not compressed, so the code file may be much larger than the bmp file.
GIF files
FLUID reads GIF images that are frequently used in HTML documents. FLUID converts GIF files to XPM format and uses Fl_GIF_Image as the component tag. For transparent processing, like XPM files, all the image data written into the source file is not compressed, so the code file may be much larger than the gif file. Only the first GIF image is dynamic 【??].
JPEG file
If the JPEG file used by FLTK supports compilation, FLUID can read JPEG image files. JPEG files are often used in digital images. FLUID uses Fl_JPEG_Image as the component label, write uncompressed RGB or grayscale data to the source file.
PNG (Portable Network Graphics) File
If FLTK uses PNG to support Compilation, FLUID can read PNG image files that are often used in HTML documents. FLUID uses the Fl_PNG_Image image as the component label to write uncompressed RGB or grayscale data to the source file. PNG images provide a complete alpha channel for partial transparency. FLTK tries its best to support this function on every platform.
11.10 internationalization of FLUID
FLUID supports the internationalization of component tag strings (I18N for short ). The Preference window provides options for I18N.
11.10.1 I18N Method
FLUID supports three methods for I18N: use GUN gettext or POSIX catgets. The default method is none. Instead, the label string is passed to the component constructor.
The GUN gettext method uses GUN gettext (or a similar text-based I18N Library) to return a local string before calling the component constructor.
The POSIX catgets method uses the POSIX catgets function to return a numbered message from the message directory before calling the component constructor.
11.10.2 use GNU gettext to complete I18N
The Code support of GUN gettext in FLUID is restricted when only functions or macros can be called to return local labels. You still need to call setlocale (), textdomain (), or bindtextdomain () to select the appropriate language and message file.
To Use GNU gettext, open the Preference window and select "GNU
"Gettext", two new input fields will appear, you can control the files contained in the returned local tag string and the function or macro name used.
Figure 11.11 internationalization using GNU gettext
# Include domain control I18N contains header files. By default, it is the GNU gettext standard I18N file <libintl. h>.
The Function field controls the Function (or macro) that returns the local message. By default, the gettext Function is called.
11.10.3 use POSIX catgets to complete I18N
The POSIX catgets code in FLUID allows you to use a global message file for all interfaces or a special file for each fl file. You still need to call setlocale () to select the appropriate language.
To Use POSIX catgets for I18N, open the Preference window and select"
POSIX catgets ", three new input fields will appear. You can control the include file, directory file, and set number when returning the local tag string.
Figure 11.12 using POSIX catgetst for internationalization
# Include domain control I18N contains header files. The default is POSIX catgetst's standard I18N file <nl_types.h>.
The File field controls the name of the directory File variable used to return a local message 【??]. By default, the file field is empty, which forces all windows defined in the fl file to use local (static) Directory files.
The number Set in the Set domain directory file. The default value is 1, which rarely needs to be modified.
11.11 known Defects
You can use the # if 0 and # endif declaration blocks to temporarily close the designed code, which effectively avoids code block compilation. However, static code and data generated in this section (menu items, images, include declarations, etc.) will still be generated, and may cause a warning during compilation.
[Note]: After the translation is finished, I didn't want to do it again when I had already translated half of it. Although my English is poor, I feel like this manual is written in English dialects, all kinds of syntaxes fail, and finally the translation is completed based on the principle of good start and end. FLUID is a tool used to design the interface and replace the interface with code, translation of this manual is to understand what functions it has. For details, refer to its source code to learn about nutrition. Finally, the translation is over. Let's take a look, and I don't know much about it in many places.
Complete word attached: http://download.csdn.net/detail/ljbsdu/4704452 has been so hard for so long, always a little hard work, 3 points, no points can contact me.