locked
How to show image in byte buffer in full device resolution?

    Question

  • I have an UI engine which can render bitmap into a byte buffer, and now I have a problem: I can only show scaled output. I.e. when I query device for the resolution to define the buffer dimensions, I get the scaled dimensions which are less than the physical ones, and then WinRT scales my bitmap output which of course causes blurriness.

    My question is whether I can draw true physical device resolution images out of a byte buffer?

    I am now using image on canvas:

    <Canvas x:Name="canvas" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Image x:Name="img" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </Canvas>
    and a WritableBitmap as image source so it takes the entire screen:
    #if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
    	float fWidth = ApplicationView::GetForCurrentView()->VisibleBounds.Width;
    	float fHeight = ApplicationView::GetForCurrentView()->VisibleBounds.Height;
    #else
    	float fWidth = Window::Current->Bounds.Width; 
    	float fHeight = Window::Current->Bounds.Height; 
    #endif	
    
    m_bmp = ref new WriteableBitmap((int)fWidth, (int)fHeight);
    img->Source = m_bmp;
    
    I know how to get the real picture size, but if I put the real dimensions, the image just extends beyond the screen bounds.
    Wednesday, October 01, 2014 12:48 AM

Answers

  • Hi Michael,

    What do you mean by "I can only show scaled output", can I simply understand as you have a 1600*900 screen but you can only get the a smaller size due to the pixel density scaling?

    Check out the Scaling to pixel density documentation, I believe ResolutionScale | resolutionScale property might help you with your situation.

    If I have some misunderstanding, please explain more with us.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, October 01, 2014 2:43 AM
    Moderator