falagard image section specific clipping
Posted: Fri Nov 05, 2010 10:32
Hello!
I want to make a falagard looknfeel for an image button. This Button contains:
* an imagery section of the buttons outer frame component
* an imagery section of the buttons inner frame component
* an imagery section of the buttons background
* an imagery section of the buttons foreground image
The frame components are transparent in such a way, that you can overlay them on any background and they will look like a Button with its frame modulated with the respective back ground colors.
The outer frame works as the outer relief component to make the respective Button background look like it has a flattened border towards the button, even if the background is unicolored.
The inner frame works as the inner relief component, which should be rendered above the button background and foreground image to make them look buttonlike. That way one could form any button with this relief style and replace background/foreground images without having to supply additional images.
So far all of this works fine. The problem, which let me stumble, lies in the pushed state imagery.
If the button is pushed, i want to take the forground image and display it right-down shifted from its normal position. I would do this by defining a pushed_foreground imagery with an area, which is shifted right and down by a specified offset.
If the foregroundimage is large enough or stretched to fill the same area as the inner frame component in normal state, some pixel rows would get displayed outside the inner frame in pushed state, because it still lies in the window area and won't be clipped, because of the outer frame component of the button.
I wondered if there is a way to clip a specific falagard imagery section to a user specified clipping rect.
The only two ways i could think of without adding or changing CEGUI code is to add the outer frame component als child window to the looknfeel and to turn off clipping by parent for it. The window size can then be adjusted to the inner frame component and would do the needed clipping.
Another possibility could be to define two images out of a specific image set, one containing the whole image and one covering only a subset. And then use this subset image for the foreground in pushed state. But this is a very ugly solution and wouldn't be suitable for having dynamic rendered foreground images, i think.
One other, more general, solution could be to add a possibility to specify a clipping rect per state imagery section. This would allow other things like taking any subset of an imagery and render it, without having to make any contortions.
The last solution would be my favorite one. However, it is only achievable by modifying the CEGUI falagard base system, i think.
Is there a more suitable way, which i might have overlooked?
If you think the last solution would be desirable, i might consider to code the needed changes.
Yours sincerely,
Grimmigbeisser
I want to make a falagard looknfeel for an image button. This Button contains:
* an imagery section of the buttons outer frame component
* an imagery section of the buttons inner frame component
* an imagery section of the buttons background
* an imagery section of the buttons foreground image
The frame components are transparent in such a way, that you can overlay them on any background and they will look like a Button with its frame modulated with the respective back ground colors.
The outer frame works as the outer relief component to make the respective Button background look like it has a flattened border towards the button, even if the background is unicolored.
The inner frame works as the inner relief component, which should be rendered above the button background and foreground image to make them look buttonlike. That way one could form any button with this relief style and replace background/foreground images without having to supply additional images.
So far all of this works fine. The problem, which let me stumble, lies in the pushed state imagery.
If the button is pushed, i want to take the forground image and display it right-down shifted from its normal position. I would do this by defining a pushed_foreground imagery with an area, which is shifted right and down by a specified offset.
If the foregroundimage is large enough or stretched to fill the same area as the inner frame component in normal state, some pixel rows would get displayed outside the inner frame in pushed state, because it still lies in the window area and won't be clipped, because of the outer frame component of the button.
I wondered if there is a way to clip a specific falagard imagery section to a user specified clipping rect.
The only two ways i could think of without adding or changing CEGUI code is to add the outer frame component als child window to the looknfeel and to turn off clipping by parent for it. The window size can then be adjusted to the inner frame component and would do the needed clipping.
Another possibility could be to define two images out of a specific image set, one containing the whole image and one covering only a subset. And then use this subset image for the foreground in pushed state. But this is a very ugly solution and wouldn't be suitable for having dynamic rendered foreground images, i think.
One other, more general, solution could be to add a possibility to specify a clipping rect per state imagery section. This would allow other things like taking any subset of an imagery and render it, without having to make any contortions.
The last solution would be my favorite one. However, it is only achievable by modifying the CEGUI falagard base system, i think.
Is there a more suitable way, which i might have overlooked?
If you think the last solution would be desirable, i might consider to code the needed changes.
Yours sincerely,
Grimmigbeisser
