vadim Posted March 3, 2016 Share Posted March 3, 2016 Hi, I have started to work with pixi I tried to draw a simple rectangle as a canvas border If I use point (0,0) for it, my rectangle doesn't have two sides I have correct rectangle only in case of graphics.drawRect(0, 1, 99, 99) Is this a bug or feature? What is the real starting point and size of the working area in pixi? Code: var renderer = PIXI.autoDetectRenderer(100, 100, { backgroundColor: 0xeeeeee, antialias: false }); document.body.appendChild(renderer.view); var stage = new PIXI.Container(); var graphics = new PIXI.Graphics(); stage.addChild(graphics); graphics.lineStyle(1, 0x000000, 1); graphics.drawRect(0, 0, 100, 100); renderer.render(stage); Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 3, 2016 Share Posted March 3, 2016 Try use (0.5, 0.5, 99.5, 99.5) That's how canvas context2d works too. The thing is, you must specify the middle of the line, and if line has width 1 , you have to specify x + 0.5 . If you specify just x, your line will have width 2 width alpha 0.5, but pixi doesnt do antialiasign so we have that strange result. If you consider that pixel (0,0) is actually rectangle (0,0)-(1,1) you'll understand that logic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.