我需要將單個位圖加載到Pascal程序,有沒有辦法做到這一點,或者我必須逐個像素地繪製圖像?如何使用圖形單元將圖像加載到Turbo Pascal
0
A
回答
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.
請參閱本作的詳細信息...
+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。
相關問題
- 1. Turbo Pascal BGI錯誤:圖形未初始化(使用InitGraph)
- 2. 使用圖形加載圖像並將其旋轉到面板
- 3. 將圖像加載到附加元素
- 4. Turbo Pascal,Capture Writeln使用流?
- 5. mfc將圖像加載到樹形控件的圖像列表
- 6. 使用picasso將圖像加載到imageview
- 7. 將圖像從字節數組加載到圖形視圖中
- 8. 如何將圖像(Blob)加載到Hbase
- 9. 如何從文件加載圖像,然後將圖像加載到位圖?
- 10. 通用圖像加載器 - 如何將第二個圖像加載到ImageView中?
- 11. 核心數據圖像不會加載到NSTableView圖像單元
- 12. 使用硒將圖像添加到Excel表單的單元格
- 13. 如何使用存根圖像,直到網頁加載圖像?
- 14. 使用JavaScript將圖像加載到圖像控件
- 15. 即使將圖像添加到RootPanel,也無法加載圖像?
- 16. 如何將一堆圖像加載到QML中的圖像中?
- 17. 如何在wpf中將圖像加載到圖像控件?
- 18. 如何將圖像加載到c#中的圖像控件?
- 19. 如何將圖像從url數組加載到圖像數組?
- 20. 如何在Visual Studio中使用C將圖像加載到PictureBox中的圖像#
- 21. 使用圖像選取器將圖像加載到兩個集合視圖單元格
- 22. 將圖像異步加載到tableview單元格中
- 23. 如何使用動態尺寸將圖像蒙版到圖形?
- 24. 將圖像從解析圖像加載到圖像視圖
- 25. 如何使用ios上的Phonegap將圖像加載到html5上
- 26. 如何使用flex將圖像動態加載到TileList中?
- 27. 如何使用Phonegap將圖像加載到HTML5畫布上
- 28. 如何使用Python將圖像和標籤加載到image_data_layer?
- 29. 使用SDWebImage將圖像加載到UITableView單元時出現的問題
- 30. RecyclerView加載方形圖像
是否有任何代碼 – 2014-10-29 04:22:13