Hi,
I want to make circle Image, dynamically, in my program. I made an image with render to texture in Ogre and in CEGUI I want to transform this image to be a circle. I think I have to add alpha on my image but i don't know how to do this in my program. an idea ?
Sorry for my english
A+
I want to make circle Image
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
This topic has been asked several times in the past. Have you tried searching the forum or searching the wiki? You might try searching for terms like: circle, round, alpha, etc.
Make sure you fulfill the Forum Usage Guidelines as community members will be more inclined to help you, if you show that you have followed them. Thanks!
Make sure you fulfill the Forum Usage Guidelines as community members will be more inclined to help you, if you show that you have followed them. Thanks!
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
Ok i've search and I've not found any topic that answer my question
I found these topic and some others about circle image :
viewtopic.php?f=10&t=2151
viewtopic.php?f=10&t=5397
viewtopic.php?f=2&t=4903
But all of these, it tell to use .png or targa image or to use property alpha.
But that I want is to make alpha at some location in my image to render it like a circle and I can't use a .png because my image is create in my program
Sorry for my english
I found these topic and some others about circle image :
viewtopic.php?f=10&t=2151
viewtopic.php?f=10&t=5397
viewtopic.php?f=2&t=4903
But all of these, it tell to use .png or targa image or to use property alpha.
But that I want is to make alpha at some location in my image to render it like a circle and I can't use a .png because my image is create in my program
Sorry for my english
Re: I want to make circle Image
dragonblood wrote:But that I want is to make alpha at some location in my image to render it like a circle and I can't use a .png because my image is create in my program
Well it does not really matter how the image is made, so long as the image uses alpha. A .png is just an image format that supports alpha. Your best option is to still use alpha-transparency to manually clip (shape) your imagery. If you create the image dynamically within the program, then you also need to dynamically apply transparency to the image. How you go about doing that is not really a concern of CEGUI. This is because CEGUI is not designed to be an image-manipulation library, rather it combines user-specified imagery and user-specified input to form an interactive GUI.
That said, I suppose one approach would be some form of masking. You would apply the mask by dynamically adding alpha-transparent pixels to the image either during creation or in post-processing. If you are already creating the image dynamically at run-time, it should be a fairly trivial step from there to add alpha-transparency to it.
Note that once you start using non-rectangular geometry you may want to clip your input regions as well. CE has already written an article on hit testing on the wiki.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
Hi,
Ok this is the subject of my topic... But how can I do that ? there is any example ?
Your best option is to still use alpha-transparency to manually clip (shape) your imagery
"by dynamically adding alpha-transparent pixels to the image either during creation or in post-processing.
it should be a fairly trivial step from there to add alpha-transparency to it."
Ok this is the subject of my topic... But how can I do that ? there is any example ?
Re: I want to make circle Image
I don't understand what's your problem really.
Do you know the concept of alpha transparency?
Do you know the concept of alpha transparency?
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
Yes I know the concept of alpha transparency but I don't know how to add transparency to a CEGUI::Image. If you know you could tell me ?
Re: I want to make circle Image
Make a buffer, put the colours there, load that into CEGUI::Image, boom!
I am really confused what the problem is. Are you expecting me to write the code for you?
I am really confused what the problem is. Are you expecting me to write the code for you?
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
I try this code just to test but nothing happen
My texture is the same. There is no change
I am lost ,Someone have an idea ?
Code: Select all
// I send my Ogre::Texture to CEGUI::Texture
CEGUI::Texture &ceguiTexture = CEGUI::OgreRenderer::create().createTexture(pTexture);
// I create Imageset and image
CEGUI::Imageset &imageSet = CEGUI::ImagesetManager::getSingleton().create(mName+"/CibleImageset", ceguiTexture);
CEGUI::Image mImage=imageSet.getImage(mName+"/CibleImage");
// I create a buffer
CEGUI::GeometryBuffer &mBuffer= CEGUI::OgreRenderer::create().createGeometryBuffer();
mBuffer.setActiveTexture(&ceguiTexture);
CEGUI::Vector2 *mVector=new CEGUI::Vector2(0.1,0.1);
CEGUI::Size *mSize=new CEGUI::Size(ceguiTexture.getSize());
CEGUI::Rect *mRect=new CEGUI::Rect(0.5,0.1,5.0,1.0);
CEGUI::Rect *mRect2=new CEGUI::Rect(1.0,1.1,12.0,9.0);
CEGUI::Rect *mRect3=new CEGUI::Rect(1.0,1.1,12.0,9.0);
CEGUI::ColourRect *mColorRect=new CEGUI::ColourRect(CEGUI::colour(0xFFAABB00));
mColorRect->setAlpha(0.5);
// I try to change the texture
for (int i=0;i<=ceguiTexture.getSize().d_height;i++){
for (int j=0;j<=ceguiTexture.getSize().d_width;j++){
mVector->d_x++;
mVector->d_y++;
mRect->d_bottom++;
mRect->d_left++;
mRect->d_right++;
mRect->d_top++;
mRect2->d_bottom++;
mRect2->d_left++;
mRect2->d_right++;
mRect2->d_top++;
mSize->d_height++;
mSize->d_width++;
mImage.draw(mBuffer, *mRect, *mRect2, mRect3,*mColorRect );
}
}
// I create another imageset with the texture in the buffer
CEGUI::Imageset &imageSet2 = CEGUI::ImagesetManager::getSingleton().create(mName+"/CibleImageset", *mBuffer.getActiveTexture());
//then I create another Image with imageSet2 and I put It in a CEGUI::Window
......
My texture is the same. There is no change
I am lost ,Someone have an idea ?
Re: I want to make circle Image
I am sorry if this offends you but I am not sure if you are trolling or what.
Are you just randomly writing code that incidentally compiles and expecting it to work like you want?
Read API docs of the methods. You are doing something completely different from what you want to be doing.
Are you just randomly writing code that incidentally compiles and expecting it to work like you want?
Read API docs of the methods. You are doing something completely different from what you want to be doing.
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
I post here to have some help, if you know how to do that why you're not helping me instead of make fun of me. I don't expect you to write all the code for me but I ask for an exemple.
Last edited by dragonblood on Fri Dec 30, 2011 17:14, edited 1 time in total.
Re: I want to make circle Image
if you are trying to create an 32bit image (RGB and alpha) use libPng. then load created image to cegui.
creating image pixel by pixel is not cegui's job.
check http://libpng.org/pub/png/libpng.html
creating image pixel by pixel is not cegui's job.
check http://libpng.org/pub/png/libpng.html
-
- Just popping in
- Posts: 17
- Joined: Mon Dec 05, 2011 13:23
Re: I want to make circle Image
saejox wrote:if you are trying to create an 32bit image (RGB and alpha) use libPng. then load created image to cegui.
creating image pixel by pixel is not cegui's job.
check http://libpng.org/pub/png/libpng.html
Ok, thanks to answer, I did'nt know there was impossible to do that in CEGUI...
Re: I want to make circle Image
http://www.cegui.org.uk/docs/current/cl ... f475c20da2
Texture::loadFromMemory
CEGUI 0.8 (unreleased yet) also has texture blitting.
Texture::loadFromMemory
CEGUI 0.8 (unreleased yet) also has texture blitting.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests