The Amiga graphics.library lags so completely behind when it comes to handling RGB. Everything has to go via the ancient pens.
I just learned that MorphOS and AROS has a new function (or atleast new attributes) that amend this by letting you set an RGB value directly as A-pen and presumably B-pen without actually having to mess with a pen:
SetRPAttrs(rp, RPTAG_PenMode, FALSE, RPTAG_FgColor, 0xFFCC88, TAG_DONE);
I would really like to see this exact implementation (to ease portability) in AmigaOS4.1.3 or OS4.2, unless there is already such a functionality implemented that I have missed of course.
RGB rastport functions.
Re: RGB rastport functions.
You are incorrect. Check the autodocs and includes again. You can set RGB values directly.Deniil wrote:The Amiga graphics.library lags so completely behind when it comes to handling RGB. Everything has to go via the ancient pens.
Let be clear on something. AmigaOS is the leader. AmigaOS defines the Amiga's API. The clones are the followers. We will not be implementing API changes to "ease portability" because clones are the ones who must change to match the official API. As a developer, you should expect the platforms to continue to diverge.I would really like to see this exact implementation (to ease portability) in AmigaOS4.1.3 or OS4.2, unless there is already such a functionality implemented that I have missed of course.
ExecSG Team Lead
Re: RGB rastport functions.
PortablE already has some declarations in it's 'CSH/pAmigaGraphics' module that make AmigaOS4 source-code compatible with the MorphOS & AROS way of doing it:Deniil wrote:I just learned that MorphOS and AROS has a new function (or atleast new attributes) that amend this by letting you set an RGB value directly as A-pen and presumably B-pen without actually having to mess with a pen:
SetRPAttrs(rp, RPTAG_PenMode, FALSE, RPTAG_FgColor, 0xFFCC88, TAG_DONE);
I would really like to see this exact implementation (to ease portability) in AmigaOS4.1.3 or OS4.2, unless there is already such a functionality implemented that I have missed of course.
(I'd have made MOS & AROS behave like OS4, but that's not possible.)#ifdef pe_TargetOS_AmigaOS4
->make OS4 emulate how MorphOS & AROS do it
PRIVATE
CONST RPTAG_FGCOLOR = RPTAG_APENCOLOR
CONST RPTAG_BGCOLOR = RPTAG_BPENCOLOR
CONST RPTAG_PENMODE = TAG_IGNORE
PUBLIC
#endif
Although I made those constants private, since I hide the implementation entirely with some procedures:
PROC setRPAttrsFGCOLOR(rastport:PTR TO rastport, rgb) IS SetRPAttrsA(rastport, [RPTAG_FGCOLOR, rgb, RPTAG_PENMODE, FALSE, TAG_END]:tagitem)
PROC setRPAttrsBGCOLOR(rastport:PTR TO rastport, rgb) IS SetRPAttrsA(rastport, [RPTAG_BGCOLOR, rgb, RPTAG_PENMODE, FALSE, TAG_END]:tagitem)
PROC getRPAttrsFGCOLOR(rastport:PTR TO rastport) RETURNS rgb
GetRPAttrsA(rastport, [RPTAG_FGCOLOR, ADDRESSOF rgb, TAG_END]:tagitem)
ENDPROC
- tonyw
- AmigaOS Core Developer
- Posts: 1479
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: RGB rastport functions.
@Deniil:
Look up the docs for IGraphics->SetRPAttrs in graphics.doc. You will probably be interested in the tags RPTAG_APen and RPTAG_BPen. I can give you a code snippet if you like.
Good to see that the clones have partly caught up.
Look up the docs for IGraphics->SetRPAttrs in graphics.doc. You will probably be interested in the tags RPTAG_APen and RPTAG_BPen. I can give you a code snippet if you like.
Good to see that the clones have partly caught up.
cheers
tony
tony
Re: RGB rastport functions.
While setting direct RGB values as foreground and background colors works perfectly, what is missing is the full support for the alpha channel. MUI could make much more use of transparency effects for texts if the alpha byte would not be ignored. Even the Autodocs state this fact: The alpha part is currently ignored and should be set to 0xFF.
Re: RGB rastport functions.
It's amazing I managed to forgot I asked this question and didn't see it again in 10 years!!
I see the APenColor tag has been there since v51, which is what, OS4.0.0 public/full release?
It works beautifully. The MOS PenMode on the other hand, not so much. It doesn't make any sense. Why should it matter from where an RGB triplet comes from (palette or color wheel or whatever) when put on a pen?? No, you can't pick one color from a palette and another from a color wheel. Not possible.
I see the APenColor tag has been there since v51, which is what, OS4.0.0 public/full release?
It works beautifully. The MOS PenMode on the other hand, not so much. It doesn't make any sense. Why should it matter from where an RGB triplet comes from (palette or color wheel or whatever) when put on a pen?? No, you can't pick one color from a palette and another from a color wheel. Not possible.