momento/src/transition/fade.c

52 lines
951 B
C

/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright (C) 2021 KikooDX */
#include "transition.h"
#include "util.h"
#include "zxcolors.h"
#include <gint/display.h>
void
hfade_in(float step, color_t color)
{
int line = isquare(step) * DWIDTH;
int x;
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;
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)
{
int line = isquare(step) * DHEIGHT;
int y;
drect(0, line, DWIDTH, DHEIGHT, ZX_BLACK);
for (y = line; y < line + 2; y += 1) {
dhline(y, color);
}
}
void
vfade_out(float step, color_t color)
{
int line = square(step) * DHEIGHT;
int y;
drect(0, 0, DWIDTH, line, ZX_BLACK);
for (y = line - 2; y < line; y += 1) {
dhline(y, color);
}
}