Сохранение и выдача изображений




 

Функция ImageSize. Возвращает размер памяти в байтах, необходимый для размещения прямоугольного фрагмента изображения. Заголовок:

Function ImageSize(X1, Y2, X2, Y2: Integer): Word;

Здесь X1..Y2 – координаты левого верхнего(X1,Y1) и правого нижнего(X2,Y2) углов фрагмента изображения.

Процедура GetImage. Помещает в память копию прямоугольного фрагмента изображения. Заголовок:

Procedure GetImage(X1, Y1, X2, Y2: Integer; var Buf);

Здесь X1..Y2 – координаты углов фрагмента изображения; Buf – переменная или участок кучи, куда будут помещена копия видеопамяти с фрагментом изображения.

Размер Buf должен быть не меньше значения, возвращаемого функцией ImageSize с теме же координатами X1..Y2.

Процедура PutImage. Выводит в заданное место экрана копию фрагмента изображения, ранее помещенную в память процедурой GetImage. Заголовок:

Procedure PutImage(X, Y: Integer; var Buf; Mode: Word);

Здесь X, Y –координаты левого верхнего угла того места на экране, куда будет скопирован фрагмент изображения; Buf – переменная или участок кучи, откуда берется изображение; Mode – способ копирования.

Как видим, координаты правого нижнего угла не указываются, так как они полностью определяются размерами вновь выводимой на экран копии изображения. Координаты левого верхнего угла могут быть какими угодно, лишь бы только выводимая копия уместилась в пределах экрана(если копия не сможет разместиться на экране, она не выводится и экран остается без изменений).

Параметр Mode определяет способ взаимодействия вновь размещаемой копии уже имеющимся на экране изображением. Взаимодействие осуществляется путем применения кодируемых этим параметром логических операций к каждому биту копии и изображения.

 

2. ЛИСТИНГ ПРОГРАММЫ

 

Program Brodvey;

 

Uses Graph,Crt;

Var i, a, y, x: integer;

 

procedure init;

var gD, gM, EC:integer;

begin gD:=detect;

InitGraph(gD, gM, '');

end;

begin init;

 

SetColor(1);

Line(520,0,0,192);

Line(530,0,0,210);

SetFillStyle(1,8);

FloodFill(525,0,1);

Line(550,0,0,450);

Line(565,0,0,600);

SetFillStyle(1,0);

FloodFill(540,0,1);

SetFillStyle(1,10);

FloodFill(555,0,1);

Line(800,0,0,1700);

SetFillStyle(9,10);

FloodFill(555,0,1);

SetFillStyle(1,8);

FloodFill(570,0,1);

SetFillStyle(9,2);

FloodFill(630,400,1);

Line(0,100,90,100);

LIne(90,100,90,158);

SetFillStyle(1,4);

FloodFill(2,120,1);

Line(5,105,20,105);

Line(5,105,5,115);

Line(20,105,20,115);

Line(5,115,20,115);

SetFillStyle(1,14);

FloodFill(7,110,1);

Line(40,105,55,105);

Line(40,105,40,115);

Line(55,105,55,115);

Line(40,115,55,115);

SetFillStyle(1,14);

FloodFill(45,110,1);

Line(70,105,85,105);

Line(70,105,70,115);

Line(85,105,85,115);

Line(70,115,85,115);

SetfillStyle(1,14);

FloodFill(80,110,1);

Line(5,130,20,130);

Line(5,130,5,140);

Line(20,130,20,140);

Line(5,140,20,140);

SetFillStyle(1,14);

FloodFill(7,135,1);

Line(40,130,55,130);

Line(40,130,40,140);

Line(55,130,55,140);

Line(40,140,55,140);

SetFillStyle(1,14);

FloodFill(45,135,1);

Line(70,130,85,130);

Line(70,130,70,140);

Line(85,130,85,140);

Line(70,140,85,140);

SetFillStyle(1,14);

FloodFill(75,135,1);

Line(0,60,40,60);

Line(40,60,40,100);

SetFillStyle(1,5);

FloodFill(5,65,1);

Line(5,70,15,70);

Line(5,70,5,80);

line(15,70,15,80);

