4

GPU ロゴに似たもの、各コーナーに異なるフィルターが必要です。

GPU ロゴ

これまでのところ、これを達成することができましたが、画像サイズは元の半分です。ここに私のコードの簡略化:

_cropTopLeft = [[GPUImageCropFilter alloc] 
                initWithCropRegion:CGRectMake(0.0, 0.0, 0.5, 0.5)];

CGAffineTransform topLeftTransform = CGAffineTransformMakeTranslation(-1, -1);
topLeftTransform = CGAffineTransformScale(topLeftTransform, 0.5, 0.5);
_transformTL = [[GPUImageTransformFilter alloc] init];
_transformTL.affineTransform = topLeftTransform;


// Set up the pipeline: image -> crop -> transform 
//   I don't apply any effects to the corners for now, 
//   just try to recreate the original image

[imageSource addTarget:_cropTopLeft];
[_cropTopLeft addTarget:_transformTL];


// Same with the other corners... TR, BL & BR



// Recombine
// Can only apply 2 inputs to a blend filter, so combine using 3 filteres
// The blend filteres are `GPUImageNormalBlendFilter` instances

[_transformTL addTarget:_blendFilterTop];
[_transformTR addTarget:_blendFilterTop];
[_transformBL addTarget:_blendFilterBottom];
[_transformBR addTarget:_blendFilterBottom];

[_blendFilterTop addTarget:_blendFilterAll];
[_blendFilterBottom addTarget:_blendFilterAll];

[_blendFilterAll addTarget:_myGPUImageView];

問題は、画像の角がトリミングされると、キャンバスのサイズが半分になることです。

この半分のサイズは、パイプラインを通じて使用されると思います。

私の回避策は、変換で再び角を半分にすることでしたが、これにより 1/2 解像度の出力画像が得られます。

4

1 に答える 1