Adding Bitmaps to Audacity

From Audacity Wiki
Jump to: navigation, search
Google Summer of Code (GSoC) is Google's program for promoting Open Source Software development. Audacity was a mentoring organization for five students for Google Summer of Code 2008, and mentored two students in 2009. This page is about adding new images and colors to Audacity code.
For information about our future plans and about Audacity software development, please join our developers mailing list
 
Related article(s):


Theming

Audacity has a theming system where all the images and colours are stored in a .png file integrated into the Audacity program. There is one of these for each of the four built in themes.

  • This system is very inconvenient to use when you are making frequent changes to images and/or tweaking colours.
  • For GSoC we suggest instead that you use wxWidgets more directly.


Images

We suggest for GSoC using images in xpm format. Images in xpm format can be stored directly in the code. This example below is the Help.xpm image.


\images\Help.xpm

/* XPM */
static const char * const Help_xpm[] = {
"21 21 31 1",
" 	c None",
".	c #6699FF",
"+	c #8CB2FE",
"@	c #CDDDFE",
"#	c #F0F5FE",
"$	c #F9FAFE",
"%	c #E4ECFE",
"&	c #A4C2FE",
"*	c #6698FE",
"=	c #FFFFFF",
"-	c #A9C5FE",
";	c #DAE6FE",
">	c #95B8FE",
",	c #6D9DFE",
"'	c #71A0FE",
")	c #BFD4FE",
"!	c #E9F0FE",
"~	c #F7F9FE",
"{	c #90B4FE",
"]	c #C8DAFE",
"^	c #78A5FE",
"/	c #EEF3FE",
"(	c #E3ECFE",
"_	c #6F9FFE",
":	c #7CA7FE",
"<	c #EDF2FE",
"[	c #E6EEFE",
"}	c #DBE7FE",
"|	c #87AEFE",
"1	c #FBFCFE",
"2	c #6799FE",
"        .....        ",
"      .........      ",
"    .............    ",
"   ...............   ",
"  [email protected]#$%&*.....  ",
"  .....======-.....  ",
" ......;>,')=!...... ",
" ..........,=~...... ",
"...........{=].......",
"..........^/(_.......",
".........:<['........",
".........}=|.........",
".........1=2.........",
" ........==......... ",
" ................... ",
"  .......==........  ",
"  .......==........  ",
"   ...............   ",
"    .............    ",
"      .........      ",
"        .....        "};

You can get an xpm file from a .bmp or .png using the Gimp image editor.

Here's an example of the xpm being used:

\src\AudacityFileConfig.cpp

#include "../images/Help.xpm"
wxButton *b = S.Id(wxID_HELP).AddBitmapButton(wxBitmap(Help_xpm));


Colors

Colors can be created directly using wxWidgets. For example:


    dc.SetBackground(wxBrush(wxColour(254, 254, 254)));