替换MFC C++中的笔功能对于 .bmp

发布于 2024-12-11 14:18:21 字数 1043 浏览 0 评论 0原文

基本上我有一个程序可以移动用 MFC 中的钢笔工具绘制的线条。我使用滑块来操作钢笔工具。我只是想知道是否可以用 .bmp 代替钢笔工具?这是一些示例代码

 if (thePart->GetType() == PART_LINKAGE)
            {
               // draw control link pin in black
               dc.SelectObject(&Pen[3]);
               theNewPos = thePart->Getpoint();
                  dc.MoveTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)) - 5,   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) ); 
                  dc.LineTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)) + 4,   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) ); // 
                  dc.MoveTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)),   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) - 5); 
                  dc.LineTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)),   
                                      cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) + 4); 
               dc.SelectObject(&Pen[iID])

Basically I have a program that moves lines drawn with the pen tool in MFC. I manipulate the pen tool by using a slider. I was just wondering if it was at all possible to replace the pen tool with using a .bmp? Here is some example code:

 if (thePart->GetType() == PART_LINKAGE)
            {
               // draw control link pin in black
               dc.SelectObject(&Pen[3]);
               theNewPos = thePart->Getpoint();
                  dc.MoveTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)) - 5,   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) ); 
                  dc.LineTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)) + 4,   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) ); // 
                  dc.MoveTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)),   
                                cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) - 5); 
                  dc.LineTo( cx + (int32_t)(fScale * (theNewPos.GetX()+fx)),   
                                      cy - (int32_t)(fScale * (theNewPos.GetY()+fy)) + 4); 
               dc.SelectObject(&Pen[iID])

;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没企图 2024-12-18 14:18:21

当然,至少是这样。查找 LineDDA。它会给你线上每个像素的点;您可以根据这些点将位图传输到正确的位置。

Sure, at least sort of. Look up LineDDA. It'll give you the point of each pixel on the line; it'll be up to you to blit your bitmap into the correct positions based on those points.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文