Page 1 of 1

It's urgent - Image Drawing

Posted: Mon Jun 06, 2005 11:05
by parul
Hi All,

I have one basic query regarding image drawing. I am using defineImage function of image set class to define image and draw function of Image class for drawing the image.

1) If i give size of the image same as actual image size it draws the proper image.
2) but If i give size smaller then the actual image size, then imgae cuts down. i.e. it picks up specified no of pixels from the image.
3) and if i give size greater then the actual image size then it fills the remaining area of image with white space.

but i want to Stretch and compress the image according to given size of the image. Is their any method in CEGUI or OGRE to support image Comression and Stretch so that when i will define the image with different sizes then application shows the complete image.

i am waiting for response. it's really very urgent. i am not able to proceed without solving this problem.

Thanks,
Parul

Re: It's urgent - Image Drawing

Posted: Mon Jun 06, 2005 14:57
by lindquist
Are you using a StaticImage or are you writing the draw code yourself?

CEGUI::StaticImage has a h/v-formatting setting that you can use to control these things.

Code: Select all

enum HorzFormatting {
  LeftAligned, RightAligned, HorzCentred, HorzStretched,
  HorzTiled
};

enum VertFormatting {
  TopAligned, BottomAligned, VertCentred, VertStretched,
  VertTiled
};


use the member functions:

Code: Select all

StaticImage::setHorizontalFormatting
StaticImage::setVerticalFormatting

to set the horz/vert formatting.


as to writing your own draw code.
All you should have to do is calculate the right pixel-rectangle that you wan't the image to be drawn inside.
The texture-coordinates should not change, and the image will stretch/shrink all by itself to fit that rectangle.

HTH

Re: It's urgent - Image Drawing

Posted: Tue Jun 07, 2005 07:29
by parul
Hi

Thanks a lot.

Regards,
parul