📄 draw.h
字号:
#ifndef _EZ_DRAW_
#define _EZ_DRAW_
#ifdef __cplusplus
extern "C"
{
#endif
#pragma comment(lib, "Ezd32m.lib")
#define EZDIMPORT _declspec(dllimport) __stdcall
enum ezdColor {
ezdWhite = ((unsigned long)(((unsigned char)(0xff)|((short)((unsigned char)(0xff))<<8))|(((unsigned long)(unsigned char)(0xff))<<16))),
ezdBlue = ((unsigned long)(((unsigned char)(0x00)|((short)((unsigned char)(0x00))<<8))|(((unsigned long)(unsigned char)(0xf0))<<16))),
ezdTeal = ((unsigned long)(((unsigned char)(0x00)|((short)((unsigned char)(0x80))<<8))|(((unsigned long)(unsigned char)(0x80))<<16))),
ezdGreen = ((unsigned long)(((unsigned char)(0x00)|((short)((unsigned char)(0xc0))<<8))|(((unsigned long)(unsigned char)(0x00))<<16))),
ezdTurquoise = ((unsigned long)(((unsigned char)(0x43)|((short)((unsigned char)(0xc6))<<8))|(((unsigned long)(unsigned char)(0xdb))<<16))),
ezdDarkGray = ((unsigned long)(((unsigned char)(0x7a)|((short)((unsigned char)(0x7a))<<8))|(((unsigned long)(unsigned char)(0x7a))<<16))),
ezdBrown = ((unsigned long)(((unsigned char)(0x98)|((short)((unsigned char)(0x05))<<8))|(((unsigned long)(unsigned char)(0x17))<<16))),
ezdPurple = ((unsigned long)(((unsigned char)(0xa4)|((short)((unsigned char)(0x00))<<8))|(((unsigned long)(unsigned char)(0xd7))<<16))),
ezdLightBlue = ((unsigned long)(((unsigned char)(0xb5)|((short)((unsigned char)(0xda))<<8))|(((unsigned long)(unsigned char)(0xff))<<16))),
ezdLightGray = ((unsigned long)(((unsigned char)(0xdc)|((short)((unsigned char)(0xdc))<<8))|(((unsigned long)(unsigned char)(0xdc))<<16))),
ezdGold = ((unsigned long)(((unsigned char)(0xd4)|((short)((unsigned char)(0xa0))<<8))|(((unsigned long)(unsigned char)(0x17))<<16))),
ezdRed = ((unsigned long)(((unsigned char)(0xff)|((short)((unsigned char)(0x00))<<8))|(((unsigned long)(unsigned char)(0x00))<<16))),
ezdOrange = ((unsigned long)(((unsigned char)(0xf8)|((short)((unsigned char)(0x7a))<<8))|(((unsigned long)(unsigned char)(0x17))<<16))),
ezdPink = ((unsigned long)(((unsigned char)(0xfa)|((short)((unsigned char)(0xaf))<<8))|(((unsigned long)(unsigned char)(0xbe))<<16))),
ezdYellow = ((unsigned long)(((unsigned char)(0xff)|((short)((unsigned char)(0xff))<<8))|(((unsigned long)(unsigned char)(0x00))<<16))),
ezdBlack = ((unsigned long)(((unsigned char)(0x00)|((short)((unsigned char)(0x00))<<8))|(((unsigned long)(unsigned char)(0x00))<<16)))
};
enum ezdOrigin {
ezdAtPoint = 0,
ezdCenter,
};
enum ezdMapMode {
ezdIsotropic = 0,
ezdAnisotropic = 1
};
int EZDIMPORT ezdInitialize(void);
void EZDIMPORT ezdCleanUp(void);
unsigned long EZDIMPORT ezdDrawLine(double fX1, double fY1, double fX2, double fY2);
unsigned long EZDIMPORT ezdDrawRectangle(double fX1, double fY1, double fX2, double fY2);
unsigned long EZDIMPORT ezdDrawCircle(double fX, double fY, double fR);
unsigned long EZDIMPORT ezdDrawPoint(double fX, double fY);
unsigned long EZDIMPORT ezdDrawPolygon(unsigned long lCount, const double * pfXarray, const double * pfYarray);
unsigned long EZDIMPORT ezdDrawText(char* szText, double fX, double fY);
int EZDIMPORT ezdDeleteShape(unsigned long hShape);
unsigned long EZDIMPORT ezdSetColor(unsigned long color);
char EZDIMPORT ezdWaitForKeyPress();
double EZDIMPORT ezdGetOriginX();
double EZDIMPORT ezdGetOriginY();
ezdOrigin EZDIMPORT ezdGetOriginType();
int EZDIMPORT ezdSetOriginType(int iMode);
int EZDIMPORT ezdSetOrigin(double fX, double fY, ezdOrigin Origin);
double EZDIMPORT ezdGetViewportWidth();
double EZDIMPORT ezdGetViewportHeight();
int EZDIMPORT ezdSetViewport(double fX, double fY);
ezdMapMode EZDIMPORT ezdGetMapMode();
int EZDIMPORT ezdSetMapMode(int iMode);
int EZDIMPORT ezdGetForceAspect();
int EZDIMPORT ezdSetForceAspect(int bForce);
int EZDIMPORT ezdClearDrawSurface();
int EZDIMPORT ezdKeyPress();
int EZDIMPORT ezdWait(unsigned int uiMiliseconds);
///
void openWindow(); // initialize drawing surface
void viewWindow(); // wait until a key is pressed
void eraseWindow(); // erase the drawing window
void closeWindow(); // close the drawing surface
// wait secs seconds before executing next instruction
void delayWindow(double secs);
// return true if a key pressed; otherwise, return false
bool keyPress();
// ***********************************************************
// graphic functions implementation
// ***********************************************************
void openWindow()
{
ezdInitialize();
ezdSetMapMode(0);
ezdSetOrigin(0,+100,ezdAtPoint);
ezdSetViewport(100,-100);
}
void viewWindow()
{
ezdWaitForKeyPress();
}
void eraseWindow()
{
ezdClearDrawSurface();
}
void closeWindow()
{
ezdCleanUp();
}
void delayWindow(double secs)
{
ezdWait((unsigned int)(secs * 1000));
}
bool keyPress()
{
if (ezdKeyPress() != 0)
return true;
else
return false;
}
void resizeWindow(double x1,double y1,double x2,double y2)
{
ezdSetMapMode(0);
ezdSetOrigin(x1,y1,ezdAtPoint);
ezdSetViewport(x2-x1,y2-y1);
}
void setColor(char red,char green,char blue)
{
ezdSetColor(((unsigned long)(((unsigned char)(red)|((short)((unsigned char)(green))<<8))|(((unsigned long)(unsigned char)(blue))<<16))));
}
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -