Replacing the pen function in MFC C++ for a .bmp

198 views Asked by At

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])

;

1

There are 1 answers

0
Jerry Coffin On

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.