momento/src/transition/fade.c

52 lines
951 B
C
Raw Permalink Normal View History

2021-04-09 15:11:00 +02:00
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright (C) 2021 KikooDX */
#include "transition.h"
2021-04-30 02:16:11 +02:00
#include "util.h"
2021-04-20 12:49:55 +02:00
#include "zxcolors.h"
2021-04-09 15:11:00 +02:00
#include <gint/display.h>
void
hfade_in(float step, color_t color)
{
int line = isquare(step) * DWIDTH;
int x;
2021-04-20 12:49:55 +02:00
drect(line, 0, DWIDTH, DHEIGHT, ZX_BLACK);
for (x = line; x < line + 2; x += 1) {
dvline(x, color);
}
}
void
hfade_out(float step, color_t color)
{
int line = square(step) * DWIDTH;
int x;
2021-04-20 12:49:55 +02:00
drect(0, 0, line, DHEIGHT, ZX_BLACK);
for (x = line - 2; x < line; x += 1) {
dvline(x, color);
}
}
void
vfade_in(float step, color_t color)
2021-04-09 15:11:00 +02:00
{
int line = isquare(step) * DHEIGHT;
2021-04-09 15:18:32 +02:00
int y;
2021-04-20 12:49:55 +02:00
drect(0, line, DWIDTH, DHEIGHT, ZX_BLACK);
2021-04-09 15:18:32 +02:00
for (y = line; y < line + 2; y += 1) {
dhline(y, color);
}
2021-04-09 15:11:00 +02:00
}
void
vfade_out(float step, color_t color)
2021-04-09 15:11:00 +02:00
{
int line = square(step) * DHEIGHT;
2021-04-09 15:18:32 +02:00
int y;
2021-04-20 12:49:55 +02:00
drect(0, 0, DWIDTH, line, ZX_BLACK);
2021-04-09 15:18:32 +02:00
for (y = line - 2; y < line; y += 1) {
dhline(y, color);
}
2021-04-09 15:11:00 +02:00
}