Listing 7: Shows where the drawing is controlled

void CImageBitmap::Transform(CImageBitmap *In, CPoint *TopLeft,
        CPoint *BottomLeft, CPoint *TopRight, CPoint *BottomRight,
        CPoint *Offset) {
    CIBHelper *p = *In;
    BITMAP *b = *In;

    // 1.
    /* controllers for moving the end points
        of the line to be stretched */
    DeltaControlLine left(TopLeft, BottomLeft);
    DeltaControlLine right(TopRight, BottomRight);
    DeltaControlPair output_y(&left, &right);

    // 2.
    // controller for moving down the input Y direction
    DeltaControl input_y; input_y.SetTo(b->bmHeight, 0);
    DeltaControlPair process_y(&input_y, &output_y);

    // 3.
    // outer loop
    do {
        // controller for outputing pixels in X direction
        DeltaControl input_x; input_x.SetTo(b->bmWidth, 0);
        CPoint pt(0, input_y.GetMajor());
        CIBLine output_x(&left, &right, &pt, p, Offset,
            *this);
        DeltaControlPair process_x(&input_x, &output_x);

        // inner loop
        do { pt.x = input_x.GetMajor();
        } while (process_x.Next());
    } while (process_y.Next());

    // update our CBitmap object
    SetBitmapBits(*m_Private, *m_Private);
}
— End of Listing —