LWJGL
May 20, 2013, 07:24:53 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: 1 [2]
  Print  
Author Topic: Window Icon  (Read 7024 times)
kevglass
Guest
« Reply #15 on: June 06, 2005, 12:48:23 »

Yeah, an icon on linux is just a pixmap, which basically means it can be anysize, but it appears 32x32 is traditional.

Kev
Logged
tomb
Talks Too Much
***
Posts: 148


« Reply #16 on: June 06, 2005, 17:15:03 »

Quote from: "kevglass"
Yeah, an icon on linux is just a pixmap, which basically means it can be anysize, but it appears 32x32 is traditional.

Kev


But there is only one icon size used by the application?

What about tha api I suggested before:

int getRecommendedSmallIconSize()
int getRecommendedBigIconSize()
setSmallIcon(int data[], int width, int height)
setBigIcon(int data[], int width, int height)

Big icon is only used in windows when alt-tabbing. Otherwise small icon is used. The image passed in can be of any size, but it will be scaled if it don't fit the recommended size.
Logged
kevglass
Guest
« Reply #17 on: June 06, 2005, 23:45:17 »

Its fine by me, just like to get a standardised API sort so we can get something in. However, Small and Big doesn't really make sense. In this case what we're really saying is:

setWindowIcon()

and

setWinAltTabbingIcon()  Smiley

--

Also, this API means that I'll have ot put an OS check into my code to set the right size of icon, 16x16 on window, 32x32 on linux and up-to 128x128 on macos. Sad

Kev
Logged
Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #18 on: June 07, 2005, 04:27:03 »

I am still fond of the:
Code:

/**
 * Sets one or more icons for the Display.
 * <ul>
 * <li>On Windows you should supply at least one 16x16 icon and one 32x32.</li>
 * <li>Linux (and similar platforms) expect one 32x32 icon.</li>
 * <li>Mac OS X should be supplied one 128x128 icon</li>
 * </ul>
 * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform.
 *
 * @param icons Array of icons in RGBA mode
 * @return number of icons used.
 */
public int Display.setIcon(ByteBuffer[] icons);

I see no reason for adding getMin/Max since these are known ahead of time. And in that same sense - one might argue the same with cursor...
Logged

kevglass
Guest
« Reply #19 on: June 07, 2005, 06:19:29 »

Looks good to me, OOI why return the number icons used?

Kev
Logged
tomb
Talks Too Much
***
Posts: 148


« Reply #20 on: June 07, 2005, 08:52:39 »

Quote
I see no reason for adding getMin/Max since these are known ahead of time. And in that same sense - one might argue the same with cursor...


That is fine by me as long as it is fairly certain that there will never be any other sizes than 16, 32 and 128.

Quote
public int Display.setIcon(ByteBuffer[] icons);


I think this is too unclear. I think it would be better to set by type or have 3 functions:
Code:

public int Display.setIcon16x16(ByteBuffer iconData, int width, int height);
public int Display.setIcon32x32(ByteBuffer iconData, int width, int height);
public int Display.setIcon128x128(ByteBuffer iconData, int width, int height);

The javadoc would make it clear that the functions would scale the image if it don't fit.
Logged
Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #21 on: June 07, 2005, 09:17:46 »

Quote from: "kevglass"
Looks good to me, OOI why return the number icons used?

if setIcon == 0, then an error occured - avoids the need for exceptions
Logged

Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #22 on: June 07, 2005, 09:36:40 »

Quote
I think this is too unclear. I think it would be better to set by type or have 3 functions:
Code:

public int Display.setIcon16x16(ByteBuffer iconData, int width, int height);
public int Display.setIcon32x32(ByteBuffer iconData, int width, int height);
public int Display.setIcon128x128(ByteBuffer iconData, int width, int height);

The javadoc would make it clear that the functions would scale the image if it don't fit.

The problem with this, is that it's bloatish and I really prefer a cleaner api by not doing like cocoa (for example stringByAbbreviatingWithTildeInPath style method calls).
And forwarding a bit into the future, we would have 7 setIcon methods because of ports... whereas using 1 method would just require an updated javadoc

I am also a bit undecided whether or not an implementation should scale the images supplied, instead of forcing the developer to pass correct data. The former can lead to ugly icons and/or unexpected behaviour, wheread the latter will lead to the expected behaviour, but mean that the dev have to supply proper icons (which IMO is a good thing).
Logged

elias
Nerdus Imperius
*****
Posts: 899



WWW
« Reply #23 on: June 07, 2005, 12:04:55 »

Quote from: "Matzon"
Quote from: "kevglass"
Looks good to me, OOI why return the number icons used?

if setIcon == 0, then an error occured - avoids the need for exceptions


Why avoid exceptions? I'd like to know when something went wrong :shock:.

 - elias
Logged

Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #24 on: June 07, 2005, 12:11:24 »

Exceptions are for tadaaa - exceptions!
if you supplied invalid icons sizes for specified platform then thats not an exception, it just means that the icon couldn't be used, thus 0.
If you passed something that couldn't be used (can't see how that would happen, since its just bytes) then thats an exception and will be thrown, but thats probably a runtime exception more than anything.
Logged

kevglass
Guest
« Reply #25 on: June 07, 2005, 13:55:49 »

Passing in byte buffers who size didn't give a square would be an exception circumstance. Or buffers that were empty I guess.

Kev
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!