xref: /aosp_15_r20/bootable/recovery/tools/image_generator/README.md (revision e7c364b630b241adcb6c7726a21055250b91fdac)
1*e7c364b6SAndroid Build Coastguard WorkerRecovery Image Generator
2*e7c364b6SAndroid Build Coastguard Worker-------------------------
3*e7c364b6SAndroid Build Coastguard Worker
4*e7c364b6SAndroid Build Coastguard WorkerThis program uses java.awt.Graphics2D to generate the background text files used
5*e7c364b6SAndroid Build Coastguard Workerunder recovery mode. And thus we don't need to do the manual work by running
6*e7c364b6SAndroid Build Coastguard Workeremulators with different dpi.
7*e7c364b6SAndroid Build Coastguard Worker
8*e7c364b6SAndroid Build Coastguard Worker# Usage:
9*e7c364b6SAndroid Build Coastguard Worker  `java -jar path_to_jar --image_width imageWidth --text_name textName --font_dir fontDirectory
10*e7c364b6SAndroid Build Coastguard Worker   --resource_dir resourceDirectory --output_file outputFilename`
11*e7c364b6SAndroid Build Coastguard Worker
12*e7c364b6SAndroid Build Coastguard Worker# Description of the parameters:
13*e7c364b6SAndroid Build Coastguard Worker1. `imageWidth`: The number of pixels per line; and the text strings will be
14*e7c364b6SAndroid Build Coastguard Worker   wrapped accordingly.
15*e7c364b6SAndroid Build Coastguard Worker2. `textName`: The description of the text string, e.g. "recovery_erasing",
16*e7c364b6SAndroid Build Coastguard Worker   "recovery_installing_security"
17*e7c364b6SAndroid Build Coastguard Worker3. `fontDirectory`: The directory that contains all the support .ttf | .ttc
18*e7c364b6SAndroid Build Coastguard Worker   files, e.g. $OUT/system/fonts/
19*e7c364b6SAndroid Build Coastguard Worker4. `resourceDirectory`: The resource directory that contains all the translated
20*e7c364b6SAndroid Build Coastguard Worker   strings in xml format, e.g. bootable/recovery/tools/recovery_l10n/res/
21*e7c364b6SAndroid Build Coastguard Worker5. `outputFilename`: Path to the generated image.
22*e7c364b6SAndroid Build Coastguard Worker
23*e7c364b6SAndroid Build Coastguard Worker# Locales
24*e7c364b6SAndroid Build Coastguard WorkerSupported locales and background texts are located in
25*e7c364b6SAndroid Build Coastguard Worker[tools/recovery_l10n/res/](../recovery_l10n/res/values). For each background text, the tool renders
26*e7c364b6SAndroid Build Coastguard Workera localized image for every supported locale.
27*e7c364b6SAndroid Build Coastguard Worker
28*e7c364b6SAndroid Build Coastguard WorkerEach individual localized image contains an encoded locale header string, and the rendered
29*e7c364b6SAndroid Build Coastguard Workerbackground text. The locale header string is generated by `Locale.forLanguageTag`. And sample
30*e7c364b6SAndroid Build Coastguard Workerresult include `en-US`, `zh-CN`, etc. These individual images are then concatenated together to
31*e7c364b6SAndroid Build Coastguard Workerform the final resource image that locates in res/images, e.g. `install_text.png`
32