Graph.Inc 图形函数

Zabbix图形中文乱码问题(显示口口)解决办法 因为这里使用是nginx+php作为zabbix-web展示,进入目录下,将原有字体备份,下载msyh字体。 阅读详情

参考:《C与C++高级图形程序设计》

-----------------我是分隔线:-D------------------

/*

=============================================

Video Graphics Array Driver
Original Material by Christopher D.Watkins
'C' Conversion by Larry Sharp
=============================================

SetMode - selects the display mode
Plot - place pixel to screen
ClearPalette - clear palette register
SetPalette - clear palette register
InitPalette1 - 64 levels of grey, red, green and blue
InitPalette2 - 7 colors with 35 intensities each
cyclepalette - cycle through palette
Circle - circle draw routine
Draw - line draw routine
InitGraphics - initialize graphics
WaitForKey - wait for key press
ExitGraphics - sound and wait for keypress before exiting graphics
Title - set up text screen colors
*/


union REGS reg;
struct SREGS inreg;


void SetMode(int Mode)
{
reg.h.ah = 0;
reg.h.al = Mode;
int86(0x10, &reg, &reg);
}


#define MaxXres 320
#define MaxYres 200
#define MaxX (MaxXres - 1)
#define MaxY (MaxYres - 1)


int XRes, YRes;
Word PreCalcY[MaxY + 1];


void PreCalc()
{
Word j;

for (j=0; j<=MaxY; j++)
PreCalcY[j] = 0;
for (j=0; j<=MaxY; j++)
PreCalcY[j] = XRes*j;
}


void Plot(int x, int y, Byte color)
{
Word Offset;
char far *address;

if(!((x<0) || (y<0) || (x>MaxX) || (y>MaxY)))
{
Offset = PreCalcY[y] + x;
address = (char far *) (0xA0000000L + Offset);
*address = color;
}
}


typedef struct
{
Byte Red;
Byte Grn;
Byte Blu;
}RGB;


typedef RGB PaletteRegister[255];


PaletteRegister Color;


void ClearPalette(PaletteRegister Color)
{
Word i;

for (i=0; i<=255; i++)
{
Color[i].Red = 0;
Color[i].Grn = 0;
Color[i].Blu = 0;
}
}


void SetPalette(PaletteRegister Hue)
{
reg.x.ax = 0x1012;
segread(&inreg);
inreg.es = inreg.ds;
reg.x.bx = 0;
reg.x.cx = 256;
reg.x.dx = (int) &Hue[0];
int86x(0x10, &reg, &reg, &inreg);
}


void InitPalette(PaletteRegister Color)
{
Word i;

for (i=0; i<64; i++)
{
Color[i].Red = i;
Color[i].Grn = i;
Color[i].Blu = i;
}

for (i=64; i<128; i++)
{
Color[i].Red = i - 64;
Color[i].Grn = 0;
Color[i].Blu = 0;
}

for (i=128; i<192; i++)
{
Color[i].Red = 0;
Color[i].Grn = i - 128;
Color[i].Blu = 0;
}

for (i=192; i<=255; i++)
{
Color[i].Red = 0;
Color[i].Grn = 0;
Color[i].Blu = i - 192;
}
}


void InitPalette2(PaletteRegister Color)
{
Word i;

for (i=0; i<36; i++)
{
Color[i].Red = 0;
Color[i].Grn = 0;
Color[i].Blu = Round(1.8 * i);
}

for (i=36; i<72; i++)
{
Color[i].Red = 0;
Color[i].Grn = Round(1.8 * (i-36));
Color[i].Blu = 0;
}

for (i=72; i<108; i++)
{
Color[i].Red = 0;
Color[i].Grn = Round(1.8 * (i-72));
Color[i].Blu = Round(1.8 * (i-72));
}

for (i=108; i<144; i++)
{
Color[i].Red = Round(1.8 * (i-108));
Color[i].Grn = 0;
Color[i].Blu = 0;
}

for (i=144; i<180; i++)
{
Color[i].Red = Round(1.8 * (i-144));
Color[i].Grn = 0;
Color[i].Blu = Round(1.8 * (i-144));
}

for (i=180; i<216; i++)
{
Color[i].Red = Round(1.8 * (i-180));
Color[i].Grn = Round(1.8 * (i-180));
Color[i].Blu = 0;
}

for (i=216; i<252; i++)
{
Color[i].Red = Round(1.8 * (i-216));
Color[i].Grn = Round(1.8 * (i-216));
Color[i].Blu = Round(1.8 * (i-216));
}
}


