NSAutoreleasePool
*pool = [[
NSAutoreleasePool
alloc
]
init
];
UIGraphicsBeginImageContext(mainImg
.size
);
[mainImg
drawInRect
:CGRectMake(
0
,
0
, mainImg
.size
.width
, mainImg
.size
.height
)];
int
i =
0
;
for
(
UIImage
*img
in
imgArray) {
[img
drawInRect
:CGRectMake([[imgPointArray
objectAtIndex
:i]
floatValue
],
[[imgPointArray
objectAtIndex
:i+
1
]
floatValue
],
img
.size
.width
,
img
.size
.height
)];
i+=
2
;
}
CGImageRef
NewMergeImg
= CGImageCreateWithImageInRect(UIGraphicsGetImageFromCurrentImageContext()
.CGImage
,
CGRectMake(
0
,
0
, mainImg
.size
.width
, mainImg
.size
.height
));
UIGraphicsEndImageContext();
[pool
release
];
if
(
NewMergeImg
==
nil
) {
return
NO
;
}
else
{
UIImageWriteToSavedPhotosAlbum([
UIImage
imageWithCGImage
:NewMergeImg],
self
,
nil
,
nil
);
return
YES
;
}