当前位置:网站首页>Image matrix transformation in gdi+
Image matrix transformation in gdi+
2022-06-09 12:45:00 【litanyuan】
background
Graph transformation refers to the translation of the drawn graph 、 rotate 、 Telescoping and other operations , from Graphics Class provides corresponding member functions for implementation .
stay GDI+ in , The matrix involved in matrix transformation , By a special matrix class Matrix To express , It's a 3x3 Matrix .
Translation transformation
void DemoGDI::DrawUser(HDC hdc)
{
Graphics graphics(hdc);// structure Graphics object
Pen m_pen(Color::Blue, 2);
Rect m_rect(30, 30, 180, 120);
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
Matrix m_matrix;// Unit rectangle
m_matrix.Translate(10, 20);// translation
graphics.SetTransform(&m_matrix);// Set the matrix transformation
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
}

Rotation transformation
void DemoGDI::DrawUser(HDC hdc)
{
Graphics graphics(hdc);// structure Graphics object
Pen m_pen(Color::Blue, 2);
Rect m_rect(30, 30, 180, 120);
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
Matrix m_matrix;// Unit rectangle
m_matrix.Rotate(10);// rotate 10
graphics.SetTransform(&m_matrix);// Set the matrix transformation
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
}

Specify point rotation
void DemoGDI::DrawUser(HDC hdc)
{
Graphics graphics(hdc);// structure Graphics object
Pen m_pen(Color::Blue, 2);
Rect m_rect(30, 30, 180, 120);
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
Matrix m_matrix;// Unit rectangle
m_matrix.RotateAt(20, PointF(120, 75));// Rotate around the center
graphics.SetTransform(&m_matrix);// Set the matrix transformation
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
}

Scaling transformation
void DemoGDI::DrawUser(HDC hdc)
{
Graphics graphics(hdc);// structure Graphics object
Pen m_pen(Color::Blue, 2);
Rect m_rect(30, 30, 180, 120);
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
Matrix m_matrix;// Unit rectangle
m_matrix.Scale(0.3f,0.3f);// Projection transformation
graphics.SetTransform(&m_matrix);// Set the matrix transformation
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
}

Projection transformation
void DemoGDI::DrawUser(HDC hdc)
{
Graphics graphics(hdc);// structure Graphics object
Pen m_pen(Color::Blue, 2);
Rect m_rect(30, 30, 180, 120);
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
Matrix m_matrix;// Unit rectangle
m_matrix.Shear(0.5f,0.5f);// Projection transformation
graphics.SetTransform(&m_matrix);// Set the matrix transformation
graphics.DrawRectangle(&m_pen, m_rect);// Draw a rectangle
}

边栏推荐
- UDP可靠性实践
- 安全编码之基于栈的缓冲区溢出
- Redis数据结构与介绍
- Excel | App_ Error in workbookactive cannot set the installed property of class addin
- . Net basic knowledge quick pass 8
- 推荐的十个Flutter插件
- Will investment and wealth management products lose the principal?
- Tag greedy - brush questions to prepare knowledge - greedy problem solving methods + lt.455 Distribute cookies + lt.376 Wobble sequence
- GameFi新的启程,AQUANEE将于6.9日登陆Gate以及BitMart
- Endnote | 如何快速分享文献给别人(包含题录+备注+pdf文件)| endnote保存备份
猜你喜欢

LR11 installation error: vc2005 is missing on this computer_ sp1_ with_ atl_ fix_ Redist, please install all missing required components, and then run this installation again.

JMeter安装教程

flutter 文件操作

Google Chrome plugin | pagenote page tag

ep240--leding

7. < tag backtracking and subset problem > lt.70 Subset + lt.90 Subset II

.NET基础知识快速通关11

这个MySQL数据库多表查询的第三问怎么做呀?

谢孟军:中国 Go 语言领军人创业第五年

Excel | App_WorkbookActive中存在错误不能设置类 Addin 的Installed属性
随机推荐
4. < tag backtracking, combination and pruning > lt.39 Combined sum + lt.40 Combined sum II DBC
Live broadcast preview | database salon – [special session on open source ecology]
Common laboratory tools | preparation of experimental solution | molarity calculator
Will investment and wealth management products lose the principal?
8. < tag backtracking and full arrangement > lt.46 Full Permutation + lt.47 Full arrangement II
[译]PostgreSQL 怎么通过vacuum 加速事务ID回收的速度
Safari的Favorites项不显示在主页上
谢孟军:中国 Go 语言领军人创业第五年
9. lt.491 Longest increasing subsequence
期货开户云,开户可靠安全吗??
Error in Library (patroon): there is no program package named 'patroon'
Leetcode camera minimum problem
Detailed explanation of LP mobile mining system development ecosystem
这个MySQL数据库多表查询的第三问怎么做呀?
stc8a8k_rgb___LED 888测试代码,还没测试
7. < tag backtracking and subset problem > lt.70 Subset + lt.90 Subset II
直播预告|数据库沙龙—【开源生态专场】
保姆级教程:如何成为Apache Linkis文档贡献者
期貨開戶雲,開戶可靠安全嗎??
盘点现有开源软件许可合规工具