void CyclePalette(PaletteRegister Hue)
{
Word i;
RGB tmp;

tmp = Hue[0];
for (i = 1; i<=255; i++)
Hue[i-1] = Hue[i];
Hue[255] = tmp;
SetPalette(Hue);
}


void Swap(int *first, int *second)
{
int temp;

temp = *first;
*first = *second;
*second = temp;
}


void Circle(Word x, Word y, Word radius, Byte color)
{
int a, af, b, bf, target, r2;

target = 0;
a = radius;
b = 0;
r2 = Sqr(radius);
while(a >= b)
{
b = Round(sqrt(r2 - Sqr(a)));
Swap(&target, &b);
while(b<target)
{
af = (120*a) / 100;
bf = (120*b) / 100;
Plot(x+af, y+b, color);
Plot(x+bf, y+a, color);
Plot(x-af, y+b, color);
Plot(x-bf, y+a, color);
Plot(x-af, y-b, color);
Plot(x-bf, y-a, color);
Plot(x+af, y-b, color);
Plot(x+bf, y-a, color);
++b;
}
--a;
}
}


void Draw(int xx1, int yy1, int xx2, int yy2, Byte color)
{
int LgDelta, ShDelta, Cycle, LgStep, dtotal;

LgDelta = xx2 - xx1;
ShDelta = yy2 - yy1;

if (LgDelta < 0)
{
LgDelta = - LgDelta;
LgStep = -1;
}
else
LgStep = 1;

if (ShDelta < 0)
{
ShDelta = - ShDelta;
ShStep = -1;
}
else
ShStep = 1;

if (ShDelta < LgDelta)
{
Cycle = LgDelta >> 1;
while (xx1 != xx2)
{
Plot(xx1, yy1, color);
Cycle += ShDelta;
if (Cycle > LgDelta)
{
Cycle -= LgDelta;
yy1 += ShStep;
}
xx1 += LgStep;
}
Plot(xx1, yy1, color);
}
else
{
Cycle = ShDelta >> 1;
Swap(&LgDelta, &ShDelta);
Swap(&LgStep, &ShStep);
while (yy1 != yy2)
{
Plot(xx1, yy1, color);
Cycle += ShDelta;
if (Cycle > LgDelta)
{
Cycle -= LgDelta;
xx1 += ShStep;
}
yy1 += LgStep;
}
Plot(xx1, yy1, color);
}
}


void InitGraphics()
{
XRes = MaxXres;
YRes = MaxYres;
PreCalc();
SetMode(19);
ClearPalette(Color);
InitPalette2(Color);
SetPalette(Color)
}


void WaitForKey()
{
char k;
while (!(k =getch()));
}


void ExitGraphics()
{
sound(1000);
delay(500);
nosound();
WaitForKey();
SetMode(3);
}


void Title()
{
textcolor(YELLOW);
textbackground(BLUE);
clrscr();
}


/*
Three Dimensional Plotting Routines


InitPlotting - rotation and tilt angles
InitPerspective - observer location and distances
MapCoordinates - maps 3D space onto the 2D screen
CartesianPlot - plot a cartesian system point
CylindricalPlot3D - plot a cylindrical system point
SphericalPlot3D - plot a spherical system point
DrawLine3D - plots a line from 3D coordinates
*/


int CentreX, CentreY;
int Angl, Tilt;
float CosA, SinA;
float CosB, SinB;
float CosACosB, SinASinB;
float CosASinB, SinACosB;


