Menu

#924 RGB() & RGBA() macros return incorrect data-type

closed
nobody
compiler
2020-12-06
2020-08-27
MrSwiss
No

Just a reminder report as requested by coderJeff.

Expected data-type: ULong (fixed-len, 32 bit)
Returned data-type: UInteger (var-len 32/64 bit)

Forum reference: https://www.freebasic.net/forum/viewtopic.php?f=9&p=275388#p275366

New proposed implementation:

#Define RGBA(r, g, b, a)    CULng(CUByte(a) Shl 24 + CUByte(r) Shl 16 + CUByte(g) Shl 8 + CUByte(b))
#Define RGB(r, g, b)        CULng(CUByte(255) Shl 24 + CUByte(r) Shl 16 + CUByte(g) Shl 8 + CUByte(b))

Discussion

  • Jeff Marshall

    Jeff Marshall - 2020-12-06

    updated in [4db1686b779a836e9a045e99c37394cf8c81caf0]

    The new bulit-in RGB and RGBA macros are:

    #define RGB(r,g,b) culng((cubyte(r) shl 16) or (cubyte(g) shl 8) or cubyte(b) or (&hFF000000ul))        
    #define RGBA(r,g,b,a) culng((cubyte(r) shl 16) or (cubyte(g) shl 8) or cubyte(b) or (cubyte(a) shl 24)) 
    

    Also changed in [443b13ec145505070c1dcb767eddf1df815fe0f7]
    POINT() gfx function now returns ULONG

     

    Related

    Commit: [443b13]
    Commit: [4db168]

  • Jeff Marshall

    Jeff Marshall - 2020-12-06
    • labels: Macro change --> Macro change, gfxlib2
    • status: open --> closed
     

Log in to post a comment.