我有一个基本图像(baseImage.jpg),我想添加另一个图像(addImage.jpg),但我想先旋转addImage.jpg。因为用户可以更改addImage的位置和旋转,所以我需要将addImage的旋转基于其自身的中心点而不是基于baseImage.jpg的大小/点。
问题是,我该怎么做?我可以将addImage放入自己的图形对象中 - 但是如何将其恢复到原始的baseImage图形对象中呢?我真的不想保存它(因为会有数千次迭代)。以下是一些示例代码:
Dim addImage As Bitmap = New Bitmap("addImage.jpg")
Dim x As Matrix
x = New Matrix()
'rotates in the center of the addImage.jpg
x.RotateAt(rotation, New PointF(addImage.width / 2, (addImage.height / 2))
Dim rGraphic As Graphics
rGraphic = Graphics.FromImage(addImage)
rGraphic.Transform = x
'Now my addImage.jpg is rotated - but how do I add it to my baseImage.jpg?
Dim baseImage As Bitmap = New Bitmap("baseImage.jpg")
oGraphic = Graphics.FromImage(baseImage)
'Is there a way to add the output of rGraphic to oGraphic without saving it off to disk?