答案 0 :(得分:2)
您基本上只想将心脏模板的不透明度复制到汽车图片中。所以,在命令行,你会这样做:
#!/usr/local/bin/php -f
<?php
$template=new Imagick('heart.png');
$image =new Imagick('motor.jpg');
# Copy alpha from template over car image
$image->compositeImage($template,imagick::COMPOSITE_COPYOPACITY,0,0);
$image->writeImage('result.png');
?>
在PHP中:
Task<List<MyBusinessObject>>[] tasks = new Task<List<MyBusinessObject>>[MyCollection.Count];
for (int i = 0; i < MyCollection.Count; i++)
{
MyDTO dto = new MyDTO();
--Some Property Assignment for the MyDTO object--
tasks[i] = Task<List<MyBusinessObject>>.Factory.StartNew(MyDelegate, dto)
}
try
{
Task.WaitAll(tasks);
}
catch (AggregateException e)
{
AddToLogFile("Exceptions thrown by WaitAll() : ");
for (int j = 0; j < e.InnerExceptions.Count; j++)
{
AddToLogFile(e.InnerExceptions[j].ToString());
}
}
catch(Exception ex)
{
AddToLogFile(ex.Message);
}