tags:

views:

322

answers:

8

I talked to a friend of mine and he told me that it's possible to create an image in an image editor (gimp/photoshop) and then use it as a button . He said that's the way applications that have great GUIs do it.

He also said that there is a file describing which parts of the image make up the button.

Is this possible , or is he "crazy"? :)

+2  A: 

You can do anything, especially since you have no constraints re language, environment, etc.

ScottStonehouse
A: 

Imagemaps I guess. No seperate file describes the map, it is all part of the html document.

http://www.w3schools.com/TAGS/tag_map.asp

Aidan
+1  A: 

In HTML, you could do:

<input type="button" src="/path/to/image.png" />

Alternately, assigning an onclick event to an image causes that image to work similarly to a button:

<img src="/path/to/image.png" onclick="function(){doSomething();}" />
Joel Anair
+2  A: 

No he is not crazy, you can use images on almost all GUI tools instead of buttons, they are generally an image on the button, or in some cases you can put the image on the screen and have an onclick event assigned to it.

+3  A: 

This needs to be clarified with a language of choice, etc. In general, most languages (WinForms, Java AWT/SWT, etc) have an image or background image property that allows you to use images for buttons. There are even skinning frameworks that will let you use images for all controls in an easy-to-define manner.

If you are talking about HTML, there is a button input type that can allow an image to be used as a button for a form.

@Vhaerun
CodeProject is a good place to find lots of skinning libraries. I used this one a long time ago. Winamp is a great example of a skinned application, where users can actually create their own templates to completely change the look of the application without changing code whatsoever. Actually, most media players have some sort of skinning available.

Chris Marasti-Georg
+1  A: 

If you're talking HTML you can use <input type="image" src="myfile.png" />

Specifications here

Jacob
+1  A: 

Chris , I think that he was talking about those skinning frameworks . Thanks !

Vhaerun
+2  A: 

You haven't been very specific with your question so nobody is able to give you a definitive answer, but here's an attempt to do so without demeaning you:

It's quite common for graphics designers (using tools like photoshop, gimp, etc.) to participate alongside developers for both desktop and web based applications. Web based applications can easily capture information about when an image is clicked and frequently people will either design the button with the text in the image file itself, or use background pictures/borders with plain text on top. There is not standard, per se, on how this is accomplished on the web, but plenty of sites serve as an example (try using Firebug with FireFox to inspect other sites and see how they do things).

If the circumstance at hand is desktop oriented then the answer becomes much more complicated. Skinning is accomplished in many way and, depending on platforms and libraries being used, implementation specifics vary greatly. In it's most simple terms, most GUI frameworks (like GTK, QT, Windows Forms, Windows Presentation Foundation) include a basic picture control, and this control can usually process a "Click" event, which would allow it to function as a button, but if you want different states (pressed, disabled, etc.) you will have to invest more effort in such a thing; you also won't find this method suitable for replacing the rendering of all buttons in an application, but rather something you would do manually for each one, or write your own custom button control that uses your assets specifically.

In terms of a file describing different images that combine as described in the file to override the rendering of the button this would lead me to believe you are either working with an already existent application that is skinable (like Firefox or Winamp) or that he is speaking of some specific UI toolkit. I'm not aware of this functionality being generally available in most of the common system-level UI toolkits.

In the future you may wish to be more specific with your questions.

TheXenocide
Thanks for the follow-up . I'll try to be more specific next time .
Vhaerun