CGContextDrawImageCGContextRef
CGContextDrawImage is a function in the Core Graphics framework of Apple's iOS and macOS operating systems. It is used to draw an image into the current graphics context. The function takes three parameters: the graphics context, a rectangle in which to draw the image, and the image to be drawn. The rectangle specifies the size and position of the image within the context. The image is scaled to fit within the rectangle, preserving its aspect ratio. If the rectangle's aspect ratio does not match the image's, the image will be letterboxed or pillarboxed to fit. This function is commonly used in custom drawing routines, such as those in UIView or NSView subclasses, to render images on the screen. It provides a straightforward way to integrate images into the drawing process, allowing for precise control over their placement and size.