Results 1 to 2 of 2

Thread: Displaying Images

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    6

    Displaying Images

    I have recently started working in Openvg and I am using the iMX35board. I am not able to draw images(.png/bmp) . i will really appreciate if someone could point me in the right direction.

    Thanks

  2. #2

    Re: Displaying Images

    I load PNG files with either libpng or the Soil library. I then do the following to create a vgImage from the data:

    uint8_t *data; // this is a pointer to the decoded image
    int stride; // this the decoded data stride, maybe w*bpp (but not always)

    image = vgCreateImage(format, width, height, quality); // format is based on the loaded data (VG_lABGR_8888 for example)
    vgImagSubdata(image, data, stride, format, 0, 0, w, h);
    // you could not free data if you wanted

    Now to draw the image
    vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_TO_SURFACE)
    vgTranslate(x, y);
    vgDrawImage(image);

    This works for me, hope it helps,
    Brian
    Brian Edmond
    Crank Software Inc.
    Online: www.cranksoftware.com

Similar Threads

  1. Displaying images
    By pion in forum Developers Coding:Advanced
    Replies: 0
    Last Post: 12-06-2010, 10:14 PM
  2. Basic help with displaying images
    By flipscrackers in forum OpenVG and VGU
    Replies: 5
    Last Post: 10-12-2010, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •