我正在使用这个方法来合并两个NSImages:
它会生成一个正确尺寸的图像(两个2100x63的图像将生成一个100x126的图像),但是两个单独的图像绘制得太小,因此生成的图像大多为空白:
以下是原始图像:
newImage = [[NSImage alloc] initWithSize:NSMakeSize(size1.width,
size1.height + size2.height)];
[newImage lockFocus];
[firimage drawAtPoint:NSMakePoint(0, 0)
fromRect:NSMakeRect(0, 0, size1.width, size1.height)
operation:NSCompositeSourceOver
fraction:1.0];
[secimage drawAtPoint:NSMakePoint(0, size1.height)
fromRect:NSMakeRect(0, 0, size2.width, size2.height)
operation:NSCompositeSourceOver
fraction:1.0];
[newImage unlockFocus];
它会生成一个正确尺寸的图像(两个2100x63的图像将生成一个100x126的图像),但是两个单独的图像绘制得太小,因此生成的图像大多为空白:
以下是原始图像:
![Image 1](https://istack.dev59.com/Aa5jT.webp)
![Image 2](https://istack.dev59.com/HsDRU.webp)
compositeToPoint:
已经被弃用了吗? - foundry