Re: Request for testing - Gradient Rectangle
- Posted by Martin Stachon <martin.stachon at worldonline.cz> Feb 02, 2003
- 521 views
Just replace GRADIENT_FILL_RECT_H with GRADIENT_FILL_RECT_V in GradientFill() call. Martin Greg wrote: > > works great, but how do i make it vertical? > > ~Greg > g.haberek at comcast.net > > ----- Original Message ----- > From: Martin Stachon <martin.stachon at worldonline.cz> > 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> > > > TOPICA - Start your own email discussion group. FREE! > > > > TOPICA - Start your own email discussion group. FREE! >