Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [rap-dev] org.eclipse.swt.graphics.Color class problems in rap-1.1.0

Hi,

the colorNr is created in ResourceFactory#getColor(int,int,int) like that:

int colorNr = red | ( green << 8 ) | ( blue << 16 );

So I suppose the internal representation was inadvertently reversed compared to RGB standard by the programmer. As getBlue() and getRed() respect this representation the API works as expected. Probably we should change this to avoid misunderstandings...


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: rap-dev-bounces@xxxxxxxxxxx [mailto:rap-dev-bounces@xxxxxxxxxxx] Im Auftrag von Sebastian Bota
Gesendet: Mittwoch, 1. Oktober 2008 12:39
An: RAP project development-related communication
Betreff: [rap-dev] org.eclipse.swt.graphics.Color class problems in rap-1.1.0

Hello RAP Developers.
Recently i have discovered a problem ("Feature") regarding the 
org.eclipse.swt.graphics.Color class.

 public int getBlue() {
    return ( colorNr & 0xFF0000 ) >> 16; => This takes the value from 
the first position, and SHOULD be the last position
  }
  public int getGreen() {
    return ( colorNr & 0xFF00 ) >> 8; => This is correct
  }

  public int getRed() {
    return colorNr & 0xFF;   => This is the last position and should be 
the first
  }

The result is an inverted color i.e RED=FF0000 is 0000FF.
Please review this class or tell me if i am missing something.
Thank you

Sebastian Bota

-- 

------------------------------------------------------------------------

Best regards/Mit freundlichen Grüßen

Sebastian Bota

SOFTCON IT-Services S.R.L
Take Ionescu Bd. 46B
300124 Timisoara

Phone   : +40-256-430.286
Fax        : +40-256-430.349
Web     : www.softcon-its.ro
_______________________________________________
rap-dev mailing list
rap-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/rap-dev


Back to the top