IPB
ЛогинПароль:

> Правила раздела!

1. Заголовок или название темы должно быть информативным !
2. Все тексты фрагментов программ должны помещаться в теги [code] ... [/code] или [code=pas] ... [/code].
3. Прежде чем задавать вопрос, см. "FAQ" и используйте ПОИСК !
4. НЕ используйте форум для личного общения!
5. Самое главное - это раздел теоретический, т.е. никаких задач и программ (за исключением небольших фрагментов) - для этого есть отдельный раздел!

> graphics output
turbo7
сообщение 17.11.2003 13:11
Сообщение #1


Гость






I have a program that outputs some graphics to screen using graph.tpu(plot,dots, thise sort of things). I need to print thise output. Is there some way to output graphics to file?
 К началу страницы 
+ Ответить 
 
 Ответить  Открыть новую тему 
Ответов
GLuk
сообщение 24.11.2003 21:26
Сообщение #2


Профи
****

Группа: Пользователи
Сообщений: 775
Пол: Мужской

Репутация: -  0  +


Оооо, вот и по-русски научился!  ;)

Для записи сгенеренного тобой растра в файл нужно всего лишь добавить несколько строк (выделены слэшами):

Код

uses crt,graph;
var
  i,j,n,x0,y0,xend,yend,xbeg,ybeg,grd,grm:integer;
  temp,sumx,sumxx,sumy,sumyy,sumxy,a,al,bl:real;
  x,y: array[1..500] of integer;
\\\\\\\\\\\\\\
  P:Pointer;
  Sz:Word;
  F:File;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
begin
clrscr;
grD:= Detect;
InitGraph(grD, grM,' ');
randomize;
n:=200;
sumx:=0;
sumxx:=0;
sumy:=0;
sumyy:=0;
sumxy:=0;
{imitation of sample group}
for i:=1 to n do begin
x[i]:=random(170)+1;
y[i]:=random(150);
end;
for i:=1 to n do begin
sumx:=sumx+x[i];
sumy:=sumy+y[i];
sumxx:=sumxx+x[i]*x[i];
sumyy:=sumyy+y[i]*y[i];
sumxy:=sumxy+x[i]*y[i];
end;
A:=n*sumxx-sqr(sumx);
al:=1/a*(n*sumxy-sumy*sumx);
bl:=1/a*(sumxx*sumy-sumxy*sumx);
outtext('the minimum square method');
y0:=gety+250;
x0:=getx-100;
line(x0,y0,x0+200,y0);
line(x0,y0,x0,y0-200);
outtextxy(x0-15,y0-180,'y');
outtextxy(x0+180, y0+10, 'x');
for i:=1 to n do
putpixel(x[i]+x0,-y[i]+y0, magenta);
xbeg:=x0;
ybeg:=y0-round(bl);
xend:=x0+170; {the biggest value of x that can be}
yend:=y0-round(al*xend+bl);
line(xbeg,ybeg,xend,yend);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Sz:=ImageSize(0,0,300,280);
GetMem(P,Sz);
GetImage(0,0,300,280,P^);
Assign(F,'image.dat');
ReWrite(F,1);
BlockWrite(F,P^,Sz);
Close(F);
{-------------------------}
Assign(F,'image.dat');
Reset(F,1);
BlockRead(F,P^,Sz);
SetTextStyle(TriplexFont,HorizDir,4);
OutTextXY(30,300,'Save image to file...press any key');
ReadLn;
ClearDevice;
PutImage(30,20,P^,1);
OutTextXY(30,300,'Image was read from file...');
FreeMem(P,Sz);
readln;
end.
\\\\\\\\\\\\\\



P.S.: А номер видеорежима это и есть номер видеорежима; каждый режим типа характеризуется своим разрешением, глубиной цвета, графический или текстовый и все такое...
 Оффлайн  Профиль  PM 
 К началу страницы 
+ Ответить 

Сообщений в этой теме
turbo7   graphics output   17.11.2003 13:11
GLuk   Re: graphics output   17.11.2003 16:30
turbo7   Re: graphics output   19.11.2003 19:19
AlaRic   Re: graphics output   21.11.2003 18:56
JTG   Re: graphics output   22.11.2003 10:58
GLuk   Re: graphics output   22.11.2003 14:31
turbo7   Re: graphics output   24.11.2003 13:05
GLuk   -   24.11.2003 21:26
turbo7   Re: graphics output   29.11.2003 1:30
GLuk   Re: graphics output   29.11.2003 8:07
turbo7   Re: graphics output   2.12.2003 12:22
Булат Шакиров   Re: graphics output   2.12.2003 13:40
turbo7   Re: graphics output   5.12.2003 21:56
GLuk   Re: graphics output   8.12.2003 20:44


 Ответить  Открыть новую тему 
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 



- Текстовая версия 20.07.2025 16:01
Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"