当前位置:网站首页>[tool C] - lattice simulation test 2
[tool C] - lattice simulation test 2
2022-06-23 18:02:00 【A bowl of bean curd】
Preface
The previous article provided a test method for testing dot matrix line drawing function, etc
【C Tools 】------ Lattice simulation test
But the disadvantages are obvious , The dot matrix with high resolution is too large in the way of printing blocks
So this time we use the method of drawing dots , The display is shown in the lower right part of the figure below :
Use vs2019 Development , The program has been uploaded to My code cloud warehouse , Welcome interested partners to improve
Use easyx Graphics library
In fact, there are only two graphic functions required :
- Draw a rectangular , That is, the drawing point of the dot matrix , A dot matrix picture points to 3*3, Actual fill 2*2, This leaves a gap between the points
void draw_point(int x,int y)
{
int x1, x2, y1, y2;
x1 = (x+1) * 3 - 1;
x2 = (x+1) * 3;
y1 = (y + 1) * 3 - 1;
y2 = (y + 1) * 3;
fillrectangle(x1, y1, x2, y2);
}
- Clear the canvas , Nothing to say , Clear the screen
void cleardevice();
Read bin file
Lattice data for display ,
#include <iostream>
#include <fstream>
// Open the file in binary
std::ifstream infile("./bin.bin",std::ios::binary);
// Read the data ,256*160 Fixed resolution
infile.read((char*)rBuf, 256*160/8);
// File close
infile.close();
Finally, fill in the read data with dots according to the screen refresh method , Here is an example of a determinant refresh
void run()
{
int i, j, k;
switch (Data_mode)
{
case MODE_1: // Determinant refresh
for (i = 0; i < 20; i++)
{
for (j = 0; j < 256; j++)
{
for (k = 0; k < 8; k++)
{
if (byte_mode == 0)
{
if (reverse == 0)
{
if (!(show_buf[i * 256 + j] & (0x01 << k)))
{
draw_point(j, i * 8 + k);
}
}
else if(reverse == 1)
{
if (show_buf[i * 256 + j] & (0x01 << k))
{
draw_point(j, i * 8 + k);
}
}
}
else if (byte_mode == 1)
{
if (reverse == 0)
{
if (!(show_buf[i * 256 + j] & (0x80 >> k)))
{
draw_point(j, i * 8 + k);
}
}
else if(reverse == 1)
{
if (show_buf[i * 256 + j] & (0x80 >> k))
{
draw_point(j, i * 8 + k);
}
}
}
}
}
}
break;
}
}
end...
边栏推荐
- What is the personal finance interest rate in 2022? How do individuals choose financial products?
- MySQL的 安裝、配置、卸載
- [Hyperf]Entry “xxxInterface“ cannot be resolved: the class is not instantiable
- Crmeb second open SMS function tutorial
- Goframe framework: graceful closing process
- Intelligent supply chain collaborative management solution for logistics industry
- Nodejs implements multi process
- [esp8266 - 01s] obtenir la météo, Ville, heure de Beijing
- Cross browser common events
- Kdevtmpfsi processing of mining virus -- Practice
猜你喜欢

Meituan Sanmian: how do you understand the principle of redis master-slave replication?

微信小程序startLocationUpdateBackground()简单实现骑手配送位置

Performance test bottleneck tuning in 10 minutes! If you want to enter a large factory, you must know

视频异常检测数据集 (ShanghaiTech)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):...

全局组织结构控制之抢滩登陆

Date selection of hotel check-in time and check-out time

论文阅读 (58):Research and Implementation of Global Path Planning for Unmanned Surface Vehicle Based...

Self supervised learning (SSL)

客服系统搭建教程_宝塔面板下安装使用方式_可对接公众号_支持APP/h5多租户运营...
随机推荐
Transaction processing of cloud development database
This time, thoroughly understand the SparseArray implementation principle
Cross browser common events
论文阅读 (48):A Library of Optimization Algorithms for Organizational Design
Hands on data analysis unit 2 section 4 data visualization
百度智能云5月产品升级观察站
【C工具】------点阵模拟测试2
论文阅读 (51):Integration of a Holonic Organizational Control Architecture and Multiobjective...
Establishment and use of SSL VPN (OpenVPN)
Discussion on five kinds of zero crossing detection circuit
论文阅读 (55):Dynamic Multi-Robot Task Allocation under Uncertainty and Temporal Constraints
Postgresql_ Optimize SQL based on execution plan
Detailed explanation of ssl/tls principle and packet capturing
Go unit test
对抗攻击与防御 (2):对抗样本的反制策略
JS custom error
ACM players take you to play with the array!
Illustration of mongodb cluster deployment principle (3)
论文阅读 (57):2-hydr_Ensemble: Lysine 2-Hydroxyisobutyrylation Identification with Ensemble Method (任务)
The draganddrop framework, a new member of jetpack, greatly simplifies the development of drag and drop gestures!