[视觉错觉] 隐藏的爱心 铜牌收录

这是一个有趣的视觉错觉程序。在看似整齐的方格图像当中,利用图像的细微差距,使这张图片看上去突出来一颗爱心。但是认真去看这颗心的时候,却难以找到心的边缘。

视觉错觉艺术 铜牌收录

这是网上经常见的视觉错觉艺术图片,可以用程序生成的。效果如下:

完整的源代码如下:

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术图
// 编译环境:VS2010, EasyX_20200902
// 作  者:温良
// 最后修改:2021-1-24
//
#include <graphics.h> 
#include <conio.h>

const double PI = 3.1415926536;

int main()
{ 
	// 创建绘图窗口
	initgraph(800, 560);

	// 使用青绿色填充背景
	setbkcolor(RGB(185, 230, 0));
	cleardevice();

	double b = 0;

	for(int x = 20; x < 760; x += 48, b -= PI)
	{
		for(int
...

视觉错觉艺术 铜牌收录

一、 视觉错觉效果图如下

二、思想

先画小球从左到右排放,然后再到下一行继续重复上一个过程。

三、完整代码如下

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术图
// 编译环境:VS2019, EasyX_20200902
// 作  者:梦萤花火
// 最后修改:2021-1-24
//
#include <graphics.h>
#include <conio.h>

int x;								// X轴坐标
int y;								// y轴坐标
int g_multiples = 0;				// 倍数:作用是对弧度角进行改变
float g_PI = 3.1415927;				// 圆周率
float g_radianAngle;				// 起始角的弧度


// 实施画单个完整小球的函数
void DrawCe
...

视觉错觉艺术4 铜牌收录

这是网上经常见的视觉错觉艺术图片,可以用程序生成的。效果如下:

完整的源代码如下:

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术4
// 编译环境:Visual C++ 6.0 / 2013,EasyX 20140321(beta)
// 作  者:yangw80 <yw80@qq.com>
// 最后修改:2014-7-15
//
#include <graphics.h>
#include <conio.h>


// 定义回调
void (*callback)(int x, int y);


// 画方块上的小方块
void DrawSmallBox(int x, int y, bool lt, bool rt, bool lb, bool rb)
{
	int nx = x * 26 - 13;
	int ny = y * 26 - 13;
	if
...

视觉错觉艺术3 铜牌收录

这是网上经常见的视觉错觉艺术图片,可以用程序生成的。效果如下:

完整的源代码如下:

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术3
// 编译环境:Visual C++ 6.0 / 2010,EasyX_20210730
// 作  者:yangw80 <yw80@qq.com>
// 最后修改:2014-7-14
//
#include <graphics.h>
#include <conio.h>


// 定义回调
void (*callback)(int x, int y);


// 圆中的每个点(回调函数)
void CirclePoints(int x, int y)
{
	if (x < y)
	{
		COLORREF c1 = getpixel(x, y);
		COLORREF c2 = getpixel(y, x);
		put
...

视觉错觉艺术2 铜牌收录

这是网上经常见的视觉错觉艺术图片,可以用程序生成的。效果如下:

完整的源代码如下:

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术2
// 编译环境:Visual C++ 6.0,EasyX 2013霜降版
// 作  者:yangw80 <yw80@qq.com>
// 最后修改:2013-12-16
//
#include <graphics.h>
#include <conio.h>

// 定义常量
#define	UNIT		24
#define OFFSET_X	116
#define OFFSET_Y	36

// 画装饰花
void DrawUnit(int x, int y, int shape)
{
	// 设置颜色
	int n = ((shape & 1) ? 1 : 0) + ((shape & 2) ? 1 : 0)
...

视觉错觉艺术1 铜牌收录

这是网上经常见的视觉错觉艺术图片,可以用程序生成的。效果如下:

完整的源代码如下:

///////////////////////////////////////////////////
// 程序名称:视觉错觉艺术1
// 编译环境:Visual C++ 6.0,EasyX 2013霜降版
// 作  者:yangw80 <yw80@qq.com>
// 最后修改:2013-12-16
//
#include <graphics.h>
#include <conio.h>

// 定义常量
#define	UNIT		15
#define OFFSET_X	122
#define OFFSET_Y	23

// 画每个小单元
void DrawUnit(int x, int y, int shape)
{
	// 定义颜色
	static COLORREF c[4] = {0x0000ff, 0x0077ff, 0x00ddff, 0x007
...