Win32 绘图基础 -- 绘制直线、边框、贝塞尔曲线、填充、裁剪
目录(?)[+]
1.GDI
GDI 的一个主要目的就是支持与设备无关的图形。GDI提供了一种特殊的机制来彻底隔离应用程序和不同输出设备的特性,这样就可以支持与设备无关的图形。
2.设备环境
如果希望在图形输出设备上绘图,必须首先获取设备环境(即DC)的句柄。当Windows把这个句柄交给你的程序,Windows同时也就给予了你使用这个设备的权限。接着,在GDI函数中将这个句柄作为一个参数,告诉Windows在哪个设备上进行绘图。
设备环境中包含许多GDI函数如何工作的属性。
获取设备环境句柄:
1)在处理WM_PAINT消息时使用BeginPaint函数和EndPaint函数:
- HDC hdc;
- hdc = BeginPaint(hwnd, &ps);
- // ...
- EndPaint(hwnd, &ps);
2)在处理非WM_PAINT消息时由Windows程序获取:
- HDC hdc;
- hdc = GetDC(hwnd);
- //....
- ReleaseDC(hwnd, hdc);
3)获得用于整个窗口的,而不仅仅是窗口客户区的设备环境句柄:
- hdc = GetWindowDC(hwnd);
- // ...
- ReleaseDC(hwnd, hdc);
4)更通用的获取设备环境句柄的函数:
- hdc = CreateDC(pszDriver, pszDevice, pszOutput, pData);
- // ...
- DeleteDC(hdc);
获取当前整个屏幕的设备环境句柄:
- hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
5)处理位图时,有时可能会用到一个”内存设备环境“:
- hdcMem = CreateCompatibleDC(hdc);
- // ..
- DeleteDC(hdcMem);
可以把一个位图选入内存设备环境,并且调用GDI函数绘制这个位图
6)图元文件是以二进制形式编码的GDI函数调用的集合。它可以通过获取一个图元文件的设备环境来创建:
- hdcMeta = CreateMetaFile(pszFilename);
- // ...
- hmf = CloseMetaFile(hdcMeta);
3.设备的尺寸
”分辨率“:每度量单位(通常是英寸)中含有的像素数。
常用函数:
GetSystemMetrics、GetDeviceCaps.
4.色彩ABC
获取视频适配器板卡上的内存的组织形式:
1)色彩平面的数目:
- iPlanes= GetDeviceCaps(hdc, PLANES);
2)每个像素的颜色位数:
- iBitsPixel = GetDeviceCaps(hdc, BITSPIXEL);
5.点和线的绘制
1)点
- SetPixel(hdc, x, y, crColor);
- crColor = GetPixel(hdc, x, y);
2)直线
- MoveToEx(hdc, xBeg, yBeg, NULL);
- LineTo(hdc, xEnd, yEnd);
数组的点连成线:
- Polyline(hdc, apt, 5);
用Polyline实现绘制正玄曲线:
- /*-------------------------------------------------------------------
- SINEWAVE.cpp -- sine wave Using polyline
- --------------------------------------------------------------------*/
- #include <windows.h>
- #include <math.h>
- #define NUM 1000
- #define TWOPI (2*3.14159)
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- {
- static TCHAR szAppName[] = TEXT("SineWave");
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szAppName;
- if (!RegisterClass(&wndclass))
- {
- MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- return 0;
- }
- hwnd = CreateWindow(szAppName, TEXT("Sine Wave Using Polyline"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- static int cxClient, cyClient;
- HDC hdc;
- int i;
- PAINTSTRUCT ps;
- POINT apt[NUM];
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- return 0;
- case WM_PAINT:
- hdc = BeginPaint(hwnd, &ps);
- MoveToEx(hdc, 0, cyClient/2, NULL);
- LineTo(hdc, cxClient, cyClient/2);
- for (i = 0; i < NUM; i++)
- {
- apt[i].x = i*cxClient/NUM;
- apt[i].y = (int)(cyClient / 2 * (1-sin(TWOPI * i / NUM)));
- }
- Polyline(hdc, apt, NUM);
- EndPaint(hwnd, &ps);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
6.几个绘图函数:
- Rectangle(hdc, xLeft, yTop, xRight, yBottom);
- Ellipse(hdc, xLeft, yTop, xRight, yBottom);
- RoundRect(hdc, xLeft, yTop, xRight, yBottom, xCornerEllipse, yCornerEllipse);
- Arc(hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd);
- Chord(hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd);
- Pie(hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd);
绘图示例:
- /*-------------------------------------------------------------------
- lineDemo.cpp -- Line-Drawing Demonstration Program
- --------------------------------------------------------------------*/
- #include <windows.h>
- #include <math.h>
- #define NUM 1000
- #define TWOPI (2*3.14159)
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- {
- static TCHAR szAppName[] = TEXT("lineDemo");
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szAppName;
- if (!RegisterClass(&wndclass))
- {
- MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- return 0;
- }
- hwnd = CreateWindow(szAppName, TEXT("Line Demonstration"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- static int cxClient, cyClient;
- HDC hdc;
- PAINTSTRUCT ps;
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- return 0;
- case WM_PAINT:
- hdc = BeginPaint(hwnd, &ps);
- Rectangle(hdc, cxClient/8, cyClient/8, 7*cxClient/8, 7*cyClient/8);
- MoveToEx(hdc, 0, 0, NULL);
- LineTo(hdc, cxClient, cyClient);
- MoveToEx(hdc, 0, cyClient, NULL);
- LineTo(hdc, cxClient, 0);
- Ellipse(hdc, cxClient/8, cyClient/8, 7*cxClient/8, 7*cyClient/8);
- RoundRect(hdc, cxClient/4, cyClient/4, 3*cxClient/4, 3*cyClient/4, cxClient/4, cyClient/4);
- EndPaint(hwnd, &ps);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
7.贝塞尔样条曲线:
- /*-------------------------------------------------------------------
- bezier.cpp -- Bezier Splines Demo
- --------------------------------------------------------------------*/
- #include <windows.h>
- #include <math.h>
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- {
- static TCHAR szAppName[] = TEXT("Bezier");
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szAppName;
- if (!RegisterClass(&wndclass))
- {
- MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- return 0;
- }
- hwnd = CreateWindow(szAppName, TEXT("Bezier Splines Demo"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- void DrawBezier(HDC hdc, POINT apt[])
- {
- PolyBezier(hdc, apt, 4);
- MoveToEx(hdc, apt[0].x, apt[0].y, NULL);
- LineTo(hdc, apt[1].x, apt[1].y);
- MoveToEx(hdc, apt[2].x, apt[2].y, NULL);
- LineTo(hdc, apt[3].x, apt[3].y);
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- static POINT apt[4];
- int cxClient, cyClient;
- HDC hdc;
- PAINTSTRUCT ps;
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- apt[0].x = cxClient / 4;
- apt[0].y = cyClient / 2;
- apt[1].x = cxClient / 2;
- apt[1].y = cyClient / 4;
- apt[2].x = cxClient / 2;
- apt[2].y = 3 * cyClient / 4;
- apt[3].x = 3 * cxClient / 4;
- apt[3].y = cyClient / 2;
- return 0;
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
- case WM_MOUSEMOVE:
- if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)
- {
- hdc = GetDC(hwnd);
- SelectObject(hdc, GetStockObject(WHITE_PEN));
- DrawBezier(hdc, apt);
- if (wParam & MK_LBUTTON)
- {
- apt[1].x = LOWORD(lParam);
- apt[1].y = HIWORD(lParam);
- }
- if (wParam & MK_RBUTTON)
- {
- apt[2].x = LOWORD(lParam);
- apt[2].y = HIWORD(lParam);
- }
- SelectObject(hdc, GetStockObject(BLACK_PEN));
- DrawBezier(hdc, apt);
- ReleaseDC(hwnd, hdc);
- }
- case WM_PAINT:
- InvalidateRect(hwnd, NULL, TRUE);
- hdc = BeginPaint(hwnd, &ps);
- DrawBezier(hdc, apt);
- EndPaint(hwnd, &ps);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
8.填充区域
PeekMessage
在Windows中有很多”空闲时间“,在这期间所有的消息队列都是空的,Windows就在等待键盘或者鼠标的输入。那么能否在空闲期间从某种程度上获取控制,而一旦有消息加载到程序的消息队列,就释放控制呢?这就是PeekMessage的”用武之地“。
PeekMessage的意思,它是”偷看“而不是”获得“。它允许一个程序检查程序队列中的下一个消息,而不是真实地获得并删除它看到的消息。
GetMessage并不把控制权交还给程序,除非它从程序的消息队列中获得了消息。但PeekMessage却总是立即返回,不管消息是否出现。
随机矩形代码:
- /*-------------------------------------------------------------------
- randRect.cpp -- Displays Random Rectangles
- --------------------------------------------------------------------*/
- #include <windows.h>
- #include <stdlib.h>
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- void DrawRectangle(HWND);
- int cxClient, cyClient;
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- {
- static TCHAR szAppName[] = TEXT("RandRect");
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szAppName;
- if (!RegisterClass(&wndclass))
- {
- MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- return 0;
- }
- hwnd = CreateWindow(szAppName, TEXT("Rand Rectangle"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while (TRUE)
- {
- if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- {
- if (msg.message == WM_QUIT)
- break;
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- else
- {
- Sleep(100);
- DrawRectangle(hwnd);
- }
- }
- return msg.wParam;
- }
- void DrawRectangle(HWND hwnd)
- {
- HBRUSH hBrush;
- HDC hdc;
- RECT rect;
- if (cxClient == 0 || cyClient == 0)
- return;
- SetRect(&rect, rand() % cxClient, rand() % cyClient, rand() % cxClient, rand() % cyClient);
- hBrush = CreateSolidBrush(RGB(rand() % 256, rand() % 256, rand() % 256));
- hdc = GetDC(hwnd);
- FillRect(hdc, &rect, hBrush);
- ReleaseDC(hwnd, hdc);
- DeleteObject(hBrush);
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
9.矩形与区域的裁剪
InvalidRect函数使显示的矩形区域无效,并产生一个WM_PAINT消息。可以用来擦除客户区的内容,并产生一个WM_PAINT消息。
若处理区域而不是矩形可用:
InvalidateRgn(hwnd, hRgn, bErase);
ValidateRgn(hwnd, hRgn);
CLOVER程序:
由四个椭圆形成一个区域,然后把这个区域选入设备环境,接着从窗口的客户区中心发散绘制一系列直线。这些直线仅出现裁剪区内。
- /*-------------------------------------------------------------------
- clover.cpp -- Clover Drawing Program Using Regions
- --------------------------------------------------------------------*/
- #include <windows.h>
- #include <math.h>
- #define TWO_PI (2.0 * 3.14159)
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- void DrawRectangle(HWND);
- int cxClient, cyClient;
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- {
- static TCHAR szAppName[] = TEXT("clover");
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szAppName;
- if (!RegisterClass(&wndclass))
- {
- MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- return 0;
- }
- hwnd = CreateWindow(szAppName, TEXT("Draw a Clover"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- static HRGN hRgnClip;
- static int cxClient, cyClient;
- double fAngle, fRadius;
- HCURSOR hCursor;
- HDC hdc;
- HRGN hRgnTemp[6];
- int i;
- PAINTSTRUCT ps;
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
- ShowCursor(TRUE);
- if (hRgnClip)
- DeleteObject(hRgnClip);
- hRgnTemp[0] = CreateEllipticRgn(0, cyClient/3, cxClient/2, 2*cyClient/3);
- hRgnTemp[1] = CreateEllipticRgn(cxClient/2, cyClient/3, cxClient, 2*cyClient/3);
- hRgnTemp[2] = CreateEllipticRgn(cxClient/3, 0, 2*cxClient/3, cyClient/2);
- hRgnTemp[3] = CreateEllipticRgn(cxClient/3, cyClient/2, 2*cxClient/3, cyClient);
- hRgnTemp[4] = CreateRectRgn(0, 0, 1, 1);
- hRgnTemp[5] = CreateRectRgn(0, 0, 1, 1);
- hRgnClip = CreateRectRgn(0, 0, 1, 1);
- CombineRgn(hRgnTemp[4], hRgnTemp[0], hRgnTemp[1], RGN_OR);
- CombineRgn(hRgnTemp[5], hRgnTemp[2], hRgnTemp[3], RGN_OR);
- CombineRgn(hRgnClip, hRgnTemp[4], hRgnTemp[5], RGN_XOR);
- for (i = 0; i < 6; i++)
- DeleteObject(hRgnTemp[i]);
- SetCursor(hCursor);
- ShowCursor(FALSE);
- return 0;
- case WM_PAINT:
- hdc = BeginPaint(hwnd, &ps);
- SetViewportOrgEx(hdc, cxClient/2, cyClient/2, NULL);
- SelectClipRgn(hdc, hRgnClip);
- // hypot 计算直角三角形斜边的长
- fRadius = _hypot(cxClient/2.0, cyClient/2.0);
- for (fAngle = 0.0; fAngle < TWO_PI; fAngle += TWO_PI/360)
- {
- MoveToEx(hdc, 0, 0, NULL);
- LineTo(hdc, int(fRadius * cos(fAngle) + 0.5), int(-fRadius * sin(fAngle) + 0.5));
- }
- EndPaint(hwnd, &ps);
- return 0;
- case WM_DESTROY:
- DeleteObject(hRgnClip);
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
版权声明:本文为博主原创文章,未经博主允许不得转载。
Win32 绘图基础 -- 绘制直线、边框、贝塞尔曲线、填充、裁剪相关推荐
- WPF绘制光滑连续贝塞尔曲线
原文:WPF绘制光滑连续贝塞尔曲线 1.需求 WPF本身没有直接把点集合绘制成曲线的函数.可以通过贝塞尔曲线函数来绘制. 贝塞尔曲线类是:BezierSegment,三次贝塞尔曲线,通过两个控制点来控 ...
- 绘制二次贝塞尔曲线的几种方式
1.通过turf.js插件绘制 import * as turf from "@turf/turf";//P1,p2为起终点 export default function two ...
- Python+Matplotlib绘制三次贝塞尔曲线
开学第一课:一定不要这样问老师Python问题 中国大学MOOC"Python程序设计基础"第6次开课时间 董付国老师Python系列教材推荐与选用参考 ============= ...
- Python绘制三次贝塞尔曲线
对于贝塞尔曲线而言,其特点在于第一个控制点恰好是曲线的起点,最后一个控制点是曲线的终点,其他控制点并不在曲线上,而是起到控制曲线形状的作用.另外,曲线的起点处与前两个控制点构成的线段相切,而曲线的终点 ...
- 绘制二次贝塞尔曲线(二次贝兹曲线)等距线:让 IE 支持 canvas接口 isPointInPath
一.背景: 在使用 canvas 做知识图谱的时,实体关系使用线宽为 1px 的线绘制, 用户必须点在线上, 才能正常拾取到点击的边. 边关系,有些是直线边,有些是二次贝塞尔曲线.产品提议,线不能加粗 ...
- 用C语言绘制任意阶贝塞尔曲线(Bézier curve)
计算机图形学中贝塞尔曲线的绘制.使用的开发软件及版本为VS2015,以及 EasyX库.实现动态演示贝塞尔曲线实现的过程,且阶次不限! 源代码获取方式:1.添加微信(微信号:my_12581)获取.2 ...
- MFC鼠标绘制直线段并使用编码裁剪算法
聪明的你通过本文可以学会在MFC中 初始化时绘制自定义矩形框 使用鼠标来实时绘制你想要的直线段 实现编码裁剪算法裁去直线段在自定义矩形框以外的部分 完成效果如下 进入运行界面 鼠标绘制直线 编码算法裁 ...
- Path绘制动态的贝塞尔曲线、PathMeasure来绘制path动画
上一篇的波浪曲线是左右重复平移,这次是每一帧绘制一条线,组成上下浮动的曲线,下面是效果图 public WaveView(Context context, @Nullable AttributeSet ...
- Qt:QPainter重写mainwindows绘图事件绘制直线,弧线、设置画笔画刷
//光标定位到QPainter类名上,然后按下键盘上的F1按键,这时会自动跳转到该类的帮助页面 1.新建Qt Gui应用,名为MainWindow,基类为QMainWindow. 2.修改mainwi ...
最新文章
- mysql之子查询作业
- 51nod-正整数分组问题(基础方程DP-01背包)
- 接软件开发项目,你需要知道这些!
- spike 序列matlab,SPKtool1.0.1 神经信号spike 分类及处理 工具包 matlab 238万源代码下载- www.pudn.com...
- SpringBoot-核心功能
- python文件中写中文_解决python中csv文件中文写入问题
- 抓取html文件swf,如何把网页上的flash动画保存为swf格式文件(缓存提取)
- 详解GAMIT/GLOBK软件使用
- iOS开发各种证书详解
- python123第九周_我的python学习之路-基础3
- (转)国内外优秀的Web前端工程师
- Windows 编程基础(四)
- PS学习笔记------运用脚本及自动化批量处理
- 世界读书日送你畅销好书!前所未有4折购书福利
- 中美程序员不完全对比
- Postgresql杂谈 04—Postgresql中的五种常规索引
- 怎么处理微信web页面字体自动变大
- 乳腺癌诊断和药物技术行业调研报告 - 市场现状分析与发展前景预测
- Ubuntu 安装出现 error vmlinuz has invalid signature 【或者】 mmx64.efi not found
- 90 后高管:“下不手开除 70、80 后,公司死了谁负责?”
热门文章
- python解析十六进制字符串
- 高位缩量,暴跌还是洗盘?
- 苹果或在 WWDC20 期间发布自研 ARM 芯片的Mac:5nm+12核
- Mac简单的上手指南
- Bootstrap 附加导航(Affix)插件
- matlab画加速度响应频域曲线,车辆振动加速度响应分析的速度—频域方法
- libsvm java 实例_LibSvm流程及java代码测试
- spring security调用过程;及自定义改造
- XP正版序列号|XP好用的正版序列号
- 【ICLR 2018录用结果出炉】23篇oral干货,强化学习、对抗网络、可解释性最受关注...