我需要將單個位圖加載到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. 使用圖形加載圖像並將其旋轉到面板
- 2. 將圖像加載到附加元素
- 3. mfc將圖像加載到樹形控件的圖像列表
- 4. 使用picasso將圖像加載到imageview
- 5. 如何從文件加載圖像,然後將圖像加載到位圖?
- 6. 核心數據圖像不會加載到NSTableView圖像單元
- 7. 使用硒將圖像添加到Excel表單的單元格
- 8. 如何將圖像從url數組加載到圖像數組?
- 9. 如何將一堆圖像加載到QML中的圖像中?
- 10. 將圖像異步加載到tableview單元格中
- 11. 如何使用Phonegap將圖像加載到HTML5畫布上
- 12. 如何使用flex將圖像動態加載到TileList中?
- 13. 如何使用Python將圖像和標籤加載到image_data_layer?
- 14. RecyclerView加載方形圖像
- 15. 使用SDWebImage將圖像加載到UITableView單元時出現的問題
- 16. 如何選擇單選按鈕將圖像加載到imageView
- 17. 如何將圖像添加到dojo datagrid單元格
- 18. 如何將圖像添加到GWT中cellTable中的單元格
- 19. 如何通過stackview將圖像添加到tableview單元格
- 20. 使用通用圖像加載器加載圖像使用圖像路徑
- 21. 如何將加載文本/圖像添加到仍在使用jQuery加載的圖像中?
- 22. 根據從NSUserDefaults加載的對象將圖像加載到tableview單元格中
- 23. 如何添加圖像使用在加載圖像使用負載圖像使用LoadResPicture vb6
- 24. 如何使用AS2將庫中的圖像加載到加載程序組件?
- 25. 如何使用Axlsx gem將圖像添加到表格單元格中?
- 26. 如何使用jQuery預加載圖像
- 27. 如何使用fabric.js加載TIFF圖像?
- 28. 如何將圖像添加到視圖
- 29. 如何將圖像添加到位圖
- 30. 使用Picasso將圖像加載到位圖
是否有任何代碼 – 2014-10-29 04:22:13