Line(5,80,15,80);

SetfillStyle(1,14);

FloodFill(10,75,1);

Line(25,70,35,70);

Line(35,70,35,80);

Line(25,70,25,80);

Line(25,80,35,80);

SetFillStyle(1,14);

FloodFill(30,75,1);

Line(0,15,55,15);

Line(55,15,55,100);

SetFillStyle(1,6);

FloodFill(10,20,1);

Line(5,40,15,40);

Line(5,40,5,55);

Line(15,40,15,55);

Line(5,55,15,55);

SetFillStyle(1,14);

FloodFill(10,45,1);

Line(25,40,35,40);

Line(25,40,25,55);

Line(35,40,35,55);

Line(25,55,35,55);

SetFillStyle(9,8);

FloodFill(30,45,1);

Line(45,40,55,40);

Line(45,40,45,55);

Line(55,40,55,55);

Line(45,55,55,55);

SetFillStyle(1,14);

FloodFill(50,45,1);

Line(60,45,70,45);

Line(60,45,60,60);

Line(70,45,70,60);

Line(60,60,70,60);

Setfillstyle(1,14);

Floodfill(65,50,1);

Line(90,45,100,45);

Line(90,45,90,60);

Line(100,45,100,60);

Line(90,60,100,60);

SetFillstyle(1,14);

FloodFill(95,50,1);

Line(90,80,90,90);

Line(90,90,105,90);

Line(105,80,105,90);

Line(90,80,105,80);

SetFillStyle(1,14);

FloodFill(95,85,1);

line(70,80,70,90);

line(70,80,55,80);

Line(55,80,55,90);

Line(55,90,70,90);

SetFillStyle(9,8);

FloodFill(59,85,1);

Line(120,90,120,110);

Line(120,110,135,110);

Line(135,110,135,90);

Line(120,90,135,90);

SetFillStyle(1,14);

FloodFill(125,95,1);

Rectangle(155,90,170,110);

SetFillStyle(1,14);

FloodFill(165,95,1);

Rectangle(190,60,200,70);

SetFillStyle(1,14);

FloodFill(195,65,1);

Rectangle(210,60,220,70);

SetFillStyle(1,14);

FloodFill(215,65,1);

Rectangle (230,60,240,70);

SetFillStyle(1,14);

FloodFill(235,65,1);

Rectangle(190,80,200,90);

SetFillStyle(1,14);

FloodFill(195,85,1);

Rectangle(210,80,220,90);

SetFillStyle(1,14);

FloodFill(215,85,1);

Rectangle(230,80,240,90);

SetFillStyle(1,14);

FloodFill(235,85,1);

Rectangle(205,30,230,35);

SetFillStyle(1,14);

FloodFill(210,32,1);

Rectangle(240,30,255,35);

SetFillStyle(9,8);

FloodFill(245,32,1);

Rectangle(265,30,290,35);

SetFillStyle(1,14);

FloodFill(270,32,1);

Rectangle(300,30,325,35);

SetFillStyle(1,14);

FloodFill(310,32,1);

Rectangle(265,40,290,45);

SetFillStyle(1,14);

FloodFill(270,42,1);

Rectangle(300,40,325,45);

SetFillStyle(9,8);

FloodFill(310,42,1);

Rectangle(265,50,290,55);

SetFillStyle(1,14);

FloodFill(270,52,1);

Rectangle(300,50,325,55);

SetFillStyle(1,14);

FloodFill(310,52,1);

Rectangle(300,60,325,65);

SetFillStyle(1,14);

FloodFill(310,62,1);

Rectangle(265,60,290,65);

SetFillStyle(1,14);

FloodFill(270,62,1);

Rectangle(360,50,365,55);

SetFillStyle(9,8);

FloodFill(362,52,1);

Rectangle(360,40,365,45);

SetFillStyle(1,14);

FloodFill(362,42,1);

Rectangle(370,45,375,40);

SetFillStyle(1,14);

FloodFill(372,42,1);

Rectangle(360,30,365,35);

SetFillStyle(1,14);

FloodFill(362,31,1);

Rectangle(370,30,375,35);

SetFillStyle(1,14);

