2DDrawing / ASM

Windows specific forum
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3943
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

2DDrawing / ASM

Post 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 ?
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post 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
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3943
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post 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.
:?:
Post Reply