替换MFC C++中的笔功能对于 .bmp
基本上我有一个程序可以移动用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,至少是这样。查找
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.