J'écris un rasterizer MovieClip qui pixellise toutes les images dans le MovieClip spécifié. Voici le code pour tramage:BitmapData cut-off
for (var i:int = start; i <= end; i++)
{
//goto the next frame
clip.gotoAndStop(i);
//get the bounds bounds = clip.getBounds(clip);
//create a new bitmapdata container bitmapData = new BitmapData( transformer.width == -1 ? bounds.width : transformer.width, transformer.height == -1 ? bounds.height : transformer.height, transformer.transparent, transformer.color );
if (transformer.matrix.tx == 0 && transformer.matrix.ty == 0) transformer.translateToZero(bounds);
//draw the bitmap data with the transformers bitmapData.draw( this._source, transformer.matrix, transformer.colorTransform, transformer.blendMode, transformer.clipRect, //new Rectangle(0, 0, bounds.width, bounds.height), transformer.smoothing );
//push the data on the array frames.push(bitmapData); }
Maintenant, le résultat est différent - http://i42.tinypic.com/lfv52.jpg - le noir est la version pixellisée (i utilisé une transformation de couleur sur elle pour le tester: P). Notez la tête et la chaussure gauche. Quelqu'un sait quel est le problème? J'ai vu des gens ajouter des pixels "supplémentaires" à leur boîte de limite au constructeur BitmapData, mais c'est la bonne solution.
Quelqu'un a-t-il eu une idée sur la façon de s'intégrer au personnage?
translateToZero fait ceci: _matrix.translate (-bounds.x, -bounds.y); // _ matrix = flash.geom.Matrix Il inverse les axes x et y actuels du MovieClip à zéro. Si je passe les limites au clipRect de la méthode BitmapData.draw 1/4 du movieclip est tiré puisque le MovieClip est centré. – Fristi