Re: Request for testing - Gradient Rectangle
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 02, 2003
- 512 views
Yep, you (& Wolf) are right, it's at 256, didn't realize it. Dan Moyer ----- Original Message ----- From: "Elliott Sales de Andrade" <quantum_analyst at hotmail.com> To: "EUforum" <EUforum at topica.com> Subject: Re: Request for testing - Gradient Rectangle > > > >From: Dan Moyer <DANIELMOYER at prodigy.net> > >Reply-To: EUforum at topica.com > >To: EUforum <EUforum at topica.com> > >Subject: Re: Request for testing - Gradient Rectangle > >Date: Sat, 1 Feb 2003 20:10:50 -0800 > > > > > >Martin, > > > >It appears to "work" on 98 1st ed., but looks like it could be a better > >gradient somehow; what I see is a *band* of solid green on the left, a > >*band* of solid blue on the right, and a kind of "speckled" pseudo-gradient > >in the middle. > > Sounds like dithering. Is your display set to a low bit-depth, like > 256-colours? > > >I can't think of a good suggestion of how to make it better, though. > > > >Dan Moyer > > > > > >----- Original Message ----- > >From: "Martin Stachon" <martin.stachon at worldonline.cz> > >To: "EUforum" <EUforum at topica.com> > >Sent: Saturday, February 01, 2003 9:53 AM > >Subject: Request for testing - Gradient Rectangle > > > > > > > Hello, > > > below is my function gradientRect(). It is used to draw nice > > > gradient rectangles using GDI - fast. I'd appreciate an info about > > > Windows versions, which can run this - especially Win9x. Thanks. > > > > > > Martin <martin.stachon at tiscali.cz> > > > > > > <Code> > > > > > > include win32lib.ew > > > without warning > > > > > > constant > > > msimg32 = registerw32Library("msimg32.dll"), > > > xGradientFill = registerw32Procedure( msimg32, "GradientFill", > > > {C_LONG,C_POINTER,C_LONG,C_LONG,C_LONG,C_LONG} ) > > > > > > constant > > > TRIVERTEX_x = allot(Long), > > > TRIVERTEX_y = allot(Long), > > > TRIVERTEX_Red = allot(Word), > > > TRIVERTEX_Green = allot(Word), > > > TRIVERTEX_Blue = allot(Word), > > > TRIVERTEX_Alpha = allot(Word), > > > SIZEOF_TRIVERTEX = allotted_size(), > > > > > > GRADIENT_RECT_UpperLeft = allot(Long), > > > GRADIENT_RECT_LowerRight = allot(Long), > > > SIZEOF_GRADIENT_RECT = allotted_size() > > > > > > constant > > > GRADIENT_FILL_RECT_H = #00000000, > > > GRADIENT_FILL_RECT_V = #00000001, > > > GRADIENT_FILL_TRIANGLE = #00000002, > > > GRADIENT_FILL_OP_FLAG = #000000FF > > > > > > global procedure gradientRect(atom id, atom leftColor, atom rightColor, > >atom x1, atom y1, > > > atom x2, atom y2) > > > atom hDC, PTRIVERTEX, gRect > > > PTRIVERTEX = acquire_mem( 0, 2*SIZEOF_TRIVERTEX ) > > > store(PTRIVERTEX, TRIVERTEX_x, x1) > > > store(PTRIVERTEX, TRIVERTEX_y, y1) > > > store(PTRIVERTEX, TRIVERTEX_Red, and_bits(leftColor, #0000FF)*#100) > > > store(PTRIVERTEX, TRIVERTEX_Green, and_bits(leftColor, #00FF00)) > > > store(PTRIVERTEX, TRIVERTEX_Blue, and_bits(leftColor, #FF0000)/#100) > > > store(PTRIVERTEX, TRIVERTEX_Alpha, 0) > > > > > > store(PTRIVERTEX, TRIVERTEX_x &SIZEOF_TRIVERTEX, x2) > > > store(PTRIVERTEX, TRIVERTEX_y &SIZEOF_TRIVERTEX, y2) > > > store(PTRIVERTEX, TRIVERTEX_Red &SIZEOF_TRIVERTEX, > >and_bits(rightColor, > >#0000FF)*#100) > > > store(PTRIVERTEX, TRIVERTEX_Green &SIZEOF_TRIVERTEX, > >and_bits(rightColor, > >#00FF00)) > > > store(PTRIVERTEX, TRIVERTEX_Blue &SIZEOF_TRIVERTEX, > >and_bits(rightColor, > >#FF0000)/#100) > > > store(PTRIVERTEX, TRIVERTEX_Alpha &SIZEOF_TRIVERTEX, 0) > > > > > > gRect = acquire_mem( 0, SIZEOF_GRADIENT_RECT ) > > > store(gRect, GRADIENT_RECT_UpperLeft, 0) > > > store(gRect, GRADIENT_RECT_LowerRight, 1) > > > > > > hDC = getDC(id) > > > w32Proc(xGradientFill, {hDC, PTRIVERTEX, 2, gRect, 1, > >GRADIENT_FILL_RECT_H}) > > > releaseDC(id) > > > release_mem(PTRIVERTEX) > > > release_mem(gRect) > > > end procedure > > > > > > constant win = create(Window, "Win", 0, Default, Default, 500, 500, 0) > > > > > > procedure onPaint_win(integer self, integer event, sequence params) > > > gradientRect(win, Green, Blue, 0, 0, 100, 100) -- zelena - modra, pro > >blazna dobra > > > end procedure > > > setHandler(win, w32HPaint, routine_id("onPaint_win")) > > > > > > WinMain(win, Normal) > > > > > > </code> > > > > > > > <snip> > > > > > > TOPICA - Start your own email discussion group. FREE! >