TILE_TRANS_2x2 problem

My image appears to be cropped by 1 pixel when I’m using TILE_TRANS_2x2 flag :confused: 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);

What target? This might be a minor 0.5 pixel bug :confused:

Neko, windows and android work fine. It seems that this problem occurs on flash only. Do you think that there is a way to fix this? : (

You can try https://github.com/as3boyan/TilesheetStage3D, you need to add some conditional compilation to your code.

Okay, thanks, this is good to know. The Flash implementation is there for compatibility, I’m sure there’s a solution to this :slight_smile:

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 :slight_smile:

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();

EDIT: I found some more information on this issue here http://simblob.blogspot.com/2009/11/flash-10-drawtriangles-disappointments.html