Commit dfbd636b authored by Adrien Plazas's avatar Adrien Plazas Committed by Alexander Mikhaylenko
Browse files

nintendo-ds-cover-extract: Unround the corners

This unrounds the corners, using the adjacent color from the same row to
replace the transparent pixel.
parent 27976061
Pipeline #292657 passed with stage
in 127 minutes and 4 seconds
......@@ -110,6 +110,25 @@ load_icon (gchar *tile_data, guint16 *palette_data)
return pixbuf;
}
static void
unround_corners (GdkPixbuf *pixbuf)
{
struct palette_i *pixels = (struct palette_i *) gdk_pixbuf_get_pixels (pixbuf);
/* Top-left corner. */
if (pixels[0].a == 0 && pixels[1].a != 0 && pixels[32].a != 0)
pixels[0] = pixels[1];
/* Top-right corner. */
if (pixels[31].a == 0 && pixels[30].a != 0 && pixels[63].a != 0)
pixels[31] = pixels[30];
/* Bottom-left corner. */
if (pixels[992].a == 0 && pixels[993].a != 0 && pixels[960].a != 0)
pixels[992] = pixels[993];
/* Bottom-right corner. */
if (pixels[1023].a == 0 && pixels[1022].a != 0 && pixels[991].a != 0)
pixels[1023] = pixels[1022];
}
GdkPixbuf *
highscore_nintendo_ds_cover_extract (const char *uri,
GError **error)
......@@ -163,5 +182,7 @@ highscore_nintendo_ds_cover_extract (const char *uri,
palette_data = g_memdup2 (banner_data + PALETTE_DATA_OFFSET, PALETTE_DATA_LENGTH);
pixbuf = load_icon (tile_data, palette_data);
unround_corners (pixbuf);
return pixbuf;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment