Page 1 of 1

2DDrawing / ASM

Posted: Fri Aug 20, 2004 10:33 am
by wilbert
If I want to create for example a function to draw a triangle and want the color parameter to behave the same way as the internal line functions, how do I do that ?

Do I have to call _PB_FrontColor@12 and if so, does there also exist a _PB_ function that accepts one long value instead of r,g,b seperately or do I have to create a new pen and store the new handle to _PB_2DDrawing_Pen ?

Posted: Fri Aug 20, 2004 10:49 am
by fweil
wilbert,

You can do both wyas but using a long directly will run faster.

BTW, if you are using a ScreenOutput(), your long Color integer will probably have to be converted from RGB to BGR mode (easily writable using something like :

Code: Select all

Color = (Color & $FF0000) >> 16 + (Color & $00FF00) + (Color & $0000FF) << 16
or faster using FASM :

Code: Select all

  !  MOV     eax, dword [v_Color] ; Color = (Color & $FF0000) >> 16 + (Color & $00FF00) + (Color & $0000FF) << 16
  !  SAL      eax, 8
  !  BSWAP eax
  !  MOV     dword [v_Color], eax
Rgrds

Posted: Fri Aug 20, 2004 11:33 am
by wilbert
What I meant was that _PB_FrontColor@12 requires three long parameters.

It's no problem to split the long rgb color supplied to my function into three longs (r, g, b) push them and call _PB_FrontColor@12 but it would be easier if there would be something like _PB_FrontColor@4 but that doesn't work.
:?: