当前位置:网站首页>[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...
边栏推荐
- 如何通过线上股票开户?在线开户安全么?
- How to make a shirt certificate
- Li Kou daily question - day 25 -495 Timo attack
- [Hyperf]Entry “xxxInterface“ cannot be resolved: the class is not instantiable
- How to use R language to draw scatter diagram
- Wechat applet: time selector for the estimated arrival date of the hotel
- 视频异常检测数据集 (ShanghaiTech)
- 对抗攻击与防御 (1):图像领域的对抗样本生成
- How to quickly obtain and analyze the housing price in your city?
- [mae]masked autoencoders mask self encoder
猜你喜欢
随机推荐
Latex使用\usepackage{hyperref}报错:paragraph ended before [email protected]@link was complete
Alien world, real presentation, how does the alien version of Pokemon go achieve?
[JS reverse hundred examples] pedata encryption information and zlib Application of gunzipsync()
【win10 VS2019 opencv4.6 配置参考】
MySQL的 安装、配置、卸载
Intelligent supply chain collaborative management solution for logistics industry
Lighthouse open source application practice: o2oa
New function! Qianfan magic pen apaas December capability monthly report
What is the personal finance interest rate in 2022? How do individuals choose financial products?
Baidu AI Cloud product upgrade Observatory in May
Analytic analog-to-digital (a/d) converter
Answer 01: why can Smith circle "allow left string and right parallel"?
High availability solution practice of mongodb advanced applications (4)
C. Set or Decrease-Educational Codeforces Round 120 (Rated for Div. 2)
Réponse 02: pourquoi le cercle Smith peut - il "se sentir haut et bas et se tenir à droite et à droite"?
Answer 02: why can Smith circle "allow left string and right parallel"?
Ner's past, present and future Overview - Future
History of storage technology: from tape to hardware liquefaction
ACM players take you to play with the array!
解答02:Smith圓為什麼能“上感下容 左串右並”?



![[mae]masked autoencoders mask self encoder](/img/08/5ab2b0d5b81c723919046699bb6f6d.png)


![[30. concatenate substrings of all words]](/img/e7/453c8524a23fbb7501e85140547ce1.png)

