[AD] PALETTE and RGB* |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Can someone explain why some functions take "RGB *" arguments instead of "PALETTE" arguments (eg. load_bitmap compared with get_palette). AFAICT they mean the same thing to a compiler, but PALETTE is easier to read (a full palette is expected, rather than a single RGB entry). Unless there is reason not to, I'm going to apply the following patch. I think it is source compatible, and most likely binary compatible. Now, the real reason I want this change: it makes PALETTEs _almost_ objects in their own right. This is useful when working with foreign function interfaces for languages where C's pointer semantics are unnatural. You don't have to pull some trick or bypass type-checking to tell it that the second argument of load_bitmap is a PALETTE, even if it looks like it is a pointer to an RGB structure. -- 王浩禎
Attachment:
pal-not-rgb*.diff.gz
Description: application/gunzip
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |