Audacity 3.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 <memory>
12#include <wx/defs.h>
13
14class wxColour;
15class wxImage;
16class wxRect;
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
22THEME_API
23std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
24
25// This function takes a source image, which it assumes to
26// be grayscale, and smoothly changes the overall color
27// to the specified color, and returns the result as a
28// NEW image. This works well for grayscale 3D images.
29// Audacity uses this routines to make the buttons
30// (skip-start, play, stop, record, skip-end) adapt to
31// the color scheme of the user.
32THEME_API
33std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage,
34 wxColour & srcColour,
35 wxColour & dstColour);
36
37// Takes a background image, foreground image, and mask
38// (i.e. the alpha channel for the foreground), and
39// returns a NEW image where the foreground has been
40// overlaid onto the background using alpha-blending,
41// at location (xoff, yoff).
42THEME_API
43std::unique_ptr<wxImage> OverlayImage(wxImage * background, wxImage * foreground,
44 wxImage * mask, int xoff, int yoff);
45
46
47// JKC: will probably change name from 'teBmps' to 'tIndexBmp';
48using teBmps = int;
49
50// Same idea, but this time the mask is an alpha channel in
51// the foreground bitmap, and it's all retrieved from Themes.
52THEME_API
53std::unique_ptr<wxImage> OverlayImage(teBmps eBack, teBmps eForeground,
54 int xoff, int yoff);
55
56
57// Creates an image with a solid background color
58THEME_API
59std::unique_ptr<wxImage> CreateBackground(int width, int height, wxColour colour);
60
61// Creates an image with the Mac OS X Aqua stripes, to be used
62// as a background
63THEME_API
64std::unique_ptr<wxImage> CreateAquaBackground(int width, int height, int offset);
65
66// Uses color on all OS except Mac, uses Aqua
67THEME_API
68std::unique_ptr<wxImage> CreateSysBackground(int width, int height, int offset,
69 wxColour colour);
70
71// Pastes one image into another at specified location.
72THEME_API
73void PasteSubImage( wxImage * pDest, wxImage * pSrc, int x, int y );
74
75// Gets a rectangle from within another image, INCLUDING the alpha channel
76THEME_API
77wxImage GetSubImageWithAlpha( const wxImage & Src, const wxRect &rect );
THEME_API wxImage GetSubImageWithAlpha(const wxImage &Src, const wxRect &rect)
THEME_API std::unique_ptr< wxImage > ChangeImageColour(wxImage *srcImage, wxColour &dstColour)
THEME_API std::unique_ptr< wxImage > CreateBackground(int width, int height, wxColour colour)
THEME_API std::unique_ptr< wxImage > CreateSysBackground(int width, int height, int offset, wxColour colour)
int teBmps
THEME_API std::unique_ptr< wxImage > CreateAquaBackground(int width, int height, int offset)
THEME_API void PasteSubImage(wxImage *pDest, wxImage *pSrc, int x, int y)
THEME_API std::unique_ptr< wxImage > OverlayImage(wxImage *background, wxImage *foreground, wxImage *mask, int xoff, int yoff)