Page 1 of 1

PostPosted: Wed Jul 10, 2002 8:28 pm
by design4use
I was wondering whether bitmaps either embedded or added to a project could have a transparency flag set such that every pixel with color e.g. rgb 255,0,255 would render transparent/as background color.
I noticed this seems to be the case for the application icons where pink areas render trasnparent. Is this possible with Orbworks now? If not please consider it a request :-)

PostPosted: Wed Jul 10, 2002 9:31 pm
by PenreeSoft
You could always test it :)

If you want it, RsrcEdit can do it...

Nicholas J. Penree

PostPosted: Fri Jul 12, 2002 4:01 am
by dewey
The color 255,128,255 (a shade of pink) will be treated as transparent in all bitmaps/icons >= 4 bits per pixel. I can't seem to find that in the docs, so I will add it.

PostPosted: Wed Jul 17, 2002 6:14 pm
by design4use
For some reason this does not seem to work for me. I have images embedded in a Ui Gadgets, each of which includes an 8-bit version. Each of the images has an area filled with the color 255,128,255 (verified x times with photshop and other imaging programs). I then draw the image, which works, but the pink area that is supposed to be trasnparent, draws white regardless of what the underlying color on the gagdet was at that position and regardless of what I set the bg color of the draw object to. How is it supposed to behave? Anythink I can look out for to fix this?

PostPosted: Sun Jul 21, 2002 5:02 pm
by dewey
There was a related bug in v1.1, but I don't know if it affects this problem. Try this again with v1.1.1 when it is released (early this week). If it is still not working, email me the project.

PostPosted: Tue Jul 23, 2002 5:19 pm
by design4use
So I upgraded to 1.1.1 when it came out and the code behaves the same. So I wonder what should I be seeing when I draw, say, a rectangle in dark blue and then draw a picture on top of that? Currently the "transparent" areas are drawn in white, regardless of the settings of the Draw object. I will try to create the smallest possible project that is able to highlight the problem and will send it to you...

PostPosted: Fri Jul 26, 2002 3:45 pm
by design4use
It turns out there was little wrong with the code I tested, not with OrbWorks, but instead one of the graphic conersion programs shifted the palette entry that was thought to be transparent to a color slightly different then 255,128,255. So once I used the supplied examples for the sample application icon things looked great and transparency worked. For those interested how it was tested, here is an example source code for a UIGadget that draws a blue rect on a white background, then draws an image with transparency right over the edge between white and blue backgrounds:

// gadget declaration

@bitmap Bitmap transpTest {
id = 3010
image1 = "icon_l1.bmp"
image8 = "icon_l8.bmp"

object myGadget {
// A UIGadget must always be the first member of a gadget
UIGadget gadget;
Draw draw, dBuffer;
// default event handlers
void onopen();
void ondraw();

void testDraw();

void myGadget.onopen() {
// attach Draw to gadget

void myGadget.ondraw() {
// call test function

void myGadget.testDraw() {
int prev, i;
//create a buffer the size of gadget
//draw things into the buffer
prev = dBuffer.fg(83);
//draw a rectangle in blue
dBuffer.rect(clrFG,1,gadget.h/2,gadget.w, gadget.h, 0);
//draw a transparent image just over the edge between white bg and blue rect
dBuffer.bitmap(transpTest, (gadget.w / 2) - 16, (gadget.h / 2) - 11);

//blast things back on screen, enjoy working transparency
draw.draw(dBuffer, -10,-10);