void InitPlotting(int Ang, int Tlt)
{
CentreX = MaxX >> 1;
CentreY = MaxY >> 1;
Angl = Ang;
Tilt = Tlt;
CosA = CosD(Angl);
SinA = SinD(Angl);
CosB = CosD(Tilt);
SinB = SinD(Tilt);
CosACosB = CosA * CosB;
SinASinB = SinA * SinB;
CosASinB = CosA * SinB;
SinACosB = SinA * CosB;
}


Boolean PerspectivePlot;
float Mx, My, Mz, ds;


void InitPerspective(Boolean Perspective, float x, float y, float z, float m)
{
PerspectivePlot = Perspective;
Mx = x;
My = y;
Mz = z;
ds = m;
}


void MapCoordinates(float X, float Y, float Z, int *Xp, int *Yp)
{
float Xt, Yt, Zt;

Xt = (Mx + X*CosA - Y*SinA);
Yt = (My + X*SinASinB + Y*CosASinB + Z*CosB);

if (PerspectivePlot)
{
Zt = Mz + X*SinACosB + Y*CosACosB - Z*SinB;
*Xp = CentreX + Round(ds*Xt/Zt);
*Yp = CentreY - Round(ds*Yt/Zt);
}
else
{
*Xp = CentreX + Round(Xt);
*Yp = CentreY - Round(Yt);
}
}


void CartesianPlot3D(float X, float Y, float Z, Byte Color)
{
int Xp, Yp;

MapCoordinates(X, Y, Z, &Xp, &Yp);
Plot(Xp, Yp, Color);
}


void SphericalPlot3D(float R, float Theta, float Phi, Byte Color)
{
float X, Y, Z;

Theta = Radians(Theta);
Phi = Radians(Phi);
X = R * sin(Theta) * cos(Phi);
Y = R * sin(Theta) * sin(Phi);
Z = R * cos(Theta);
CartesianPlot3D(X, Y, Z, Color);
}


void DrawLine3D(TDA Pnt1, TDA Pnt2, Byte Color)
{
int Xp1, Yp1;
int Xp2, Yp2;
float x1, y1, z1;
float x2, y2, z2;

UnVec(Pnt1, &x1, &y1, &z1);
UnVec(Pnt2, &x2, &y2, &z2);
MapCoordinates(x1, y1, z1, &Xp1, &Yp1);
MapCoordinates(x2, y2, z2, &Xp2, &Yp2);
Draw(Xp1, Yp1, Xp2, Yp2, Color);
}


/*
Pixel


PutPixel - plots pixel
GetPixel - gets pixel


Color
1 - Blue
2 - Green
3 - Cyan
4 - Red
5 - Magenta
6 - Brown/Yellow
7 - Gray Scale


Intensity levels (0..35) for each color
*/


#define MaxCol 7
#define MaxInten 35


void PutPixel(int x, int y, Byte Color, Byte Intensity)
{
Byte Col;

if ( Intensity > MaxInten)
{
printf("*Inten > MaxInten!!\n\nHit any hey to exit.\n");
getch();
exit(1);
}
Col = ((MaxInten + 1)*(color - 1) + Intensity) & 255;
Plot(x, y, Col);
}


int GetPixel(int x, int y)
{
reg.x.ax = 3328;
reg.x.dx = y;
reg.x.cx = x;
int86(0x10, &reg, &reg);
return(reg.x.ax&255);
}


/*
Set up of Coordinate Axes and Color Palette


PutAxisAndPalette - toggle for Axis and Palette
AxisAndPalette - places Axis and Color Palette on screen
*/


Boolean DrawAxisAndPalette;
void PutAxisAndPalette(Boolean PlaceOnScreen)
{
if (PlaceOnScreen)
DrawAxisAndPalette = true;
else
DrawAxisAndPalette = false;
}


void DisplayAxis()
{
int x, y, z;

for (x=-100; x<101; x++)
{
CartesianPlot3D(x, 0, 0, 35);
CartesianPlot3D(100, 0, 0, 251);
}

for (y = -100; y<101; y++)
{
CartesianPlot3D(0, y, 0, 71);
CartesianPlot3D(0, 100, 0, 251);
}

for (z = -100; z<101; z++)
{
CartesianPlot3D(0, 0, z, 107);
CartesianPlot3D(0, 0, 100, 251);
}
}


