肝了个画图小程序_完整源码免费抄_无贴图(VC6.0)(EasyX)

肝没了!

按钮说明:(一定要看)

        左上第1:输出文字

                   2:设置画笔颜色

                   3:保存(位置:D:\\test.bmp    可更改)

                   ……………………

                   $^&%$^%&^^

                   后面的看图形

        *当然这些的快捷键分别是 A\D\P\Q\S\L\C\M\F\G\R.........%&%@^**&^%&$#@$#%

进入程序按H键可查看 (按键说明更全) 帮助,鼠标中间恢复初始设置

本次更新内容:

        加了些细节

        修复了一些bug

        不过有些bug不知道咋修复

快捷键:B打开调色盘。       

在打开调色盘页面时按      ←或↓                 →或↑    调整调色盘亮度

基本信息:

        窗口大小:1000*1000 (请勿更改)

        编译环境:Microsoft VS C++ 6.0(不知道高版本行不行)

        语言:C++(.cpp)

        所需下载库:需下载EasyX      *EasyX Graphics Library for C++

        无贴图

效果图:

 全代码:

#include<graphics.h>
#include<iostream>
#include<windows.h>
#include<easyx.h>
#include<Windows.h>
#include <conio.h>
#include <conio.h>
#include <string>
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) 
#include <time.h> 
#include <map>
#include <cmath>
#include <dos.h>
#include<queue>
#include<cstring>
#include<cmath>
#include<math.h>
#include<list>
#include<stack>
#include<vector>
#define HWNDNAMEUP 012FF56D16R0KD1
#define HWNDNAMEDOWN 012FF56D35C02S1
#define HWNDNAMEON 012FF56D35C0Z10
#undef UNICODE
#undef _UNICODE

#define SEED (int)time(0)

int cx=GetSystemMetrics(SM_CXSCREEN);
int cy=GetSystemMetrics(SM_CYSCREEN);
HWND hwnd=GetForegroundWindow(); 
using namespace std;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int _Tstyle=2;
bool li=1;
COLORREF _Tcolor=RGB(255,255,255);
int fp=0,fps=0,sta;
bool h=0,nn=0,pp=0;
bool rec=0,cir=0,rr=0;

bool sav=1;
MOUSEMSG m;
COLORREF filln=RGB(255,255,255);
void improveWord(LOGFONT* word, int size, LPCSTR style) {
	gettextstyle(word);
	word->lfHeight = size;
	_tcscpy(word->lfFaceName, style);
	word->lfQuality = ANTIALIASED_QUALITY;
	settextstyle(word);
}
int clear_buffer()
{
	while(kbhit())
	{
		if(getch() != EOF); 
		for(int i = 1; i <= 256; i++)
		{
			if(GetAsyncKeyState(i));
		}
	}
	return 0;
}
void draw(float d){
	BeginBatchDraw();
	float H = 0;
	float S = 1.f;
	float L = d;
	for(int i = 0; i <= 500; i++)
	{
		S=1.f;
		for(int j = 0; j <= 500; j++){
			S-=0.002;
			putpixel(i,j,HSLtoRGB(H,S,L));
		}
		H += 0.7;
	}
	FlushBatchDraw();
}
void rectpaint(){
	_sleep(100);
	draw(0.5f);
	
	float l=0.5f;
	while(!KEY_DOWN(VK_LBUTTON)&&!KEY_DOWN('B')){
		BeginBatchDraw();
		if(KEY_DOWN(VK_LEFT)||KEY_DOWN(VK_DOWN))if(l>0.001){
			l-=0.01;
			draw(l);
		}
		if(KEY_DOWN(VK_RIGHT)||KEY_DOWN(VK_UP))if(l<0.999){
			l+=0.01;
			draw(l);
		}
		if(KEY_DOWN(VK_SPACE)){l=0.5f;draw(l);}

		setfillcolor(RGB(150,150,150));
		bar(545-1,100,650,120);
		if(MouseHit())m=GetMouseMsg();
		TCHAR R[50];
		_stprintf(R, _T("%d"),GetRValue(getpixel(m.x,m.y)));
		outtextxy(555, 100, R);

		TCHAR G[50];
		_stprintf(G, _T("%d"),GetGValue(getpixel(m.x,m.y)));
		outtextxy(585, 100, G);

		TCHAR B[50];
		_stprintf(B, _T("%d"),GetBValue(getpixel(m.x,m.y)));
		outtextxy(615, 100, B);

		setlinecolor(WHITE);
		setfillcolor(getpixel(m.x,m.y));
		setlinestyle(PS_SOLID,1);
		fillrectangle(550,0,650,100);

		FlushBatchDraw();
	}
	if(KEY_DOWN(VK_LBUTTON))_Tcolor=getpixel(m.x,m.y);
	while(KEY_DOWN(VK_LBUTTON));
	clear_buffer();
	_sleep(100);
	clear_buffer();
}
void print(){
	
	LOGFONT f;
	if(KEY_DOWN('H')){
		improveWord(&f, 18, _T("微软雅黑"));
		outtextxy(0,0,"Press H:Help    Press D: setcolor   Press S: setstyle    Press P: save image     Press Q: open image");
		outtextxy(0,15,"Press L: dotted line/solid line    Press A: draw text    Press G: Getcolor    Press Y: rectangle    Press B: Palette");
		outtextxy(0,30,"Press C: copy     Press M: move    Press Mid_button: restore default settings    Press Z: circle     Press K: Rotate");
		outtextxy(0,45,"Press F: Fill     Press R: Line   Press F5: debug     Press F6: refresh    Press J: round retangle    Press ESC: exit");
	}
	improveWord(&f, 20, _T("微软雅黑"));
}
void init(){
	srand(SEED);
	initgraph(1000,1000/*,EW_SHOWCONSOLE*/,EW_DBL
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值