Sugar Standard Icons: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (- typo)
(→‎Standard Sugar Cursors: Add notes from my tests.)
Line 9: Line 9:
# Download the Sugar-Icons from [http://dev.laptop.org/git?p=artwork;a=blob;f=cursor/sugar/sugar-00.png;h=93552bff2f6960f273a9946dbb8498e51787a240;hb=HEAD here]
# Download the Sugar-Icons from [http://dev.laptop.org/git?p=artwork;a=blob;f=cursor/sugar/sugar-00.png;h=93552bff2f6960f273a9946dbb8498e51787a240;hb=HEAD here]
# Extract the icon you want to use (36x36 px)
# Extract the icon you want to use (36x36 px)
# Enlarge the canvas to be 40x40px (or any multiple of 8)
# Save it as an .xbm image (width dividable by 8 (eg. 40x40 px))
# Save it as an .xbm image (note that if you are using Gimp, choose "Export" and do not choose "X10 Format Bitmap" for the resulting file)
# Create a mask. This is done with the tool [http://www.cit.gu.edu.au/~anthony/icons/support/scripts/xbm-mask xbm-mask]<br>("''xbm-mask my_cursor_file.xbm''" creates a file called "''my_cursor_file_mask.xbm''")
# Create a mask. This is done with the tool [http://www.cit.gu.edu.au/~anthony/icons/support/scripts/xbm-mask xbm-mask]<br>("''xbm-mask my_cursor_file.xbm''" creates a file called "''my_cursor_file_mask.xbm''")
# Now, in pygame you can use this code:
# Now, in pygame you can use this code:

Revision as of 20:19, 9 December 2007

This page is a quick tutorial on how to use the standard icons in your activities.

Standard Sugar Cursors

Sugar-00.png

They are available at dev.laptop.org/artwork

usage with pygame

  1. Download the Sugar-Icons from here
  2. Extract the icon you want to use (36x36 px)
  3. Enlarge the canvas to be 40x40px (or any multiple of 8)
  4. Save it as an .xbm image (note that if you are using Gimp, choose "Export" and do not choose "X10 Format Bitmap" for the resulting file)
  5. Create a mask. This is done with the tool xbm-mask
    ("xbm-mask my_cursor_file.xbm" creates a file called "my_cursor_file_mask.xbm")
  6. Now, in pygame you can use this code:
a, b, c, d = pygame.cursors.load_xbm("my_cursor_file.xbm", "my_cursor_file_mask.xbm")
pygame.mouse.set_cursor(a, b, c, d)
  • To get the white border around the icons, you need to make another mask:
    1. Draw a black line around the white border of the icons
    2. Save it as .xbm (eg. black pointer > white border > black border > transparency)
    3. Create a (and overwrite the old) mask-file again
    4. Remove the black border around the white one
    5. Save and enjoy!