02.02.2020, 06:49
|
Прохожий
|
|
Регистрация: 22.12.2018
Сообщения: 13
Версия Delphi: Delphi 14
Репутация: 10
|
|
Как определить цвет пикселя на картинке?
На форме TImage, добавлена картинка.
Код:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, pngimage, ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
Color: TColor;
begin
Image1.Picture.LoadFromFile('1.png');
Color:=Image1.Picture.Bitmap.Canvas.Pixels[10,10];
Showmessage(inttostr(Color));
end;
end.
|