Files
Sprinter-SDCC/tests/bgitest/bgitest.c
T
snark13 dc37a14010 libc: BGI Фаза 2c — floodfill/pieslice/sector
floodfill — скан-строчная заливка области до границы (self-bracket
чтение: корректно, но медленно; raw-оптимизация в TODO).
pieslice/sector — залитые сектора круга/эллипса: границу (центр→дуга→
центр) прогоняем через _bgi_poly_edge и заливаем min/max по строкам,
как fillpoly (для >180° возможен перелив — упрощение). Проверено в
MAME (tests/bgitest): floodfill круга, круговая диаграмма, штрих-сектор.

Доки/справочник/память обновлены (Ф2a-c готовы; Ф2d = images/viewport/
text-style/line-style — осталось).

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

48 lines
1.2 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).
* Фаза 2c: floodfill + pieslice/sector.
*/
#include <graphics.h>
int main(void)
{
int mx, my;
initgraph();
mx = getmaxx();
my = getmaxy();
cleardevice();
setcolor(WHITE);
rectangle(0, 0, mx, my);
setcolor(YELLOW);
outtextxy(96, 6, "BGI flood + pie");
/* Окружность-контур, затем floodfill её нутра. */
setcolor(YELLOW);
circle(66, 90, 46);
setfillstyle(SOLID_FILL, LIGHTRED);
floodfill(66, 90, YELLOW);
setcolor(WHITE);
outtextxy(38, 142, "floodfill");
/* Круговая диаграмма из трёх pieslice. */
setfillstyle(SOLID_FILL, LIGHTGREEN);
pieslice(210, 86, 0, 90, 52);
setfillstyle(SOLID_FILL, LIGHTBLUE);
pieslice(210, 86, 90, 200, 52);
setfillstyle(SOLID_FILL, LIGHTMAGENTA);
pieslice(210, 86, 200, 360, 52);
setcolor(WHITE);
outtextxy(184, 146, "pieslice");
/* Эллиптический сектор со штриховкой. */
setfillstyle(HATCH_FILL, LIGHTCYAN);
sector(120, 210, 20, 160, 90, 34);
setcolor(WHITE);
outtextxy(96, 236, "sector");
for (;;) { }
}