FloodFill(372,32,1);

Rectangle(390,25,395,30);

SetFillStyle(9,8);

FloodFill(392,28,1);

Rectangle(390,15,395,20);

SetFillStyle(1,14);

FloodFill(392,17,1);

Rectangle(375,15,380,20);

SetFillStyle(1,14);

FloodFill(378,17,1);

Rectangle(405,30,410,35);

SetFillStyle(1,14);

FloodFill(407,32,1);

Rectangle(415,30,420,35);

SetFillStyle(1,14);

FloodFill(418,32,1);

Rectangle(405,20,410,25);

SetFillStyle(9,8);

FloodFill(408,22,1);

Rectangle(415,20,420,25);

SetFillStyle(1,14);

FloodFill(418,22,1);

Rectangle(435,10,450,15);

SetFillStyle(1,14);

FloodFill(445,12,1);

Rectangle(435,20,450,25);

SetFillStyle(1,14);

FloodFill(440,22,1);

Line(55,30,110,30);

Line(110,30,110,150);

SetFillStyle(1,9);

FloodFill(60,35,1);

Line(75,10,125,10);

Line(125,10,125,72);

Line(75,10,75,32);

SetFillStyle(1,11);

FloodFill(110,25,1);

Line(110,70,180,70);

Line(180,70,180,125);

SetFillStyle(1,13);

FloodFill(125,85,1);

Line(180,55,250,55);

Line(180,55,180,70);

Line(250,55,250,100);

SetFillStyle(1,6);

FloodFill(185,65,1);

Line(165,70,165,15);

line(165,15,350,15);

Line(350,15,350,62);

SetFillStyle(1,12);

FloodFill(205,65,1);

Line(300,10,300,15);

Line(300,10,335,10);

Line(335,10,335,15);

SetFillStyle(1,10);

FloodFill(325,12,1);

Line(350,25,380,25);

Line(380,25,380,52);

SetFillStyle(1,4);

FloodFill(370,26,1);

Line(370,10,370,25);

Line(370,10,400,10);

Line(400,10,400,45);

SetFillStyle(1,15);

FloodFill(386,29,1);

Line(400,15,430,15);

Line(430,15,430,34);

SetFillStyle(1,9);

FloodFill(425,25,1);

Line(415,15,415,5);

Line(415,5,470,5);

Line(470,5,470,19);

SetFillStyle(1,6);

FloodFill(425,8,1);

Line(470,2,485,2);

Line(470,2,470,5);

Line(485,2,485,12);

SetFillStyle(1,10);

FloodFill(478,4,1);

Line(290,360,290,210);

Line(290,212,410,120);

Line(290,300,410,170);

Line(410,120,410,170);

SetFillstyle(1,3);

FloodFill(300,250,1);

SetfillStyle(1,3);

FloodFill(291,298,1);

Line(400,300,440,170);

Ellipse(425,194,55,120,27,28);

Ellipse(345,376,53,125,95,95);

Line(400,300,400,360);

Ellipse(345,375,12,158,58,58);

SetFillStyle(1,9);

FloodFill(295,310,1);

Line(440,170,440,200);

Ellipse(430,210,36,87,15,15);

SetFillStyle(1,9);

FloodFill(438,180,1);

SetFillStyle(1,3);

FloodFill(420,180,1);

Line(0,290,60,260);

Line(100,240,150,215);

Line(200,190,260,160);

Line(290,148,333,128);

Line(370,100,400,85);

Line(420,73,440,63);

Line(470,45,490,35);

SetFillStyle(10,15);

FloodFill(400,2,1);

Line(280,112,330,90);

Ellipse(335,110,350,100,20,20);

ellipse(294,150,110,150,40,40);

line(355,115,350,120);

circle(342,125,10);

SetFillStyle(9,8);

FloodFill(342,125,1);

Line(260,130,240,140);

Line(260,130,280,130);

Line(280,130,335,105);

Line(280,130,285,120);

Line(285,120,266,120);

Line(285,120,333,98);

Arc(332,102,270,90,4);

Line(240,150,270,150);

Line(240,140,270,140);

Line(270,140,353,102);

