44 return values [x + y * size];
54 values [x + y * size] = value;
64 for (
int i = size * size; --i >= 0;)
72 for (
int i = size * size; --i >= 0;)
80 for (
int i = size * size; --i >= 0;)
87 const double radiusFactor = -1.0 / (radius * radius * 2);
88 const int centre = size >> 1;
90 for (
int y = size; --y >= 0;)
92 for (
int x = size; --x >= 0;)
106 const Image& sourceImage,
129 auto right = area.getRight();
130 auto bottom = area.getBottom();
133 Image::BitmapData::writeOnly);
140 for (
int y = area.getY(); y < bottom; ++y)
145 for (
int x = area.getX(); x < right; ++x)
152 for (
int yy = 0;
yy < size; ++
yy)
154 const int sy = y +
yy - (size >> 1);
156 if (
sy >= srcData.height)
161 int sx = x - (size >> 1);
164 for (
int xx = 0;
xx < size; ++
xx)
166 if (
sx >= srcData.width)
196 for (
int y = area.getY(); y < bottom; ++y)
201 for (
int x = area.getX(); x < right; ++x)
207 for (
int yy = 0;
yy < size; ++
yy)
209 const int sy = y +
yy - (size >> 1);
211 if (
sy >= srcData.height)
216 int sx = x - (size >> 1);
219 for (
int xx = 0;
xx < size; ++
xx)
221 if (
sx >= srcData.width)
249 for (
int y = area.getY(); y < bottom; ++y)
254 for (
int x = area.getX(); x < right; ++x)
258 for (
int yy = 0;
yy < size; ++
yy)
260 const int sy = y +
yy - (size >> 1);
262 if (
sy >= srcData.height)
267 int sx = x - (size >> 1);
270 for (
int xx = 0;
xx < size; ++
xx)
272 if (
sx >= srcData.width)
void clear()
Resets all values in the kernel to zero.
void setKernelValue(int x, int y, float value) noexcept
Sets the value of a specific cell in the kernel.
void createGaussianBlur(float blurRadius)
Initialises the kernel for a gaussian blur.
void setOverallSum(float desiredTotalSum)
Rescales all values in the kernel to make the total add up to a fixed value.
float getKernelValue(int x, int y) const noexcept
Returns one of the kernel values.
void rescaleAllValues(float multiplier)
Multiplies all values in the kernel by a value.
ImageConvolutionKernel(int size)
Creates an empty convolution kernel.
~ImageConvolutionKernel()
Destructor.
void applyToImage(Image &destImage, const Image &sourceImage, const Rectangle< int > &destinationArea) const
Applies the kernel to an image.
Retrieves a section of an image as raw pixel data, so it can be read or written to.
int pixelStride
The number of bytes between each pixel.
uint8 * getPixelPointer(int x, int y) const noexcept
Returns a pointer to a pixel in the image.
int lineStride
The number of bytes between each line.
uint8 * data
The raw pixel data, packed according to the image's pixel format.
Holds a fixed-size bitmap.
int getWidth() const noexcept
Returns the image's width (in pixels).
PixelFormat getFormat() const noexcept
Returns the image's pixel format.
int getHeight() const noexcept
Returns the image's height (in pixels).
Manages a rectangle and allows geometric operations to be performed on it.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also below a specified upper limit.
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.