dzimage Problem on VGA Devices

Discussion in 'Questions (Windows Mobile)' started by Drewpeu, Nov 26, 2008.

  1. Drewpeu

    Drewpeu Member Licensed User

    Hi,

    I have Image strips that I want to cut for a game project, I am using dzimage
    CopyImage to do this and it seems to be streching od double pixeling the
    Image!

    The image strip is 360x30 an contains 12 images at 30x30, I have only done
    four images before I saw the problem.
    See Attached Image.

    The Code is as follows:

    ImgBlank.Image = dr.CopyImage(source.image, 0,0,30,30)
    ImgDirt.Image = dr.CopyImage(source.image, 30,0,30,30)
    ImgWall.Image = dr.CopyImage(source.image, 60,0,30,30)
    ImgBoulder.Image = dr.CopyImage(source.image, 90,0,30,30)
    ImgDiamond.Image = dr.CopyImage(source.image, 120,0,30,30)

    Can you help?
    Regards,
    Andrew
     

    Attached Files:

  2. Cableguy

    Cableguy Expert Licensed User

    Are you sure about your image mode settings?
    Try other mode to see what happens.
     
  3. Drewpeu

    Drewpeu Member Licensed User

    Thanks for your reply Cableguy.

    I am not quite sure what you mean by Image Mode Settings!

    The image Control at the top is the image strip and has been set to cNormalImage 30x30.

    The image in this Control is 16 Million colours(24-bits) at 72 pixels per inch (ppi).


    The image controls below are also set to cNormalImage 30x30.

    I have created three versions of the image strip:

    Art1.bmp
    Art1.png
    Art1.jpg

    All at the above settings and the results are the same! :(

    I have also reduced the screen size to 320x240 with the same results! :(

    I have also reduced the Colours in the image strip to 256 still the same! :(

    Regards,
    Andrew
     
  4. agraham

    agraham Expert Licensed User

    It's always easier to help if you post a little app that shows the problem, then we can see it going wrong rather than guessing at might be happening.
     
  5. Drewpeu

    Drewpeu Member Licensed User

    Sorry!

    Please find attached as requested.

    Regards,
    Andrew.
     
  6. agraham

    agraham Expert Licensed User

    It's not a VGA device problem as it happens on the desktop as well.

    The problem is the ppi value of the bitmap. Set it to 96 with an image editor and all looks fine. Loading the the bitmap into an Image does what you think, it loads the raw bitmap into an Image of the size you expect from its pixel dimensions. The problem is that dz.CopyImage is not quite doing what you expect, it is not just transferring a subset of pixels from one bitmap to another but is actually "drawing" that portion of the bitmap on another bitmap. The action of drawing takes into account the ppi of the source image and the screen. The screen is usually 96 ppi (this is a nominal not necessarily an actual value) so a 30x30 pixel Image is nominally 0.3125 inches square. Your original image, at 72 ppi inch is actually bigger at 0.417 inches square so only a portion of it is drawn onto the smaller destination. This will also happen with Drawer.Image in the ImageLib library and DrawerEx.DrawImage in my ImageLibEx library.

    Make the image ppi smaller than 96, say 120, and you can better see what is happening. The whole image is drawn but is now smaller than the destination. I haven't checked but it is possible that a VGA screen on a device has a dpi value other than 96. You could check this with the DrawerEx.DpiX property in my ImageLibEx library.
     
  7. Cableguy

    Cableguy Expert Licensed User

    TRUE VGA usual dpi is 128
     
  8. Drewpeu

    Drewpeu Member Licensed User

    The reason I set my images to 72 ppi is that this is better for viewing on the
    WEB and I do a lot of graphics for WEB viewing.

    Image resolution is the number of pixels per unit of length of an image, and it is usually measured in pixels per inch (ppi).


    Monitor resolution, which is the number of pixels per unit of length on a monitor, is usually measured in dots per inch (dpi). The resolution of PC monitors is approximately 96 dpi.

    Thanks for the help you guys all is workig now. :)

    Regards,
    Andrew
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice