|
|
|
|
Source files for images in Magnum documentation
|
|
|
|
|
-----------------------------------------------
|
|
|
|
|
|
|
|
|
|
Compile and install Magnum with `Sdl2Application`, windowless application for
|
|
|
|
|
your platform and `magnum-distancefieldconverter` utility and any `PngImporter`
|
|
|
|
|
and `PngImageConverter` plugins from Magnum Plugins.
|
|
|
|
|
|
|
|
|
|
Create build dir, point CMake to this directory and compile the executables:
|
|
|
|
|
|
|
|
|
|
mkdir build-doc
|
|
|
|
|
cd build-doc
|
|
|
|
|
cmake ../doc/generated
|
|
|
|
|
cmake --build .
|
|
|
|
|
|
|
|
|
|
### Primitive images
|
|
|
|
|
|
|
|
|
|
Generated by the `primitives` executable. Run it in this directory, the output
|
|
|
|
|
is put into `doc/` directory. Apply `pngcrush` to them for smaller file sizes:
|
|
|
|
|
|
|
|
|
|
for f in $(ls primitives-*.png); do pngcrush -ow $f; done
|
|
|
|
|
|
|
|
|
|
### Shader images
|
|
|
|
|
|
|
|
|
|
Generated by the `shaders` executable. Must be run in this directory, the
|
|
|
|
|
output is put into `doc/` directory. The executable requires two textures:
|
|
|
|
|
|
|
|
|
|
- `vector.png`, generated as full-page PNG output at 96 DPI from `vector.svg`,
|
|
|
|
|
converted to pure grayscale using imagemagick:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
mogrify -flatten -background '#ffffff' -colorspace gray vector.png
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- `vector-distancefield.png`, generated as full-page PNG output at 384 DPI
|
|
|
|
|
(1024x1024) to `vector-src.png` and then processed through
|
|
|
|
|
`magnum-distancefieldconverter`
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
magnum-distancefieldconverter --importer PngImporter --converter PngImageConverter --output-size "64 64" --radius 16 vector-src.png vector-distancefield.png
|
|
|
|
|
```
|
|
|
|
|
Apply `pngcrush` to the result for smaller file sizes:
|
|
|
|
|
|
|
|
|
|
for f in $(ls shaders-*.png); do pngcrush -ow $f; done
|
|
|
|
|
|
|
|
|
|
### Distance field vector images
|
|
|
|
|
|
|
|
|
|
Similarly as above, just with slightly different parameters. The
|
|
|
|
|
`distancefield-src.png` is generated as full-page PNG output at 192 DPI
|
|
|
|
|
(512x512) from `vector.svg`, the `distancefield-dst.png` is then converted with
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
magnum-distancefieldconverter distancefield-src.png distancefield-dst.png --output-size "128 128" --radius 24
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This is chosen so it corresponds to the `TextureTools::DistanceFieldGL` doc
|
|
|
|
|
snippet where it takes a 256x256 image and converts it to 64x64 with a radius
|
|
|
|
|
12, but is scaled twice to look better on HiDPI displays.
|