Getting rid of a gray box Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Getting rid of a gray box

Post by Brok3n Halo » Wed Apr 05, 2006 7:07 pm

My first post here, just started working with wxWidgets last weeks

I'm on a contract job and am working on designing a costum interface, I'm using wxBitmapButton to create customised buttons, the problem is anywhere that the image is transparent is gray, covering the background.

How can I make the image actualy transparent?

I can't show much code because of the NDA, but here's the relavent chunk from the prototype I'm codeing now:

Code: Select all

    wxBitmap bup;
    wxBitmap bdown;
    bup.LoadFile("button1.png", wxBITMAP_TYPE_PNG);
    bdown.LoadFile("button2.png", wxBITMAP_TYPE_PNG);

	//sets up button and adds it to sizer
	Button1 = new wxBitmapButton(this, ID_BUTTON1, bup, wxDefaultPosition, wxDefaultSize, 0);
	Button1->SetBitmapSelected(bdown);
	content->Add(Button1,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5);
Any help apreciated...
Thanks,
Aaron Costello

cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp » Wed Apr 05, 2006 8:05 pm

i think the problem lies in your image files, not wxBitmapButton, ibe used those several times and never had that problem. Maybe you forgot to set the transparent color when/if you created the images yourself?
I suggest you edit your image files with your favorite image editor and make shure you set the transparent color right.

HTH

Oh!, and BTW, Welcome to wxWidgets :D
Hier Kommt die Sonne...

Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Post by Brok3n Halo » Wed Apr 05, 2006 8:20 pm

Thanx for the welcome,

The transparancy seems fine elseware, here's the image:

Image

Note: that the image will appear to have a gray border in IE erlier than 7 because IE doesn't do transparancies for most filetypes, use firefox or other browsers to view image online or download to view with an image editor

I have huge transparent boarders on there for the transparancy testing, bloated them up after I noiced the gray in the corners.

Here's a screenshot of what looks like in aplication:

Image

Thanks,
Aaron

Sof_T
Can't get richer than this
Can't get richer than this
Posts: 864
Joined: Thu Jul 28, 2005 9:48 pm
Location: New Forest, United Kingdom
Contact:

Post by Sof_T » Wed Apr 05, 2006 8:45 pm

How about using Bitmap::SetMask to cut the gray areas out of the drawing?

Code: Select all

bup.SetMask(bup,wxColour(<whatever the colour values of your gray are>));
I make sure the top corner is the transparent colour then take the pixel value and create a mask from that.

Sof.T
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/

Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Post by Brok3n Halo » Wed Apr 05, 2006 9:36 pm

Sounds good, I'll give it a try tomorrow morning and post back here, just leaving work so can't try it tonight.

Thanx
Aaron

Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Post by Brok3n Halo » Thu Apr 06, 2006 1:46 pm

Gave it a try this mornning, still the same problem, all the transparent pixels are just system grey...

Any more ideas?

btw, I'm working on a Win2k machine, could it be something platform indipendant?

Aaron

cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp » Fri Apr 07, 2006 12:09 am

Im sorry to insist so much in this, but i still think the problem is your image file. Ill tell you what, give me your email address (or PM it to me if you dont wanna post it), and ill send you a .png with proper transparency information, so you can use it to test your code (replacing one of your images with it). And then be 100% shure of if it is in fact your image, or the code.

HTH
Hier Kommt die Sonne...

Vexator
I live to help wx-kind
I live to help wx-kind
Posts: 187
Joined: Sun Jan 30, 2005 2:50 pm
Location: Heidelberg, Germany

Post by Vexator » Fri Apr 07, 2006 9:25 am

i had the same problem, read this:

http://forums.wxwidgets.org/viewtopic.php?t=7409

:D
Windows 7 Pro
Visual Studio 2010
wxWidgets 2.9.3

Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Post by Brok3n Halo » Tue Apr 11, 2006 2:03 pm

I'm guessing that might be the problem, I just reliesed I'm running 2.6.2 not 2.6.3, unfortunitly there is no wxDev-C++ package to upgrade, I'm tring to do a manual install based off of a tutorial I found elswhere on this forum but the build command doesn't seem to work

after setting the paths, I try this line:
mingw32-make -f makefile.gcc BUILD=release M USE_OPENGL=1 RUNTIME_LIBS=static USE_RTTI=0 USE_EXCEPTI

And it just gives me:
mingw32-make: *** No rule to make target `M'. Stop.

I don't have any experience hand compileing on windows, and only a little on Unix so I'm totaly lost here. Any ideas?

Thanks
Aaron

micros
Super wx Problem Solver
Super wx Problem Solver
Posts: 317
Joined: Sat Mar 18, 2006 10:41 am
Location: Ustek, Bohemia

Post by micros » Tue Apr 11, 2006 3:32 pm

I think you've only mistyped the command (the bold M is the target you probably don't want there)
mingw32-make -f makefile.gcc BUILD=release M USE_OPENGL=1 RUNTIME_LIBS=static USE_RTTI=0 USE_EXCEPTI...
Also I hope the line doesn't end like that...

Brok3n Halo
Earned a small fee
Earned a small fee
Posts: 24
Joined: Wed Apr 05, 2006 6:56 pm

Post by Brok3n Halo » Tue Apr 11, 2006 3:45 pm

Sigh, yup, thats how the line was in the instructions, a coworker and I figured it out though, I now have 2.6.3 with patch 2 installed and the image still doesn't show up right...

I'm still open to ideas,
Aaron

Post Reply