当前位置:网站首页>[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...
边栏推荐
- Illustration of mongodb cluster deployment principle (3)
- qYKVEtqdDg
- Tencent three sides: how to duplicate 4billion QQ numbers?
- [JS reverse hundred examples] pedata encryption information and zlib Application of gunzipsync()
- Similarities and differences between Chinese and American electronic signature SaaS
- Introduction to GTS Academy
- Latex使用\usepackage{hyperref}报错:paragraph ended before [email protected]@link was complete
- B. AND 0, Sum Big-Codeforces Round #716 (Div. 2)
- Troubleshooting and modification process of easycvr interface dislocation in small screen
- Explanation of the principle and code implementation analysis of rainbow docking istio
猜你喜欢

论文阅读 (52):Self-Training Multi-Sequence Learning with Transformer for Weakly Supervised Video Anomaly

【win10 VS2019 opencv4.6 配置参考】

Alien world, real presentation, how does the alien version of Pokemon go achieve?

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

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

论文阅读 (50):A Novel Matrix Game with Payoffs of Maxitive Belief Structure

12 initialization of beautifulsoup class

视频异常检测数据集 (ShanghaiTech)
![[esp8266 - 01s] obtenir la météo, Ville, heure de Beijing](/img/8f/89e6f0d482f482ed462f1ebd53616d.png)
[esp8266 - 01s] obtenir la météo, Ville, heure de Beijing

FPN characteristic pyramid network
随机推荐
Company offensive operation guide
README
MySQL的 安裝、配置、卸載
对抗攻击与防御 (2):对抗样本的反制策略
【ESP8266-01s】获取天气,城市,北京时间
Latex编译成功但是无法输出到PDF
《AN4190应用笔记 天线选择指南》——天线理论2
Nanny level teaching! Take you to play with time complexity and space complexity!
Kotlin invoke convention makes kotlin code more concise
论文阅读 (47):DTFD-MIL: Double-Tier Feature Distillation Multiple Instance Learning for Histopathology..
Lighthouse open source application practice: o2oa
Analytic analog-to-digital (a/d) converter
Date selection of hotel check-in time and check-out time
Drawing black technology - easy to build a "real twin" 2D scene
【ESP8266-01s】獲取天氣,城市,北京時間
JS regular verification time test() method
Illustration of mongodb cluster deployment principle (3)
Nodejs implements multi process
Which securities company is good for opening a mobile account? Is online account opening safe?
单火线设计系列文章10:拓展应用-单火开关实现双控