nanogui: Thread: Pen Colors


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Pen Colors
From: "Keith Williams" ####@####.####
Date: 19 Nov 2002 13:38:42 -0000
Message-Id: <JKEGKHCJDJGHAADLELJPKEKPCCAA.espian@insightbb.com>

Hi,

After my earlier questions regarding the transparent and alpha blended
windows, I've modified the malpha demo to start to try to get the hang of
the Win32 GDI. I now have everything coming up initially the way that I want
it (window size, attributes, backgrounds, etc.).  One of the windows will
display an x-y plot of data.

To test the plotting functions, I just picked a few and tried to draw on the
window.  One of the results in particular is puzzling me.  I did the
following:

ChanA = CreatePen(PS_SOLID, 0, rgb(0,255,0));
SelectObject(PenPlot, ChanA);
MoveToEx(PenPlot, 0,100, NULL);
LineTo(PenPlot, 300,120);

No matter what the color is changed to I always get a black line.  I did
post the above code to a Win32 GDI newsgroup where someone tested it and
reported that they got a green line with the above code.

I've also tried SetPixel and SetPixelIV.  I cannot get these two functions
to plot anything.

I'm still missing something very basic.

Thanks for any insight.

Keith

Subject: Re: [nanogui] Pen Colors
From: "Greg Haerr" ####@####.####
Date: 20 Nov 2002 03:22:17 -0000
Message-Id: <0aa201c29042$00f51c20$3aba46a6@xmission.com>

: ChanA = CreatePen(PS_SOLID, 0, rgb(0,255,0));
: SelectObject(PenPlot, ChanA);
: MoveToEx(PenPlot, 0,100, NULL);
: LineTo(PenPlot, 300,120);

Check out the implementation of LineTo in src/mwin/wingdi.c.
I would place a couple of printf's in the function, as well
as in src/engine/devopen.c::GdFindColor(), which can show
you the colors that Microwindows is converting the rgb()
macro into a PIXELVAL value.  (You should use RGB(),
not rgb())

This debugging will tell you whether it's a hardware conversion
issue for your particular framebuffer, or a bug in Microwindows
internal code.  You are also not checking the return value for SelectObject,
or CreatePen, so there could be other failure modes.

Regards,

Greg
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.