void DisplayPalette()
{
int X, Y;
Byte Color;
Byte Intensity;

for (Color=1; Color<=MaxCol; Color++)
{
for (Intensity=0; Intensity<=MaxInten; Intensity++)
{
for (X=0; X<4; X++)
{
for (Y=0; Y<4; Y++)
PutPixel(X+5*Color, 190-Y-5*Intensity, Color, Intensity);
}
}
}
}


void AxisAndPalette()
{
if (DrawAxisAndPalette)
{
DisplayAxis();
DisplayPalette();
}
}
解决Zabbix中文监控服务器图形图表显示乱码 zabbix对中文的支持不是很好,但为了管理方面有时候我们还是会选择中文,在zabbix监控的web界面,图形图标下面的中文会显示一个个小方块,这样是不正确的,需要下载字体。例如“微软雅黑”,“微软雅黑.ttf” 命名为 “msyh.ttf”,将下载的字体上传到/zabbix/fonts/字体下修改/zabbix/include/defines.inc.php文件中的两处define('ZBX_G... 阅读详情

相关推荐

Zabbix前端页面显示的默认配置如何修改(例:默认查看图形一次只显示20个,队列检索监控项默认一次显示500个)

Zabbix前端页面显示的默认配置如何修改(例:默认查看图形一次只显示20个,队列检索监控项默认一次显示500个)

平平无奇,不断学习的运维玖玖 4531

顶会论文阅读-22年CCF A级别spark graphX研究

论文研读:incgraph

L_IRISRIIN的博客 2441

Doxygen 1.9.2 + Graphviz 配置实战:3步生成C/C++项目完整调用关系图

本文详细介绍了如何通过Doxygen 1.9.2和Graphviz配置生成C/C++项目的专业级调用关系图。从环境准备到高级调用图生成技巧,包括多目录项目处理、性能优化和可视化增强,帮助开发者快速掌握代码架构分析工具链的实战应用。

weixin_30781107的博客 472

开始使用MASM

      这篇教程翻译自《Inetl汇编语言程序设计》一书的作者Kip R. Irvine的文章Getting Started with MASM ,翻译的目的在于方便学习。本人翻译水平有限,有兴趣的大侠可以直接阅读原文。      同时感谢Adam_syd的中肯意见。          本教程将在指导你在轻松、有序的过程中,完成学习《Inetl汇编语言程序设计》(第5版)所需的

jinsonghu的专栏 1万+

GraphWin.inc 汇编语言

汇编语言 win32 GraphWin.inc

Irvine32.inc

支持汇编教材中的编程include

zabbix升级后图形文字不显示

下载win字体,根据自己选择,上传至/usr/share/zabbix/assets/fonts目录下,修改文件名为jianti.ttf。更新小版本后zabbix数据图形都有,只有下方文字不显示。修改默认字体配置文件。

运维工程师 893

VS2008汇编模板库函数

利用VS强大的功能,结合汇编开发配置,构造一款功能强大的可视化汇编工具。具体配置方法http://user.qzone.qq.com/245806497/blog/1287665369

解决Zabbix图形内汉字显示异常的问题

将define(‘ZBX_GRAPH_FONT_NAME’, ‘DejaVuSans’);2.上传到zabbix前端文件夹的assets/fonts目录中,比如我这里使用的是宋体,文件名simsun.ttc。注意目前ttf的字体文件是正常的,使用ttc格式的字体会导致页面无法正常显示。1.打开windows电脑,进入C:\Windows\Fonts,选择字体文件,我使用的是宋体。3.修改zabbix前端文件夹的include/defines.inc.php。

lvbinemail的博客 366

从零开始Cubemx配置STM32搭载freeRTOS以及lwip实现tcp网络通信(二)

Cubemx配置LWIP,实现网络通信

qq_30623327的博客 1万+

Rapid SCADA MQTT

一、配置RapidSCADA 1、准备KpMqtt.dll、Jint.dll库文件,从网盘下载。 2、将以上两个文件拷贝到SCADA安装目录的Comm/KP目录下,如下: C:\SCADA\ScadaComm\KP 3、新建SCADA项目 4、新建Line 5、新建Device 6、拷贝Config目录下的KpMqtt_001.xml文件、KpMqtt_Job.js文件到项目Comm\Config下,如下示例链接 C:\SCADA\Projects\MQTTProject\Instances\Defau

mumanquan1的博客 3007

Zabbix 图形展示中文乱码更正

一、乱码确认 登录zabbix管理平台时,展开主机的监控图形,发现中文显示全是“口口”的乱码。 经过查阅相关资料,得出结论,zabbix少了字体。。。。。。 二、复制上传字体文件 1、从Windows操作系统中,查找 simhei 字体文件,复制此文件到其他目录存放。 2、通过 SecureFX 远程登录管理工具打开 zabbix 服务器后, 3、在左边Windows 窗口中浏览到存放simhei文件的目录, 4、右边linux窗口中浏览到 /usr/share/zabbi..

蒙懂的小运维 653

手把手教你用支付宝密钥工具生成RSA2密钥对(含Windows/Mac操作截图)

本文详细介绍了如何使用支付宝密钥工具生成RSA2密钥对,包括Windows和Mac平台的操作步骤与截图。从工具下载、安装到密钥生成、配置支付宝平台,再到开发环境集成实战,手把手教你完成支付宝支付接口对接。特别强调密钥安全管理和最佳实践,帮助开发者避免常见安全隐患。

mongodb5scout的博客 257

Zabbix6.4 图形乱码怎么办

找一台Microsoft Windows 7/10/11的电脑,打开C:\Windows\Fonts。进入Linux后台,找到目录/usr/share/zabbix/assets/fonts/将define('ZBX_GRAPH_FONT_NAME', 'graphfont');将define('ZBX_FONT_NAME', 'graphfont');Zabbix6.4 安装后,进入主机图形展示,你会发现文字部分乱成了乱码。改成 define('ZBX_GRAPH_FONT_NAME', '

土牛兄弟的博客 1310

射频电源与等离子体技术:原理、应用与优化策略

射频电源(RF Power Supply)作为高频交流电信号发生器,在半导体制造和材料处理中扮演关键角色。其核心原理是通过高频电场激发气体产生等离子体,这种电离气体包含电子、离子和活性基团,具有独特的非平衡特性。技术价值体现在等离子体密度和电子温度的可控性上,使得在刻蚀和沉积工艺中能精确调控材料处理效果。应用场景广泛覆盖PECVD、深槽刻蚀等工业流程,其中13.56MHz ISM频段因其全球合规性成为行业标准。优化策略包括双频驱动和阻抗匹配网络设计,可显著提升工艺均匀性和设备效率。

weixin_29163797的博客 391

手把手教你低成本复刻大疆C板缓启动电路(附原理图与选型清单)

本文详细介绍了如何低成本复刻大疆C板缓启动电路,包括核心器件选型、电路搭建与调试实战、参数优化方法论及进阶改进思路。通过替代型号和优化设计,实现功能相近的缓启动电路,成本不到原方案的1/3,适合电子爱好者、在校学生和预算紧张的硬件工程师。

weixin_29197051的博客 397

zabbix--图形字体乱码

解决 zabbix 图形字体乱码 如图:修改之前 具体步骤: 1)下载字体,例如:SIMKAI.ttf楷体(也可直接将Windows上的直接上传;Windows路径:C:\Windows\Fonts) 2)上传到Linux中 3)将字体复制到 zabbix web站点数据目录下的fonts目录下,(yum安装的路径:/usr/share/zabbix/fonts) 如我的zabbix...

