Files
Sprinter-SDCC/tests/bgitest/bgitest.c
T
snark13 ecb419efda libc: BGI Фаза 2b — заливки (setfillstyle/bar/bar3d/fillpoly/fillellipse)
setfillstyle/getfillsettings + 10 стандартных 8×8 паттернов Borland.
bar теперь честно учитывает стиль заливки; bar3d (3D-брусок), fillpoly
(scanline min/max по строкам через брезенхэмовский проход рёбер),
fillellipse (полуширина строки через целочисленный _bgi_isqrt — без
32-бит). Общий _bgi_fill_span (SOLID/EMPTY/паттерн) с клипом, поверх
raw-hline в одной W3-скобке. Проверено в MAME (tests/bgitest): solid/
hatch бары, bar3d со slash, синий fillellipse, xhatch-треугольник.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 15:58:06 +03:00

59 lines
1.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* bgitest — демонстрация BGI-слоя graphics.h (режим 320×256×256).
*
* Собирается с `--gfx 256`. Фаза 2b: заливки — bar (сплошная/паттерн),
* bar3d, fillpoly, fillellipse + setfillstyle. Визуальная проверка.
*/
#include <graphics.h>
int main(void)
{
int mx, my;
static const int tri[] = { 210, 235, 300, 235, 255, 150 };
initgraph();
mx = getmaxx();
my = getmaxy();
cleardevice();
setcolor(WHITE);
rectangle(0, 0, mx, my);
setcolor(YELLOW);
outtextxy(110, 6, "BGI FILLS P2b");
/* Сплошной бар. */
setfillstyle(SOLID_FILL, RED);
bar(12, 28, 92, 78);
setcolor(WHITE);
outtextxy(12, 82, "solid");
/* Бар с штриховкой (HATCH). */
setfillstyle(HATCH_FILL, LIGHTGREEN);
bar(110, 28, 190, 78);
setcolor(WHITE);
outtextxy(110, 82, "hatch");
/* 3D-брусок с диагональной штриховкой. */
setcolor(WHITE);
setfillstyle(SLASH_FILL, LIGHTCYAN);
bar3d(210, 34, 280, 78, 14, 1);
outtextxy(210, 82, "bar3d");
/* Залитый эллипс (сплошной). */
setcolor(WHITE);
setfillstyle(SOLID_FILL, LIGHTBLUE);
fillellipse(70, 150, 55, 32);
outtextxy(44, 186, "fillellipse");
/* Залитый треугольник (крестовая штриховка), контур WHITE. */
setcolor(WHITE);
setfillstyle(XHATCH_FILL, LIGHTMAGENTA);
fillpoly(3, tri);
outtextxy(214, 194, "fillpoly");
for (;;) { }
}