Move pointillism points array to src

This commit is contained in:
GriffinR
2021-03-18 17:26:56 -04:00
committed by huderlem
parent 3cb9300744
commit 8eafe1fd4e
4 changed files with 3232 additions and 329 deletions

View File

@@ -51,7 +51,9 @@ static u16 QuantizePixel_GrayscaleSmall(u16*);
static u16 QuantizePixel_Grayscale(u16*);
static u16 QuantizePixel_PrimaryColors(u16*);
extern const u8 gPointillismPoints[][3];
#define MAX_DIMENSION 64
#include "data/pointillism_points.h"
void ApplyImageProcessingEffects(struct ImageProcessingContext *context)
{
@@ -169,7 +171,7 @@ static void ApplyImageEffect_RedChannelGrayscaleHighlight(u8 highlight)
static void ApplyImageEffect_Pointillism(void)
{
u32 i;
for (i = 0; i < 3200; i++)
for (i = 0; i < ARRAY_COUNT(sPointillismPoints); i++)
AddPointillismPoints(i);
}
@@ -307,9 +309,9 @@ static void ApplyImageEffect_Shimmer(void)
// First, invert all of the colors.
pixel = gCanvasPixels;
for (i = 0; i < 64; i++)
for (i = 0; i < MAX_DIMENSION; i++)
{
for (j = 0; j < 64; j++, pixel++)
for (j = 0; j < MAX_DIMENSION; j++, pixel++)
{
if (!IS_ALPHA(*pixel))
*pixel = QuantizePixel_Invert(pixel);
@@ -317,16 +319,16 @@ static void ApplyImageEffect_Shimmer(void)
}
// Blur the pixels twice.
for (j = 0; j < 64; j++)
for (j = 0; j < MAX_DIMENSION; j++)
{
pixel = &gCanvasPixels[j];
prevPixel = *pixel;
*pixel = RGB_ALPHA;
for (i = 1, pixel += 64; i < 63; i++, pixel += 64)
for (i = 1, pixel += MAX_DIMENSION; i < MAX_DIMENSION - 1; i++, pixel += MAX_DIMENSION)
{
if (!IS_ALPHA(*pixel))
{
*pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64);
*pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + MAX_DIMENSION);
prevPixel = *pixel;
}
}
@@ -335,11 +337,11 @@ static void ApplyImageEffect_Shimmer(void)
pixel = &gCanvasPixels[j];
prevPixel = *pixel;
*pixel = RGB_ALPHA;
for (i = 1, pixel += 64; i < 63; i++, pixel += 64)
for (i = 1, pixel += MAX_DIMENSION; i < MAX_DIMENSION - 1; i++, pixel += MAX_DIMENSION)
{
if (!IS_ALPHA(*pixel))
{
*pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64);
*pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + MAX_DIMENSION);
prevPixel = *pixel;
}
}
@@ -351,9 +353,9 @@ static void ApplyImageEffect_Shimmer(void)
// The above blur causes the outline areas to darken, which makes
// this inversion give the effect of light outlines.
pixel = gCanvasPixels;
for (i = 0; i < 64; i++)
for (i = 0; i < MAX_DIMENSION; i++)
{
for (j = 0; j < 64; j++, pixel++)
for (j = 0; j < MAX_DIMENSION; j++, pixel++)
{
if (!IS_ALPHA(*pixel))
*pixel = QuantizePixel_Invert(pixel);
@@ -408,19 +410,19 @@ struct PointillismPoint
u16 delta;
};
static void AddPointillismPoints(u16 arg0)
static void AddPointillismPoints(u16 point)
{
u8 i;
bool8 offsetDownLeft;
u8 colorType;
struct PointillismPoint points[6];
points[0].column = gPointillismPoints[arg0][0];
points[0].row = gPointillismPoints[arg0][1];
points[0].delta = (gPointillismPoints[arg0][2] >> 3) & 7;
points[0].column = sPointillismPoints[point][0];
points[0].row = sPointillismPoints[point][1];
points[0].delta = GET_POINT_DELTA(sPointillismPoints[point][2]);
colorType = (gPointillismPoints[arg0][2] >> 1) & 3;
offsetDownLeft = gPointillismPoints[arg0][2] & 1;
colorType = GET_POINT_COLOR_TYPE(sPointillismPoints[point][2]);
offsetDownLeft = GET_POINT_OFFSET_DL(sPointillismPoints[point][2]);
for (i = 1; i < points[0].delta; i++)
{
if (!offsetDownLeft)
@@ -434,7 +436,7 @@ static void AddPointillismPoints(u16 arg0)
points[i].row = points[0].row - 1;
}
if (points[i].column > 63 || points[i].row > 63)
if (points[i].column >= MAX_DIMENSION || points[i].row >= MAX_DIMENSION)
{
points[0].delta = i - 1;
break;
@@ -445,7 +447,7 @@ static void AddPointillismPoints(u16 arg0)
for (i = 0; i < points[0].delta; i++)
{
u16 *pixel = &gCanvasPixels[points[i].row * 64] + points[i].column;
u16 *pixel = &gCanvasPixels[points[i].row * MAX_DIMENSION] + points[i].column;
if (!IS_ALPHA(*pixel))
{
@@ -457,7 +459,7 @@ static void AddPointillismPoints(u16 arg0)
{
case 0:
case 1:
switch (((gPointillismPoints[arg0][2] >> 3) & 7) % 3)
switch (GET_POINT_DELTA(sPointillismPoints[point][2]) % 3)
{
case 0:
if (red >= points[i].delta)