weixin_30410999的博客 207

UltraScale系列底层结构(3)——URAM概述

在UltraScale+™ 器件中,除了我们在常规熟悉的BRAM资源以外,还额外提供了URAM(UltraRAM)资源。 UltraRAM 是一种单时钟同步操作的高密度存储器,每个 UltraRAM 块可存储 288 Kb 数据,配置为 4K x 72 位的存储单元,其容量是 Block RAM 的八倍。虽然 UltraRAM 内部使用单端口存储单元,但通过在一个时钟周期内顺序执行端口 A 和端口 B 的操作,实现了双端口功能。

apple_53311083的博客 2837

Ubuntu24.04安装zabbix6(PostgreSQL)及zabbix6图形乱码解决

想在Ubuntu上部署zabbix6,我的Ubuntu版本为23,但zabbix官方仓库,支持的Ubuntu版本只有22,24到这一步,提示翻译过来大概就是:23的依赖版本太高,真想用得回退那就别了,我用24的包,删掉22包之后,这回提示缺依赖,但升级的话目前没有这个依赖...可快算了,我老实用Ubuntu24.04。下好镜像,装好后,先把open-vm-tools,openssh-server,net-tools这三样装好。配置清华源,

Muggllee的博客 2585

20、微电网系统的系统框架、建模与控制架构解析

