Se si desidera mascherare qualsiasi SKNode/SKSpriteNode con un effetto anti-aliasing - è possibile utilizzare al posto di SKEffectNode SKCropNode. Funziona anche con i nodi animati. Ecco un esempio:
// Set up your node
SKNode *nodeToMask = [SKNode node];
// ...
// Set up the mask node
SKEffectNode *maskNode = [SKEffectNode node];
// Create a filter
CIImage *maskImage = [[CIImage alloc] initWithCGImage:[UIImage imageNamed:@"your_mask_image"].CGImage];
CIFilter *maskFilter = [CIFilter filterWithName:@"CISourceInCompositing"
keysAndValues:@"inputBackgroundImage", maskImage, nil];
// Set the filter
maskNode.filter = maskFilter;
// Add childs
[maskNode addChild:nodeToMask];
[scene addChild:maskNode];
potresti condividere il codice che hai utilizzato per ottenere la maschera? – ZeMoon
appare pixelato solo sul simulatore o sul dispositivo ?? –
In base alle specifiche, avrà sicuramente bordi frastagliati, poiché SKCropNode utilizza un valore alfa booleano (0 o 1), non un valore di byte (per esempio, da 0 a 255). –