DrawingContext dc; // create drawing context Window win; // create window object dc.push_target(win); // set window as drawing target dc.draw_line(Point(0, 0), Point(100, 100)); // draw line on window
DrawingContext dc; Bitmap bmp(200, 200); // create a 200x200 bitmap dc.push_target(bmp); // set bitmap as drawing target dc.draw_rect(Rect(50, 50, 100, 100)); // draw a filled rectangleIn this example, a DrawingContext object is created and a Bitmap object is created with a size of 200x200 pixels. push_target is used to set the bitmap as the current drawing target, and a filled rectangle is drawn to the bitmap using DrawContext. Package Library: Once again, DrawingContext is likely part of a larger graphics or UI library for C++. The use of Bitmap suggests that this library may be focused on image manipulation or graphics editing.