My image appears to be cropped by 1 pixel when I’m using TILE_TRANS_2x2 flag Without this flag everything works fine. Am I doing something wrong?
I’m using newest openfl/lime, here is my code:
var ts:Tilesheet = new Tilesheet(bitmap3.bitmapData);
ts.addTileRect(new Rectangle(0, 0, 50, 50));
var ns:Sprite = new Sprite();
addChild(ns).y = 300;
var renderArray:Array<Float> = [];
renderArray.push(0);
renderArray.push(0);
renderArray.push(0);
var matrix:Matrix = new Matrix();
renderArray.push(matrix.a);
renderArray.push(matrix.b);
renderArray.push(matrix.c);
renderArray.push(matrix.d);
ts.drawTiles(ns.graphics, renderArray, false, Tilesheet.TILE_TRANS_2x2); //this one is rendered wrong
ts.drawTiles(ns.graphics, [0, 100, 0], false);
I’m quite sure that the problem is caused by the third parameter of the drawTriangles function.
Code in Tilesheet class looks like this: graphics.drawTriangles(cast vertices, indices, uvtData); When I remove uvtData and render my image at position 0,0 it looks fine, nothing is cropped.
I’ll try to figure out what to do about it tomorrow
Damn this apears to be a problem with flash itself…I have tried using drawTriangles in pure as3 and it still crops my image O.o
Can someone test drawTriangles in flash? Am I doing something wrong here? I have tested on flash player 11.2 and 16 so I don’t think that this is a problem with version of the player.
var mc:MovieClip = new TileSongo();
var bdm:BitmapData = new BitmapData(50, 50, true, 0x00000000);
bdm.draw(mc);
var vert:Vector.<Number> = new Vector.<Number>();
var ind:Vector.<int> = new Vector.<int>();
var uvt:Vector.<Number> = new Vector.<Number>();
vert.push(0, 0, 50, 0, 50, 50, 0, 50);
ind.push(0, 1, 3, 1, 2, 3);
uvt.push(0,0, 1,0, 1, 1, 0, 1);
this.graphics.beginBitmapFill(bdm);
this.graphics.drawTriangles(vert, ind, uvt);
this.graphics.endFill();