InkMode
InkMode DrawMode
 
Parameters:

    DrawMode = The mode setting value you wish to set Inkmode to
Returns: NONE
 

      InkMode changes how pen based graphics are to be drawn. By default the InkMode is set to "Normal". This is fastest drawing mode by far! But can be a little uninteresting. So to spice things up, you can also perform various blending effects while drawing. While these should be used sparingly, they can certainly help when dress up your programs appearance!

     To set the InkMode appropriately, you MUST combine a value from the RENDER TYPE list and the RENDER EFFECTS tables bellow. This is because not all drawing operations will be affected by InkMode changes (i.e. Images and Text aren't).



Render Types:

      1 - Normal (Draw pixels in the INK colour)
      2 - Filled (Not currently in use )
      4 - (Future)
      8 - (Future)


Render Effects:

      16 - Alpha Blend - (Variable Alpha blend the current INK colour with the graphics your drawing over. Use InkAlpha to set the level of transparency)

      32 - Alpha Blend 50% (Perform 50 -50 alpha blend between the INK colour and the background)

      64 - Alpha Add ( Add's the R/G/B separate values of the INK colour to the backdrop )

     128 - Alpha Sub ( Subtracts the R/G/B separate values of the INK colour from the backdrop)

     256 - AND ( performs a Logical AND of the INK colour to the backdrop)

     512 - OR ( performs a Logical OR of the INK colour to the backdrop)

     1024 - XOR ( performs a Logical Exclusive OR of the INK colour to the backdrop)

     2048 - Alpha Mult ( Multiplies the backdrop pixels by the INK colour)

     4096 - Inverted Alpha Sub ( Subtracts backdrop colour from the INK colour. This is the inversion of InkMode 128 above)




So. to set InkMode to Normal + AlphaBlend would be InkMode 1+16

To set it to Normal + AND mode it's be InkMode 1+256





FACTS:


* Most drawing operations are performed by the CPU. For operations that read memory such as alpha blending, which can be slow when applying them to images in video memory. We recommend using FX/AFX images when you're after such effects. See CreateFxIMage).

* Important Note: We highly recommended you read the Images tutorials also!





Mini Tutorial #1:


     Using Inkmode to create transparent circle graphic.

  
  
  Do
   ; Clear the Screen to Black (rgb(0,0,0) is black)
     Cls RGB(0,0,0)
     
   ; Set the INK mode to NORMAL
     InkMode 1
     BoxC 100,100,200,200,1,$ff2233
     
   ; set the InkMode to AlhaBlend 50%
     InkMode 1+32
     Circle MouseX(),MouseY(),25,1
     
     
   ; Display the Screen and wait for the user to press a key
     Sync
  Loop
  


     If you run this example and move the circle over the Box, you should be able to see the box through the circle.





Mini Tutorial #2:


     This example uses the Alpha Mult and Alpha Addition modes.


  
  
; limit the frame rate to 60 fps or less
  SetFPS 60
  
  
; create an FX
  ScreenImage=NewImage(800,600,2)
  
  
; ----------------------------------------
; Main Loop
; ----------------------------------------
  Do
     
   ; redirect rendering to this screen image
     RenderToImage ScreenImage
     
   ; Mult each pixels by RGB $FF,$FF,$FF
     InkMode 1+2048
     BoxC 0,0,800,600,true,$ffffff
     
     
   ; draw a circle in Alpha addition mode
     InkMode 1+64
     CircleC    MouseX(),MouseY(),50,true$332211
     
     
   ; reset back to the normal mode
     InkMode 1
     
   ; draw the screen FX image to the display
     RenderToScreen
     DrawImage ScreenIMage,0,0,false
     
     
     Sync
  Loop EscKey()=true
  
  




 
Related Info: Box | Circle | Dot | DrawShape | Images | Ink | InkAlpha | Line | Quad | RGB | ShadeBox | Tri :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com