10.12-rasm. Picture Editor oynasi
10.13-rasm. Slayd-proyektor
10.6-listing. Slayd-proyektor
unit shpic_;
interface
uses
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Menu
type
TForm1 = class(TForm) Image1: ТImage;
Button1: TButton;
procedure FormActivate(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
aSearchRec : TSearchRec;
aPath : String; // illyustratsiya joylashgan katalog
aFile : String; // illyustratsiya fayli
iw,ih: integer; // Image komponentining boshlag’ich o’lchami
implementation
$R *.DFM}
// illyustratsiya chiquvchi sohaning o’lchamini
// illyustratsiya o’lchamiga proporsional ravishda o’zgarishi
Procedure Scalelmage;
var
pw, ph : integer; // illyustratsiya o’lchami
scaleX, scaleY : real; // X va Y bo’yicha mas’shtab
scale : real; // umumiy mas’shtab
begin
// Illyustratsiya yuklangan
// uning o’lchamlarini olamiz
pw := Form1.Image1.Picture.Width;
ph := Form1.Image1.Picture.Height;
if pw > iw // illyustratsiya kengligi Image komponentining kengligidan katta
then scaleX := iw/pw // mas’shtablash kerak
else scaleX := 1;
if ph > ih // illyustratsiya balandligi Image komponentining balandligidan katta
then scaleY := ih/ph // mas’shtablash kerak
else scaleY := 1;
// eng kichil koeffietsentni tanlaymiz
if scaleX < scaleY
then scale := scaleX
else scale := scaleY;
// illyustratsiya chiquvchi soha o’lchamini o’zgartiramiz
Form1.Image1.Height := Round(Form1.Image1.Picture.Height*scale)
Form1.Image1.Width := Round(Form1.Image1.Picture.Width*scale);
Do'stlaringiz bilan baham: |