Диаграммы
This commit is contained in:
24
Report/lab2/newuml/dz-a1-grayscale-activity.puml
Normal file
24
Report/lab2/newuml/dz-a1-grayscale-activity.puml
Normal 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
|
||||
Reference in New Issue
Block a user