From: | |
Date: | 06 Feb 2001 at 04:38:26 |
Subject: | Re: ObtainBestPen Again |
Hello Allan
On 05-Feb-01, Allan Odgaard wrote:
> Hello Jack,
>
>> [...] The syntax I'm using is
>> color = ObtainBestPen( colormap, 0xFFFFFFFF, 0x0, 0x0,
>> OBP_Precision, PRECISION_GUI, OBP_FailIfBad, TRUE)
>
> TAG_DONE!!!
I thought I finally typed something correctly. :-0 It is in the code
at least.
>
>> In either case, the result is 1. Actually, if I move the values
> around,
>> to say FULL(0), FULL(0), FULL(255), the result is still 1. Any
>> idea where my problem is?
>
> hmm... and pen 1 is not red? How do you obtain the colourmap pointer?
I don't think so. I tried it two ways: first, I locked the workbench screen
and used that for the GetScreenDrawInfo call. When that didn't
work I used the screen I created in the call. If I run paletter prefs, pen
1
is black. And I'm not setting any colors on my custom screen so I think
it defaults to black also. I've included the relevant code here:
#define RED(x) ((x >> 8) & 0xf)
#define BLUE(x) ((x >> 4) & 0xf)
#define GREEN(x) (x & 0xf)
#define FULL(x) (x*0x01010101)
void main(void)
{
strcut Screen *scr;
struct DrawInfo *drinfo = GetScreenDrawInfo(scr);
WORD mapping[8];
Create screen();
set_mapping(scr, drinfo, mapping);
}
VOID set_mapping(struct Screen *screen, struct DrawInfo *drinfo,
WORD mapping[])
{
mapping[0] = drinfo->dri_Pens[BACKGROUNDPEN];
mapping[1] = drinfo->dri_Pens[SHADOWPEN];
mapping[2] = drinfo->dri_Pens[SHINEPEN];
mapping[3] = drinfo->dri_Pens[FILLPEN];
if (screen->RastPort.BitMap->Depth > 2)
{
struct ColorMap *cmap = screen->ViewPort.ColorMap;
mapping[4] = ObtainBestPen(cmap, FULL(255),
FULL(0),
FULL(0),
OBP_Precision, PRECISION_GUI,
OBP_FailIfBad, TRUE,
TAG_END);
printf("%d\n",mapping[4]); //result always 1
}
}
Jack
------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://click.egroups.com/1/11231/0/_/451227/_/981434713/
---------------------------------------------------------------------_->