scanline

'Scanlines'
The word 'Scanline' has a slightly different meaning these days to the one I'm used to
I always took the word 'Scanline' to describe 1 physical horizontal display line on a monitor,
more often these days, when someone talks about a 'Scanline' they are referring to the
'Horizontal Retrace Interval',
or (in the case of emulators) faking a low scanrate horizontal retrace interval on a high scanrate monitor

To show you what I mean, here's a simplified diagram of how an image is created on any raster monitor

 http://www.mameworld.net/pc2jamma/images/scan.GIF
 
 In the above diagram the black lines show the 'active' part of the display
(i.e. when the electron guns are on)
and the grey lines show when the electron guns are inactive and sweeping back
in readiness to display the next line of the image
(The grey lines represent the Horizontal Retrace Interval or Horizontal Blanking)

The most important thing to remember is that the speed of the electron guns sweeping across the display
are governed by the horizontal scanrate
Therefore, if the horizontal scanrate is high (as in SVGA/VGA PC monitors)
the horizontal retrace interval is small and the physical gap between one active display line
and the next is also small
If , however, the horizontal refresh rate is low (as in standard resolution arcade monitors)
the physical gap between one active display line and the next is larger

This is where the arcade emulator use of the term 'Scanline' comes into play
The emulator is attempting to create a display with a long horizontal retrace interval
which results in a noticable physcial gap between one active display line and the next

(DOS) MAME running on a PC monitor attempts to do this in two ways...
   .by using tweaked VGA modes with double the normal vertical refresh rate, but half the lines
   .by using SVGA modes which draw a blank line every other display line

The first of the above is the most successful in replicating a low scanrate arcade monitor
The second falls far short - and is also the only option available to all Windows based emulators

A tweaked VGA 'Scanline' mode is a closer emulation than a SVGA odd/even line 'Scanline' mode
but still does not look like an original low res. arcade monitor
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据您提供的代码,可以看出ScanLine类的构造函数和DDALine函数定义写在了同一个函数体中,这是不合法的语法,应该将它们分别写在ScanLine类的定义和实现文件中。下面是一个修正后的示例: ScanLine.h: ```c++ #ifndef SCANLINE_H #define SCANLINE_H #include <QPainter> class ScanLine { public: ScanLine(); void DDALine(QPainter* painter); void MidLine(QPainter* painter); void Bresenham(QPainter* painter); }; #endif // SCANLINE_H ``` ScanLine.cpp: ```c++ #include "ScanLine.h" ScanLine::ScanLine() { // 构造函数的代码 } void ScanLine::DDALine(QPainter* painter) { // 绘制直线的代码 } void ScanLine::MidLine(QPainter* painter) { // 绘制直线的代码 } void ScanLine::Bresenham(QPainter* painter) { // 绘制直线的代码 } ``` 需要注意的是,为了在主窗口的paintEvent事件中调用ScanLine类的方法,您需要在ScanLine类的函数定义中将QPainter指针作为参数传递进来。例如: ```c++ void ScanLine::DDALine(QPainter* painter) { painter->drawLine(QPointF(0, 0), QPointF(100, 100)); } ``` 这样,在主窗口中调用ScanLine类的方法时,就可以将QPainter指针作为参数传递进去: ```c++ void MainWindow::paintEvent(QPaintEvent *event) { QPainter painter(this); if (menunum == 1) { ScanLine line; line.DDALine(&painter); } else if (menunum == 2) { ScanLine line; line.MidLine(&painter); } else if (menunum == 3) { ScanLine line; line.Bresenham(&painter); } } ``` 希望这能帮助您解决问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值