Диаграммы

This commit is contained in:
2026-04-10 02:21:47 +03:00
parent 8580dbc199
commit 72db2c0a47
12 changed files with 252 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
@startuml dz-a1-grayscale-activity
title ДЗ.А1 — алгоритм ApplyGrayscale (по палитре документа)
start
:Вход: **MinintDocument doc**;
:i ← 1;
while (i < doc.Palette.Count?) is (да)
:c ← doc.Palette[i];
:Y ← 0.299×c.R + 0.587×c.G + 0.114×c.B + 0.5;
:gray ← (byte) Clamp((int)Y, 0, 255);
:doc.Palette[i] ← RgbaColor(gray, gray, gray, c.A);
:i ← i + 1;
endwhile (нет)
:doc.InvalidatePaletteCache();
stop
note right
Индекс палитры **0** (прозрачный) пропускается циклом.
Коэффициенты — типичная формула **яркости** (ITU-R BT.601).
end note
@enduml