我需要将单个位图加载到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