2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
ImageManipulation.h
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
Dominic Mazzoni
|
|
|
|
|
2014-06-03 20:30:19 +00:00
|
|
|
**********************************************************************/
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-03-31 17:41:42 +00:00
|
|
|
#include "MemoryX.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/defs.h>
|
|
|
|
|
2018-11-14 20:01:44 +00:00
|
|
|
class wxColour;
|
2010-01-23 19:44:49 +00:00
|
|
|
class wxImage;
|
|
|
|
|
|
|
|
// This looks at the first pixel in the image, and shifts
|
2014-06-03 20:30:19 +00:00
|
|
|
// the entire image by the vector difference between that
|
2010-01-23 19:44:49 +00:00
|
|
|
// pixel and the dstColour. For better control, use
|
|
|
|
// ChangeImageColour(wxImage, wxColour*, wxColour*) below
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// This function takes a source image, which it assumes to
|
|
|
|
// be grayscale, and smoothly changes the overall color
|
|
|
|
// to the specified color, and returns the result as a
|
2016-02-13 15:43:16 +00:00
|
|
|
// NEW image. This works well for grayscale 3D images.
|
2010-01-23 19:44:49 +00:00
|
|
|
// Audacity uses this routines to make the buttons
|
|
|
|
// (skip-start, play, stop, record, skip-end) adapt to
|
|
|
|
// the color scheme of the user.
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> ChangeImageColour(wxImage * srcImage,
|
2010-01-23 19:44:49 +00:00
|
|
|
wxColour & srcColour,
|
|
|
|
wxColour & dstColour);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
// Takes a background image, foreground image, and mask
|
|
|
|
// (i.e. the alpha channel for the foreground), and
|
2020-12-07 22:22:13 +00:00
|
|
|
// returns a NEW image where the foreground has been
|
2010-01-23 19:44:49 +00:00
|
|
|
// overlaid onto the background using alpha-blending,
|
|
|
|
// at location (xoff, yoff).
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> OverlayImage(wxImage * background, wxImage * foreground,
|
2010-01-23 19:44:49 +00:00
|
|
|
wxImage * mask, int xoff, int yoff);
|
|
|
|
|
|
|
|
|
2019-07-09 16:52:10 +00:00
|
|
|
// JKC: will probably change name from 'teBmps' to 'tIndexBmp';
|
2020-05-26 17:31:32 +00:00
|
|
|
using teBmps = int; /// The index of a bitmap resource in Theme Resources.
|
2019-07-09 16:52:10 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
// Same idea, but this time the mask is an alpha channel in
|
|
|
|
// the foreground bitmap, and it's all retrieved from Themes.
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> OverlayImage(teBmps eBack, teBmps eForeground,
|
2010-01-23 19:44:49 +00:00
|
|
|
int xoff, int yoff);
|
|
|
|
|
|
|
|
|
|
|
|
// Creates an image with a solid background color
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> CreateBackground(int width, int height, wxColour colour);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// Creates an image with the Mac OS X Aqua stripes, to be used
|
|
|
|
// as a background
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> CreateAquaBackground(int width, int height, int offset);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// Uses color on all OS except Mac, uses Aqua
|
2016-03-31 17:41:42 +00:00
|
|
|
std::unique_ptr<wxImage> CreateSysBackground(int width, int height, int offset,
|
2010-01-23 19:44:49 +00:00
|
|
|
wxColour colour);
|
|
|
|
|
|
|
|
// Pastes one image into another at specified location.
|
|
|
|
void PasteSubImage( wxImage * pDest, wxImage * pSrc, int x, int y );
|
|
|
|
|
2020-04-11 07:08:33 +00:00
|
|
|
// Gets a rectangle from within another image, INCLUDING the alpha channel
|
2010-01-23 19:44:49 +00:00
|
|
|
wxImage GetSubImageWithAlpha( const wxImage & Src, const wxRect &rect );
|