Languages

Menu
Sites
Language
Problem with the alpha channel on portrait mode

We are using drawing on canvas on our application and found a problem after screen orientation change from landscape to portrait mode. It looks like new image on canvas composing with previous image. If you switch to landscape mode back everything looks fine again. We can try to avoid this problem by setting alpha channel of every picture pixel byte to zero, but this is performance expensive task.

OnDraw function example:

result formFrame::OnDraw() {
    Tizen::Graphics::Canvas * pCanvas = GetCanvasN();
	if (pCanvas != NULL) {
		Tizen::Graphics::BufferInfo bufferInfo;
		pCanvas->Lock(bufferInfo);
		for (int i = 0; i < bufferInfo.height*bufferInfo.pitch/4; ++i)
			*((int *)bufferInfo.pPixels + i) = 0x000000ff;
		for (int i = 0; i < 16*bufferInfo.pitch; ++i)
			*((int *)bufferInfo.pPixels + i + bufferInfo.pitch*bufferInfo.height/8) = 0x80000000;
		pCanvas->Unlock();
	}
	return E_SUCCESS;
}

At screen1 you can see screen after first redraw call, second screen after changing orientation to landscape and third after changing orientation back to portrait. On third screen you can see that canvas was merged with the previous image.

First Image  Second Image  Third Image

Archive with an example:

https://bugs.tizen.org/jira/secure/attachment/14205/alphaChannelOnCanvas.zip

 

Edited by: Sergey on 03 Jun, 2014

Responses

2 Replies
Alex Dem

Hi,
just fyi, on M1 with Partner-M1-20140428 it is reproduced also.
Alexey.

Alex Ashirov

Hi,

I have checked the example on my old device flashed with 2.2.0 and it looks fine. There are no any artifacts when I switch from portrait to landscape and vice versa. It seems that something has been broken recently.