(those icons were just slapped on in gimp) later
IconMod
Started by solartic, Oct 14 2008 11:06 PM
3 replies to this topic
#1
Posted 14 October 2008 - 11:06 PM
well i was going to post some variations of my avatar, then i though it would be much easier if the user could modify the style (outline colour, body colour, and maybe have some different tags to chose from like c++ C#) without using inkscape although i find it relatively easy, anyway i came up with this crazy idea of a simple program that can most special icon make for it. well here is a screen shot of what ive messed so far, hopefully ill have it working by the end of the week.
(those icons were just slapped on in gimp) later
(those icons were just slapped on in gimp) later
|
|
|
#2
Guest_Jordan_*
Posted 15 October 2008 - 05:50 AM
Guest_Jordan_*
Looks neat, will you attach the source code?
#3
Posted 15 October 2008 - 06:51 AM
yes ill attach the source once it has some functionality to it
#4
Posted 20 October 2008 - 12:48 AM
ahh i have some school projects ill have to start plus the fact that the icon looks like crap(jagged edge) just make me even more lazy the only thing it can do now is change the colour here is the crapy code i have so far wxwidgets toolkit for some reason its not working properly on windows.
#include <wx/wx.h>
#include <wx/dcbuffer.h>
class IconMod : public wxApp
{
public:
virtual bool OnInit();
};
enum
{
ID_About = 1,
ID_ok,
ID_save,
ID_ontext,
};
//leftpanel
class LeftPanel : public wxPanel
{
public:
LeftPanel(wxPanel *parent);
void OnPaint(wxPaintEvent &event);
wxBitmap CreateBitmap(int w, int h, wxBitmap m, wxColour c);
wxBitmap *shadow;
wxBitmap outline;
wxBitmap body;
wxBitmap *glossy;
wxBitmap *colour;
wxBitmap *colour1;
int *width, *height;
wxColour *c;
wxColour *c2;
private:
DECLARE_EVENT_TABLE()
};
//rightpanel
class RightPanel : public wxPanel
{
public:
RightPanel(wxPanel *parent, LeftPanel *leftpanel);
void Ok(wxCommandEvent& event);
void Save(wxCommandEvent& event);
void OnText(wxCommandEvent &event);
wxBoxSizer *rSizer;
wxTextCtrl *outline;
wxTextCtrl *body;
wxStaticText *outlineT;
wxStaticText *bodyT;
wxRadioButton *rb1;
wxRadioButton *rb2;
wxButton *ok;
wxButton *save;
LeftPanel *lp;
private:
DECLARE_EVENT_TABLE()
};
//parent frame for right and left panel
class Frame : public wxFrame
{
public:
Frame(const wxString& title);
void OnAbout(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
wxMenuBar *menubar;
wxMenu *file;
wxMenu *help;
wxBoxSizer *sizer;
RightPanel *rp;
LeftPanel *lp;
private:
DECLARE_EVENT_TABLE()
};
//event table - leftpanel
BEGIN_EVENT_TABLE(LeftPanel, wxPanel)
EVT_PAINT(LeftPanel::OnPaint)
END_EVENT_TABLE()
//event table - rightpanel
BEGIN_EVENT_TABLE(RightPanel, wxPanel)
EVT_BUTTON(ID_ok, RightPanel::Ok)
EVT_BUTTON(ID_save, RightPanel::Save)
EVT_TEXT(ID_ontext, RightPanel::OnText)//textupdate
END_EVENT_TABLE()
//event table -frame
BEGIN_EVENT_TABLE(Frame, wxFrame)
EVT_MENU(ID_About, Frame::OnAbout)
EVT_MENU(wxID_CLOSE, Frame::OnQuit)
END_EVENT_TABLE()
IMPLEMENT_APP(IconMod)
bool IconMod::OnInit()
{
wxInitAllImageHandlers();
Frame *frame = new Frame(wxT("IconMod"));
frame->Show(true);
return true;
}
Frame::Frame(const wxString& title)
:wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(400, 400),
wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX))
{
wxImage::AddHandler( new wxPNGHandler );
menubar = new wxMenuBar;
file = new wxMenu;
help = new wxMenu;
file->Append(wxID_CLOSE, wxT("&Quit"));
help->Append(ID_About, wxT("&About"));
menubar->Append(file, wxT("&File"));
menubar->Append(help, wxT("&Help"));
SetMenuBar(menubar);
wxPanel *pl = new wxPanel(this, wxID_ANY);
pl->SetBackgroundColour(wxT("#47a2f7"));
lp = new LeftPanel(pl);//create leftpanel
lp->SetBackgroundColour(*wxWHITE);//set colour of leftpanel to white
rp = new RightPanel(pl, lp);//create rightpanel
rp->SetBackgroundColour(wxT("#47a2f7"));//set colour of rightpanel to blue
sizer = new wxBoxSizer(wxHORIZONTAL);//layout stuff horizontal
sizer->Add(lp, 1, wxEXPAND | wxALL, 5);//add leftpanel
sizer->Add(rp, 1, wxEXPAND | wxALL, 5);
pl->SetSizer(sizer);
Center();
}
LeftPanel::LeftPanel(wxPanel *parent)
: wxPanel(parent, -1, wxPoint(-1, -1), wxSize(-1, -1), wxBORDER_SUNKEN)
{
c = new wxColour(wxT("#0082e5"));//blue colour
c2 = new wxColour(wxT("#47a2f7"));//blue colour
shadow = new wxBitmap(wxT("shadow.png"), wxBITMAP_TYPE_PNG);//load image
outline = wxBitmap(wxT("outline.png"), wxBITMAP_TYPE_PNG);
body = wxBitmap(wxT("body.png"), wxBITMAP_TYPE_PNG);
glossy = new wxBitmap(wxT("glossy.png"), wxBITMAP_TYPE_PNG);
width = new int;
*width = (186 - shadow->GetWidth())/2;//set image x cordinate
height = new int;
*height = (360 - shadow->GetHeight())/2;//y cordinate
}
RightPanel::RightPanel(wxPanel *parent, LeftPanel *leftpanel)
: wxPanel(parent, -1, wxPoint(-1, -1), wxSize(-1, -1))
{
lp = leftpanel;//pointer to leftpanel, for communication
outlineT = new wxStaticText(this, -1, wxT("Outline Colour"));//static text
bodyT = new wxStaticText(this, -1, wxT("Body Colour"));
outline = new wxTextCtrl(this, ID_ontext, wxT(""), wxPoint(-1, -1),
wxSize(-1, -1), wxTE_RIGHT);//textbox1
body = new wxTextCtrl(this, ID_ontext, wxT(""), wxPoint(-1, -1),
wxSize(-1, -1), wxTE_RIGHT);
rb1 = new wxRadioButton(this, -1, wxT("Glossy"));
rb2 = new wxRadioButton(this, -1, wxT("Soft"));
ok = new wxButton(this, ID_ok, wxT("Ok"));
ok->Disable();
save = new wxButton(this, ID_save, wxT("Save"));//save button
rSizer = new wxBoxSizer(wxVERTICAL);//layout stuff vertical
rSizer->Add(outlineT, 0, wxCENTER);
rSizer->Add(outline, 0, wxCENTER | wxEXPAND);
rSizer->Add(bodyT, 0, wxCENTER | wxTOP, 10);
rSizer->Add(body, 0, wxCENTER | wxEXPAND);
rSizer->Add(rb1, 0, wxALIGN_LEFT | wxTOP, 10);
rSizer->Add(rb2, 0, wxALIGN_LEFT);
rSizer->Add(ok, 0, wxCENTER | wxEXPAND | wxTOP, 80);
rSizer->Add(save, 0, wxCENTER | wxEXPAND | wxTOP, 10);
this->SetSizer(rSizer);
}
void Frame::OnQuit(wxCommandEvent& event)
{
Close(true);
}
void Frame::OnAbout(wxCommandEvent& event)
{
wxMessageBox(wxT("This software can modify the style of special made icons"),
wxT("About IconMod"), wxOK | wxICON_INFORMATION, this);
}
void LeftPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
{
colour = new wxBitmap(CreateBitmap(outline.GetWidth(),outline.GetHeight(),outline, *c));
colour1 = new wxBitmap(CreateBitmap(body.GetWidth(),body.GetHeight(),body, *c2));
wxAutoBufferedPaintDC dc(this);
dc.DrawBitmap(*shadow, *width, *height, true);
dc.DrawBitmap(*colour, *width, *height, true);
dc.DrawBitmap(*colour1, *width, *height, true);
dc.DrawBitmap(*glossy, *width, *height, true);
}
wxBitmap LeftPanel::CreateBitmap(int w, int h, wxBitmap m, wxColour c)
{
wxBitmap b = wxBitmap(w, h, -1);
wxMemoryDC dc;
dc.SelectObject(b);
dc.SetPen(wxPen(c));
dc.SetBrush(wxBrush(c));
dc.DrawRectangle(0, 0, b.GetWidth(), b.GetHeight());
dc.SelectObject(wxNullBitmap);
b.SetMask(new wxMask(m, *wxWHITE));
return b;
}
void RightPanel::OnText(wxCommandEvent &event)
{
wxColour a(outline->GetValue());//get colour from textbox1
wxColour b(body->GetValue());
if(!outline->IsEmpty() && !body->IsEmpty() && a.IsOk() && b.IsOk())
{//if textbox1 and 2 are not empty and the colours are valid enable ok button
ok->Enable();
}
else
{
ok->Disable();
}
}
void RightPanel::Ok(wxCommandEvent &event)
{
*lp->c = outline->GetValue();//set outline colour to colour from textbox1
*lp->c2 = body->GetValue();
lp->Refresh();
}
void RightPanel::Save(wxCommandEvent &event)
{
}


Sign In
Create Account



Back to top









