绘制颜色渐变矩形函数
填充效果如下:
其中falg指定渐变形式:
0:左右渐变。
1:上下渐变
3:中心到左右两边渐变
4:中心到上下渐变
5:中心到四周实现渐变
void_DrawRect(CDC *pDC,CRect rect,COLORREF
nShadowBeginColor,COLORREF
nShadowEndColor,int falg )
{
TRIVERTEX rcVertex[2];
rcVertex[0].x=rect.left;
rcVertex[0].y=rect.top;
rcVertex[0].Red=GetRValue(nShadowBeginColor)<<8;
rcVertex[0].Green=GetGValue(nShadowBeginColor)<<8;
rcVertex[0].Blue=GetBValue(nShadowBeginColor)<<8;
rcVertex[0].Alpha=0x0000;
rcVertex[1].x=rect.right;
rcVertex[1].y=rect.bottom;
rcVertex[1].Red=GetRValue(nShadowEndColor)<<8;
rcVertex[1].Green=GetGValue(nShadowEndColor)<<8;
rcVertex[1].Blue=GetBValue(nShadowEndColor)<<8;
rcVertex[1].Alpha=0;
GRADIENT_RECT rect1;
rect1.UpperLeft=0;
rect1.LowerRight=1;
if (falg==0)
handle_GradientFill( pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_H);
if (falg==1)
handle_GradientFill( pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_V );
if (falg==3)
{
/// Email: visualsan@yahoo.cn
rcVertex[0].x=rect.left;
rcVertex[0].y=rect.top;
rcVertex[0].Red=GetRValue(nShadowBeginColor)<<8;
rcVertex[0].Green=GetGValue(nShadowBeginColor)<<8;
rcVertex[0].Blue=GetBValue(nShadowBeginColor)<<8;
rcVertex[0].Alpha=0x0000;
rcVertex[1].x=rect.right-rect.Width()/2;
rcVertex[1].y=rect.bottom;
rcVertex[1].Red=GetRValue(nShadowEndColor)<<8;
rcVertex[1].Green=GetGValue(nShadowEndColor)<<8;
rcVertex[1].Blue=GetBValue(nShadowEndColor)<<8;
rcVertex[1].Alpha=0;
handle_GradientFill(pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_H);
rcVertex[0].x=rect.left+rect.Width()/2-1;
rcVertex[0].y=rect.top;
rcVertex[0].Red=GetRValue(nShadowEndColor)<<8;
rcVertex[0].Green=GetGValue(nShadowEndColor)<<8;
rcVertex[0].Blue=GetBValue(nShadowEndColor)<<8;
rcVertex[0].Alpha=0x0000;
rcVertex[1].x=rect.right;
rcVertex[1].y=rect.bottom;
rcVertex[1].Red=GetRValue(nShadowBeginColor)<<8;
rcVertex[1].Green=GetGValue(nShadowBeginColor)<<8;
rcVertex[1].Blue=GetBValue(nShadowBeginColor)<<8;
rcVertex[1].Alpha=0;
handle_GradientFill( pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_H);
}
if (falg==4)
{ /// Email: visualsan@yahoo.cn
rcVertex[0].x=rect.left;
rcVertex[0].y=rect.top;
rcVertex[0].Red=GetRValue(nShadowBeginColor)
<< 8;
rcVertex[0].Green=GetGValue(nShadowBeginColor)<<8;
rcVertex[0].Blue=GetBValue(nShadowBeginColor)<<8;
rcVertex[0].Alpha=0x0000;
rcVertex[1].x=rect.right;
rcVertex[1].y=rect.bottom-rect.Height()/2;
rcVertex[1].Red=GetRValue(nShadowEndColor)<<8;
rcVertex[1].Green=GetGValue(nShadowEndColor)<<8;
rcVertex[1].Blue=GetBValue(nShadowEndColor)<<8;
rcVertex[1].Alpha=0;
handle_GradientFill(pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_V);
rcVertex[0].x=rect.left;
rcVertex[0].y=rect.top-1+rect.Height()/2;
rcVertex[0].Red=GetRValue(nShadowEndColor)<<8;
rcVertex[0].Green=GetGValue(nShadowEndColor)<<8;
rcVertex[0].Blue=GetBValue(nShadowEndColor)<<8;
rcVertex[0].Alpha=0x0000;
rcVertex[1].x=rect.right;
rcVertex[1].y=rect.bottom;
rcVertex[1].Red=GetRValue(nShadowBeginColor)<<8;
rcVertex[1].Green=GetGValue(nShadowBeginColor)<<8;
rcVertex[1].Blue=GetBValue(nShadowBeginColor)<<8;
rcVertex[1].Alpha=0;
handle_GradientFill( pDC->GetSafeHdc
(),rcVertex,2,&rect1,1,
GRADIENT_FILL_RECT_V);
}
if (falg==MIDDLE_TO_SIDE)
{
POINT p1,p2,p3,p4,p;
p1.x=rect.left;p1.y=rect.bottom;
p2.x=rect.right;p2.y=rect.bottom;
p3.x=rect.right;p3.y=rect.top;
p4.x=rect.left;p4.y=rect.top;
p=rect.CenterPoint();
_DrawTriangle (pDC,p1,p2,p,nShadowEndColor,nShadowEndColor,nShadowBeginColor);
DrawTriangle(pDC,p2,p3,p,nShadowEndColor,nShadowEndColor,nShadowBeginColor);
DrawTriangle(pDC,p3,p4,p,nShadowEndColor,nShadowEndColor,nShadowBeginColor);
DrawTriangle(pDC,p4,p1,p,nShadowEndColor,nShadowEndColor,nShadowBeginColor);
}
}
绘制颜色渐变矩形函数相关推荐
- TIT 计算机图形学 实验三 使用重心坐标算法绘制颜色渐变的正六面体
TIT 计算机图形学 实验三 使用重心坐标算法绘制颜色渐变的正六面体 前言 参考视频计算机图形学全套算法讲解和C++编码实现(共23讲配套源码),计算机图形学案例视频讲解以及主页相关算法.孔老师是我的 ...
- Matlab中绘制颜色渐变曲线
大家在文章中是否看见过各类颜色渐变的曲线呢?今天小编就教大家在matlab中如何绘制这类颜色渐变的曲线. 一.scatter3函数 这个函数是大家最常想到的函数,具体用法就看其帮助文档,小编就给出一段 ...
- Android绘制颜色渐变图形
Android 中的颜色渐变有三种类型: a. 线性渐变:linear b. 镜像渐变 : radial c. 圆锥角度渐变 : sweep 实现方式: xml布局中实现: 在drawable包中,使 ...
- matlab 数学建模 绘制颜色渐变的彩虹图
彩虹图 一个图 两个图 一个图 clc,clear x=linspace(0,8,200); % figure(1);ezplot('6*x+5*y1=60',[-1,9,-1,13]); % fig ...
- iOS 动画绘制线条颜色渐变的折线图
效果图 .................... 概述 现状 折线图的应用比较广泛,为了增强用户体验,很多应用中都嵌入了折线图.折线图可以更加直观的表示数据的变化.网络上有很多绘制折线图的demo,有 ...
- ios实现颜色渐变的几种方法
demo地址:https://github.com/xiaochaofeiyu/YSCAnimation 有用的话求个star,欢迎建议讨论. 1. CAGradientLayer实现渐变 CAGra ...
- Android Paint 绘制空心渐变圆角矩形
Android Paint 绘制空心渐变圆角矩形 在onDraw()中使用Paint绘制空心的圆角矩形 代码 @Overrideprotected void onDraw(Canvas canvas) ...
- OpenCV图像处理学习六,像素操作,使用line,ellipse,ellipse,rectangle,fillPoly函数绘制线、矩形、圆、椭圆等基本图形以及C++随机数产生器RNG的应用
一.Point与Scalar 使用cv::Point与cv::Scalar Point表示2D平面上一个点x,y Point p; p.x = 10; p.y = 8; 或者 p = Pont(10, ...
- matlab 多条函数颜色渐变(没多大用处)
多条函数颜色渐变(没多大用处) clc,clear; data=sin(linspace(0,2*pi,100)); for i=1:7plot((7-i)*data,'color',[0 1 0]* ...
最新文章
- Oracle中的 IN, NOT IN和 EXISTS, NOT EXISTS的區別
- Php魔术函数学习与应用 __construct() __destruct() __get()等
- springboot 替换tomcat_Spring Boot实战 之 解剖HelloWorld原型应用
- OA项目15:权限管理实体设计及映射
- 120天的烧脑只为孩子设计一套教具~
- python_10 迭代器和生成器
- logistic回归分析优点_逻辑回归的简单介绍
- jquery zTree异步搜索的例子--搜全部节点
- java学习笔记14-多态
- rand()函数实现原理:线性同余法
- steam错误代码100怎么办
- 怎么制作QQ背景音乐链接
- 软件需求的三个层次——业务需求、用户需求和功能需求的区别
- Android licenses not accepted
- 浅析我对Web(淘宝网)导航栏的深入理解
- 关于微信录音的坑-Linux服务器上进行音频格式的转换
- 6个理由告诉你为什么要用NAS
- Windows系统提示“telnet不是内部或外部命令,也不是可运行的程序或批处理文件”怎么办
- JSON转String
- StudyJams-第01课_初识Android的View(TextView、ImageView、Button)
热门文章
- nginx rtmp 编码_基于Nginx的媒体服务器技术
- python闭环最短路径_python实现最短路径的实例方法
- python后端服务器_毕设里配合Python后端使用的所谓”CGI服务器“
- tp5index.php怎么放外面,tp5如何隐藏index.php
- 华为如何拍火烧云_华为手机拍照功能介绍-设置通用功能
- MySQL中的事务日志
- 关于 项目中Ioc基础模块 的搭建 (已适用于.net core / .net Framework / Nancy)
- ASP.NET WebAPI 集成 Swagger 启用 OAuth 2.0 配置问题
- jquery 如何保存拖动空间的位置
- 自己实现苹果安装app动画