Skip to content

Commit

Permalink
Sketcher: update XPM icon for PointOnPoint constraint
Browse files Browse the repository at this point in the history
The SVG icon was changed in d3ee556 but the small XPM icon
was not modified.

Unlike other XPM icons which are used in `ViewProviderSketch.cpp`,
this `PointOnPoint` XPM icon doesn't seem to be used at all.
Nevertheless, we still update it so that the XPM matches
its corresponding SVG.

Also update the `README.md` to explain how these XPM icons
are generated.
  • Loading branch information
vocx-fc authored and yorikvanhavre committed Apr 27, 2020
1 parent 7069d9a commit 884cbe8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 34 deletions.
@@ -1,26 +1,25 @@
/* XPM */
static char * Constraint_PointOnPoint_sm_xpm[] = {
"16 16 7 1",
" c None",
". c #991515",
"+ c #E11D1D",
"@ c #9A1414",
"# c #E21D1D",
"$ c #CC0000",
"% c #9B1414",
" ",
" ",
" ",
" ",
" ",
" ",
" .++@ ",
" #$$# ",
" #$$# ",
" @++% ",
" ",
" ",
" ",
" ",
" ",
" "};
static char *Constraint_PointOnPoint_sm_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1 ",
" c None",
". c #D71414",
"+ c #AA1919",
/* pixels */
" ",
" + + ",
" +.+ +.+ ",
" +.+ +.+ ",
" + + ",
" ++++ ",
" +....+ ",
" +...++ ",
" +..+++ ",
" +.++.+ ",
" ++++ ",
" + + ",
" +.+ +.+ ",
" +.+ +.+ ",
" + + ",
" "
};
41 changes: 32 additions & 9 deletions src/Mod/Sketcher/Gui/Resources/icons/small/README.md
@@ -1,24 +1,47 @@
To create an XPM file from an SVG file, you need the ImageMagick libraries.
Then run
```
convert file.svg -geometry 16x16 -colors 16 file_sm.xpm
convert file.svg -geometry 16x16 -colors 8 file_sm.xpm
```

The XPM icon is very small, 16x16 px in size, and you usually don't need
more than 16 colors.
The XPM icon is very small, 16x16 px in size, and we usually don't need
more than 8 colors.

Edit the xpm file manually to do small retouches, for example, setting up
the transparency and reducing the number of colors exactly to the desired ones.

An XPM image has a header that defines the number of columns, number of rows,
number of colors, and number of characters per pixel.
The first rows have the colors definition, so they must match the number
of colors, while the rest corresponds to the actual bitmap image.

The space character (empty) can be set to the color `None`,
to indicate transparency.

```
/* XPM */
static char * file_sm_xpm[] = {
"16 16 7 1",
" c None",
". c #BB1616",
"+ c #DE1515",
"@ c #BE1616",
static char *file_sm_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1 ",
" c None",
". c #D71414",
"+ c #AA1919",
/* pixels */
" ",
" + + ",
" +.+ +.+ ",
" +.+ +.+ ",
" + + ",
" ++++ ",
" +....+ ",
" +...++ ",
" +..+++ ",
" +.++.+ ",
" ++++ ",
" + + ",
" +.+ +.+ ",
" +.+ +.+ ",
" + + ",
" "
};
```

0 comments on commit 884cbe8

Please sign in to comment.