Audacity  2.2.0
ImageManipulation.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ImageManipulation.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #include "MemoryX.h"
12 #include <wx/defs.h>
13 #include <wx/colour.h>
14 #include "Theme.h"
15 
16 class wxImage;
17 
18 // This looks at the first pixel in the image, and shifts
19 // the entire image by the vector difference between that
20 // pixel and the dstColour. For better control, use
21 // ChangeImageColour(wxImage, wxColour*, wxColour*) below
22 std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
23 
24 // This function takes a source image, which it assumes to
25 // be grayscale, and smoothly changes the overall color
26 // to the specified color, and returns the result as a
27 // NEW image. This works well for grayscale 3D images.
28 // Audacity uses this routines to make the buttons
29 // (skip-start, play, stop, record, skip-end) adapt to
30 // the color scheme of the user.
31 std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage,
32  wxColour & srcColour,
33  wxColour & dstColour);
34 
35 // Takes a background image, foreground image, and mask
36 // (i.e. the alpha channel for the foreground), and
37 // returns an NEW image where the foreground has been
38 // overlaid onto the background using alpha-blending,
39 // at location (xoff, yoff).
40 std::unique_ptr<wxImage> OverlayImage(wxImage * background, wxImage * foreground,
41  wxImage * mask, int xoff, int yoff);
42 
43 
44 // Same idea, but this time the mask is an alpha channel in
45 // the foreground bitmap, and it's all retrieved from Themes.
46 std::unique_ptr<wxImage> OverlayImage(teBmps eBack, teBmps eForeground,
47  int xoff, int yoff);
48 
49 
50 // Creates an image with a solid background color
51 std::unique_ptr<wxImage> CreateBackground(int width, int height, wxColour colour);
52 
53 // Creates an image with the Mac OS X Aqua stripes, to be used
54 // as a background
55 std::unique_ptr<wxImage> CreateAquaBackground(int width, int height, int offset);
56 
57 // Uses color on all OS except Mac, uses Aqua
58 std::unique_ptr<wxImage> CreateSysBackground(int width, int height, int offset,
59  wxColour colour);
60 
61 // Pastes one image into another at specified location.
62 void PasteSubImage( wxImage * pDest, wxImage * pSrc, int x, int y );
63 
64 // Gets a rectangle from within anothe rimage, INCLUDING the alpha channel
65 wxImage GetSubImageWithAlpha( const wxImage & Src, const wxRect &rect );
void PasteSubImage(wxImage *pDest, wxImage *pSrc, int x, int y)
Definition: ImageManipulation.cpp:317
std::unique_ptr< wxImage > CreateSysBackground(int width, int height, int offset, wxColour colour)
std::unique_ptr< wxImage > CreateBackground(int width, int height, wxColour colour)
Definition: ImageManipulation.cpp:259
int teBmps
Definition: Theme.h:28
std::unique_ptr< wxImage > CreateAquaBackground(int width, int height, int offset)
Definition: ImageManipulation.cpp:282
wxImage GetSubImageWithAlpha(const wxImage &Src, const wxRect &rect)
Definition: ImageManipulation.cpp:374
std::unique_ptr< wxImage > OverlayImage(wxImage *background, wxImage *foreground, wxImage *mask, int xoff, int yoff)
Definition: ImageManipulation.cpp:104
std::unique_ptr< wxImage > ChangeImageColour(wxImage *srcImage, wxColour &dstColour)
Definition: ImageManipulation.cpp:36