147.VGA256色模式编程

简介: 147.VGA256色模式编程
/*
     VGA256.c -- VGA 256 色编程
*/
#include "dos.h"
#include "conio.h"
#include "stdio.h"
void InitScr();
void RstScr();
void PutPoint(int x, int y, int Color);
void Rect(int x1, int y1, int x2, int y2, int Color);
void LineV(int x1, int y1, int x2, int y2, int Color);
int main()
{
    int x1, y1, x2, y2, i, j;
    x1 = y1 = 0;
    x2 = 319;
    y2 = 199;
    InitScr();
    for (i = 0; i < 256; i++)
       LineV(i, 0, i, 199, i);
    for( i = 18; i < 100; i++)
       Rect(x1++, y1++, x2--, y2--, i);
    for( i = 18; i < 50; i++)
       Rect(x1--, y1--, x2++, y2++, i);
    getch();
    RstScr();
}
void InitScr()
{
    union REGS In;
    In.x.ax = 0x13;                 /*进入13H模式  */
    int86(0x10, &In, &In);
}
void RstScr()
{
    union REGS In;
    In.x.ax = 0x03;             /* 退出13H模式 */
    int86(0x10, &In, &In);
}
/* 直接写视频缓冲区 */
void PutPoint(int x, int y, int Color)   /* 画点函数 */
{
   char far *p;
   p = (char far *) (0x0a0000000L);
   * (x+y*320+p) = Color;
}
/* 利用VGA BIOS中断在屏幕上画点, 速度慢
void PutPoint(int x, int y, int Color)
{
   union REGS  In;
   In.h.ah = 0x0C;
   In.h.al = Color;
   In.x.cx = x;
   In.x.dx = y;
   In.h.bh = 0;
   int86(0x10, &In, &In);
}
*/
void LineV(int x1, int y1, int x2, int y2, int Color)  /* 画一垂直线 */
{
   int i;
   for (i = 0; i < 199; i++)
      PutPoint(x1, i, Color);
}
void Rect(int x1, int y1, int x2, int y2, int Color)  /* 画一矩形*/
{
   int i;
   for(i = x1; i <= x2; i++)
   {
      PutPoint(i, y1, Color);
      PutPoint(i, y2, Color);
   }
   for(i = y1; i <= y2; i++)
   {
      PutPoint(x1, i, Color);
      PutPoint(x2, i, Color);
   }
}
相关文章
|
9月前
|
Ubuntu Linux Docker
Ubuntu22.04上Docker的安装
通过以上详细的安装步骤和命令,您可以在Ubuntu 22.04系统上顺利安装
4994 12
|
机器学习/深度学习
【从零开始学习深度学习】24.神经网络中池化层的作用:最大池化与平均池化
【从零开始学习深度学习】24.神经网络中池化层的作用:最大池化与平均池化
确保你已经安装了`python-barcode`库。如果没有,可以通过pip来安装:
确保你已经安装了`python-barcode`库。如果没有,可以通过pip来安装:
|
机器学习/深度学习
一文弄清池化层(pooling)的作用
一文弄清池化层(pooling)的作用
|
应用服务中间件 nginx
413 request entity too large 解决办法
413 request entity too large 解决办法
4805 0
|
消息中间件 缓存 NoSQL
「CDC架构」捕获数据变化的瑞士军刀Debezium介绍
「CDC架构」捕获数据变化的瑞士军刀Debezium介绍
|
编解码 Python Windows
pip安装报错:UnicodeDecodeError &#39;utf-8&#39; codec can&#39;t decode byte 0xc3 in position 4
pip安装报错:UnicodeDecodeError &#39;utf-8&#39; codec can&#39;t decode byte 0xc3 in position 4
790 2
|
7天前
|
人工智能 运维 安全
|
5天前
|
人工智能 异构计算
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
|
6天前
|
机器学习/深度学习 人工智能 自然语言处理
B站开源IndexTTS2,用极致表现力颠覆听觉体验
在语音合成技术不断演进的背景下,早期版本的IndexTTS虽然在多场景应用中展现出良好的表现,但在情感表达的细腻度与时长控制的精准性方面仍存在提升空间。为了解决这些问题,并进一步推动零样本语音合成在实际场景中的落地能力,B站语音团队对模型架构与训练策略进行了深度优化,推出了全新一代语音合成模型——IndexTTS2 。
576 20