SetFillStyle(1,5);

FloodFill(338,102,1);

Ellipse(248,152,165,23,8,8);

SetFillStyle(9,8);

FloodFill(248,154,1);

Circle(280,152,10);

SetFillStyle(9,8);

FloodFill(280,152,1);

arc(240,145,90,270,5);

SetFillStyle(1,7);

FloodFill(240,145,1);

SetColor(6);

Line(435,230,370,240);

Line(440,215,390,230);

Line(435,230,435,300);

Line(425,240,370,260);

Line(425,240,425,300);

Line(425,300,435,300);

Line(435,295,440,295);

Line(440,215,440,295);

Line(391,230,351,185);

Line(328,200,355,185);

Ellipse(365,210,160,290,33,50);

Line(340,185,340,193);

Circle(340,178,10);

SetFillStyle(1,6);

FloodFill(340,178,6);

Line(352,188,390,135);

Line(355,190,390,140);

Line(390,140,390,135);

Line(335,200,288,210);

Line(335,205,288,215);

SetFillStyle(8,1);

FloodFill(353,189,6);

SetFillStyle(1,1);

FloodFill(380,152,6);

Line(288,210,280,178);

Line(288,215,275,185);

Line(275,185,280,178);

SetFillStyle(1,1);

FloodFill(277,185,6);

SetColor(0);

Ellipse(395,200,0,360,5,3);

Line(390,200,390,210);

Line(400,200,400,210);

SetFillStyle(9,6);

FloodFill(395,200,0);

Arc(395,208,150,0,5);

SetFillStyle(1,7);

FloodFill(395,208,0);

SetColor(1);

Line(500,100,500,400);

Line(520,100,520,400);

Ellipse(510,100,0,200,10,10);

Ellipse(510,396,200,0,10,10);

SetFillStyle(1,6);

FloodFill(513,105,1);

Ellipse(485,130,10,160,25,25);

Ellipse(535,115,19,160,25,25);

Ellipse(460,138,10,170,16,16);

Ellipse(460,138,160,8,15,8);

SetFillstyle(1,14);

FloodFill(463,140,1);

begin

Ellipse(560,122,10,170,16,16);

Ellipse(560,122,160,8,15,8);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,0);

FloodFill(562,125,1);

Delay(30000);

SetFillStyle(1,14);

FloodFill(562,125,1);

Delay(30000);

 

 

repeat until keypressed;

closegraph;

 

end;

end.

 

ЗАКЛЮЧЕНИЕ

 

 

В данной курсовой работе описываются различные процедуры и функции, предназначенные для создания графических объектов в Турбо Паскале.

Используя выше перечисленные процедуры и функции, автор научился изображать различные фигуры различных форм и размеров, так же смог показать движение фигуры.

Написав данную программу, автор получил навык работы в графической среде Турбо Паскаль, научился правильно применять разные процедуры и функции, точно определять и задавать координаты различных линий, эллипсов, окружностей, прямоугольников и т.д.

 

СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ

 

 

1. Информатика(Базовый курс) С. В. Симонович, СПб: Питер, 2001г.

2. Основы языка Turbo Pascal(учебный курс), П. И. Рудаков, М. А. Федотов, Москва: Радио и Связь, 2000г.

3. Основы программирования в задачах и примерах, А. В. Милов, Харьков: ФОЛИО, 2002г.

4. Программирование. С. Симонович, Г. Евсеев, Москва: АСТ – ПРЕСС книга 2000г.

5. Практика программирования, Ю. Кетков, А. Кетков, СПб: БХБ/ Петербург, 2002г.

6. Turbo Pascal/ С. А. Немнюгин.- СПб: Издательство «Питер», 2001.-496 с.:ил.

7. Turbo Pascal: учитесь программировать, О. А. Меженный, Москва: изд.дом «Вильямс», 2001г

 

 



Поделиться:




Поиск по сайту

©2015-2024 poisk-ru.ru
Все права принадлежать их авторам. Данный сайт не претендует на авторства, а предоставляет бесплатное использование.
Дата создания страницы: 2020-03-31 Нарушение авторских прав и Нарушение персональных данных


Поиск по сайту: