Extending VDU 19 to set alpha channel?

A notable omission from the capabilities of VDU 19 is the option of setting the alpha (opacity) channel as well as RGB, at present it's only possible to set fully-opaque colours.

Because the command must always be the same length (6 bytes) there's no possibility of adding an extra parameter. However the high-bit of the logical colour is currently unused (this is used to flag the background colour in VDU 17 and VDU 18, which implies a logical colour range of no more than 0-127).

So I'm wondering about this as a possibility:
VDU 19, logical+128, alpha, red, green, blue
Would this introduce any compatibility issues?

Comments

  • There is no support for alpha in Matrix Brandy - while the framebuffer is 32 bits deep, the top unused byte is being used to store the logical colour to enable VDU19 to work in the traditional way.
  • Soruk wrote: »
    There is no support for alpha in Matrix Brandy
    I wasn't anticipating that Matrix Brandy had support for alpha, but it's possible that it might have used the high-bit of the logical colour for some other purpose as it's an obvious 'spare' bit that's crying out for having some function!

    Jonathan Harston replied as follows at the Discussion Group:
    I've spent a hour or so with a cup of tea checking documentation and existing VDU driver code, and it looks like it will be fine. All pre-existing correctly written code will be sending l<64 to VDU 19(*), and using bit 7 safely segregates the additional function from existing ranges.

    Also, &80+n has a neat similarity to the use of &80+n in other functions.

    I've added a provisional addition to the VDU 19 documentation on the BeebWiki.

    (*)Other than an implementation I have that uses VDU 19,255 to set the border colour, but I think that will also be fine as you would not be using VDU 19 in a display with more than 64 colours, so the logical colour would be either &00+(0-63) or &80+(0-63), so &C0+(0-63) is still safely out of reach.
    As for Matrix Brandy having no support for alpha, I'm not at all surprised as it is noteworthy for providing no extensions to the graphics capabilities of BBC BASIC at all. No proportional-spaced text, no anti-aliased graphics, no 3D graphics. :(

    I can't say I've ever really understood the 'philosophy' of Matrix Brandy, which seems to be to extend the BBC BASIC language in some respects (e.g. 64-bit integers) but not to extend the capabilities of the display at all.
Sign In or Register to comment.