本文详细解析了微电网系统的系统框架、建模方法以及控制架构。文章首先介绍了在系统的系统(SoS)框架下,微电网如何通过微控制器(MC)和微电网中央控制器(MGCC)协调运行,并支持并网与孤岛模式下的高效能量管理。随后,针对微电网的关键组件,包括微涡轮机、光伏太阳能电池和风力涡轮机,提供了详细的数学建模分析。最后,探讨了微电网的控制架构设计,涵盖分层控制和共识控制策略,以实现系统的高效、稳定运行,满足日益增长的能源需求与市场要求。

elastic6hunter的博客 206

大数据NiFi(十一):NiFi入门案例一

注意:数据写出的目录可以不需要提前在对应节点上创建,默认是可以自动创建,可以通过“Create Missing Directories”属性配置。将输出文件的权限设置为此属性的值,格式必须是UNIX rwxrwxrwx,用-来代替被拒绝的权限(例如rw-r--r--)或八进制数字(例如644),可以使用表达式,例如${file.permissions}。这里需要使用到的处理器是“GetFile”和“PutFile”,完成以上需求对“GetFile”和“PutFile”相关属性进行配置。

Lansonli(蓝深李)的博客 1490

zabbix 监控 图形化界面文字乱码解决方法

zabbix安装后之后,很多小伙伴第一时间都是去设置中文界面,发现页面、菜单等可以正常显示中文,但是 唯有图形显示方块,无法正常显示汉字,按照百度教程,上传windows字体,修改配置文件的2处字体配置能解决 按照教程我这里没有解决,最后发现是php编译问题。 参考链接:https://www.linuxidc.com/Linux/2017-12/149284.htm 第一种重新编译...

weixin_34406796的博客 266

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

zabbix图形乱码解决方案

zabbix使用中文后,图形那里乱码,因为没有中文包,需要安装中文包并且应用。

qq_37200978的博客 996

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

(三)修改图形乱码问题

例如现在有问题的图形如下 把windows的字体:C:\Windows\Fonts复制一个字体(simkai.ttf)到/usr/share/zabbix/fonts/目录下 #vi /usr/share/zabbix/include/defines.inc.php define('ZBX_GRAPH_FONT_NAME', 'simkai'); define('ZBX_FONT...

weixin_30438813的博客 144

zabbix图形乱码

毕竟是中文为主,特别是有些香项目最好以中文命名,容易区分,也方便识别 环境: centos7.3安装zabbix3.2 问题: 图文乱码问题 原理上只要找到对应的字符集,在修改配置文件 windows路径: C:\Windows\Fonts 我最先使用的是新宋体。。。结果没变 后来换成微软雅黑,成功; 配置文件修改: # pwd /usr/share/zabbix/...

weixin_30402085的博客 100

解决zabbix前端的图形界面出现中文的乱码问题

解决zabbix前端图形显示中文乱码

wxlly06的博客 247
上一篇: Math.Inc 分型图形库数学函数头文件 数字函数+向量和矩阵函数+仿射变换
下一篇: 如何在Win7中安装使用超级终端Hyper Terminal
tinyhare
博客等级 码龄15年 11粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值