;//n size
nh: = img_src.Picture.Height;
img_des.Picture.Bitmap.Width: = nw ;//set n size
img_des.Picture.Bitmap.Height: = nh;
img_pbar.Max: = nh +1 ;//set progressbar
ncolor: = frm_optsimgcopy.Shape1.Brush.Color;
np1: = frm_optsimgcopy.ComboBox1.ItemIndex;
np2: = frm_optsimgcopy.ComboBox2.ItemIndex;
np3: = frm_optsimgcopy.ComboBox3.ItemIndex;
for xn: = 0 to 4 do begin
xmm_0 [xn * 3 +0]: = GetBValue (ncolor) ;//blue
xmm_0 [xn * 3 +1]: = GetGValue (ncolor) ;//green
xmm_0 [xn * 3 +2]: = GetRValue (ncolor) ;//red
end;
asm
push eax
push ebx
push ecx
push edx
movups xmm1, xmm_0
end;
for ny: = 0 to (nh-1) do begin
citm: = img_src.Picture.Bitmap.ScanLine [ny];
nx: = 0;
while (nx <= nw) do begin
FillChar (xmm_0, 16,0) ;//clear
for nn: = 0 to 4 do begin
if ((nx + nn) <= nw) then begin
xmm_0 [nn * 3 +0]: = citm.b;
xmm_0 [nn * 3 +1]: = citm.g;
xmm_0 [nn * 3 +2]: = citm.r;
end else break ;//if
inc (citm);
end ;//for
asm// write, make, read
movups xmm0, xmm_0
andps xmm0, xmm1// multiply color's
movups xmm_0, xmm0
end ;//asm
for nn: = 0 to 4 do begin
if (nx <= nw) then
img_des.Canvas.Pixels [nx, ny]: = rgb (xmm_0 [nn * 3 + np3], xmm_0 [nn * 3 + np2], xmm_0 [nn * 3 + np1])
else break;
inc (nx);
end ;//for
end ;//while ...
img_pbar.StepBy (1);
end ;//for ...
asm
pop edx
pop ecx
pop ebx
pop eax
end;
end ;//if ...
img_pbar.Max: = 0;
timebefore: = MilliSecondOfTheHour (Now)-timebefore;
Label1.Caption: = format ('% d % S ', [timebefore, delay_names]);
img_log.Lines.Add (format ('make action = "copy image" at = "% d" milliseconds ', [timebefore]));
end;
end;
// ініціалізація операцій
procedure Tfrm_img.FormCreate (Sender: TObject);
begin
img_errmsg [0]: = tstringlist.create ;//error msg
img_errmsg [0]. Add ('Зображення занадто велике. ') ;//err maxsize image
img_errmsg [0]. Add (format ('Максимальний розмір не повинен перевищувати% d. ', [MAX_imageSize]));
img_errmsg [0]. Add ('Спробуйте вибрати інше. ');
img_tabs.ActivePage: = img_tab1 ;//page
Label1.Caption: = format ('0 % S ', [delay_names]);
end;
// прибирання сміття
procedure Tfrm_img.FormDestroy (Sender: TObject);
begin
img_errmsg [0]. Free;
end;
// Гаусове розмиття з застосуванням розширення SSE
procedure Tfrm_img.act_effBlurGauseExecute (Sender: TObject);
var
b: TBitmap;
fticks: Cardinal;
begin
if (frm_imgbluropts.ShowModal = mrYes) then begin
fticks: = MilliSecondOfTheDay (Now);
img_des.Picture.LoadFromFile (img_OpenPictureDialog.FileName);
GBlur (img_des.Picture.Bitmap, frm_imgbluropts.ComboBox1.ItemIndex, True);
fticks: = MilliSecondOfTheDay (Now)-fticks;
img_log.lines.add (format ('make action = "copy blur SSE" at = "% d" milliseconds ', [fticks]));
Label1.Caption: = format ('% d % S ', [fticks, delay_names]);
end;
end;
// зберегти результат
procedure Tfrm_img.act_desSaveImageExecute (Sender: TObject);
begin
if (Img_SavePictureDialog.Execute) then begin
img_des.Picture.SaveToFile (img_SavePictureDialog.FileName);
end;
end;
// центрувати результат
procedure Tfrm_img.act_desCenterImgExecute (Sender: TObject);
begin
with (sender as taction) do begin
img_des.Center: = Checked;
end;
end;
// розтягнути результат
procedure Tfrm_img.act_desStrechImgExecute (Sender: TObject);
begin
with (sender as taction) do begin
img_des.Stretch: = Checked;
end;
end;
// центрувати джерело
procedure Tfrm_img.act_srcCenterImgExecute (Sender: TObject);
begin
with (sender as taction) do begin
img_src.Center: = Checked;
end;
end;
// розтягнути джерело
procedure Tfrm_img.act_srcStrechImgExecute (Sender: TObject);
begin
with (sender as taction) do begin
img_src.Stretch: = Checked;
end;
end;
// Гаусове розмиття без SSE (просте)
procedure Tfrm_img.act_effBlurGauseNoSSEExecute (Sender: TObject);
var
b: TBitmap;
fticks: Cardinal;
begin
if (Frm_imgbluropts.ShowModal = mrYes) then...