2014-10-29 75 views

回答

0

通过使用图形单位,你可以加载涡轮帕卡尔BGI图形。

请参阅本作的详细信息...

http://pascal-programming.info/lesson8.php

这里是从上面的链接示例代码...

Program Lesson8_Program1; 
Uses Crt,Graph; 
Var GraphicsDriver, GraphicsMode, 
    ErrCode : Integer; 
    {two var's are needed for initialisation} 
Begin 
Writeln('Initialising Graphics, please wait...'); 
GraphicsDriver := Detect; 
InitGraph(GraphicsDriver, GraphicsMode,''); 
{IMPORTANT, read the following or 
    otherwise graphics will not work!! ;)} 
(*between the inverted commas, 
    type in the path of the graphics BGI file 
    (usually 'C:\TP\BGI'), 
    OR 
    change the dir in the file menu (PRESS Alt+F) 
    and roll down your mouse pointer to the 'change dir' 
    menu; then either type the path to the BGI file, 
    or go to C: -> TP -> BGI*) 
ErrCode := GraphResult; 
If GraphResult <> grOK then { <> means 'not equal to' } 
    Begin 
    ClrScr; 
    Writeln('Graphics error occured: ', 
      GraphErrorMsg(ErrCode)); 
    Writeln('If a file not found error is displayed above'); 
    Writeln('then, change the dir from the current'); 
    Writeln('location to C:\ -> TP -> BGI, '+ 
      +'from the file menu!'); 
    Readln; 
    Halt(1); 
    End Else 
    Begin 
    Randomize; 
    SetColor(Random(15) + 1); {Set text colour} 
    {Output text at 20 pixels from the top of the screen, 
    and 20 other from the left side of the screen.} 
    OutTextXY(20,20,'Welcome to the new generation 
        of Pascal Programming:'); 
    OutTextXY(20,30,'Pascal Graphics!!'); 
    OutTextXY(25,70,'You will learn more 
        graphics procedures and'); 
    OutTextXY(25,80,'functions, later in this lesson :-)'); 
    Readln; 
    End; 
CloseGraph; 
End. 

请参阅本作的详细信息...

http://pascal-programming.info/lesson8.php

+0

BGI文件不是图像,而是Borland图形接口的驱动程序。 – Fabel 2016-07-29 00:42:46

0

只要我记住ber,Turbo pascal有功能

GetImage(X1, Y1, X2, Y2: integer; var BitMap) 
PutImage(X, Y: integer; var BitMap; BitBlt: word); 

BitMap只是一块带有位图的内存块。这样你就可以从屏幕获取图像到内存,反之亦然。我认为从文件到屏幕没有直接的功能。但是如果光盘上的图像格式正确,则可以将其加载到内存中,然后使用PutImage。

相关问题