FastPoint
RgbColour = FastPoint(Xpos, Ypos)
 
Parameters:

    Xpos = The X coordinate of where to read this pixel colour from
    Ypos = The Y coordinate of where to read this pixel colour from
Returns:

    RgbColour = The Colour of this pixel in RGB format
 

      The FastPoint() function reads the RGB colour value of any selected pixel, much like the Point() function. But, that's where the similarity ends. Unlike Point however, FastPoint has it's safety code removed to make it faster!

      This means two things, it can only read pixels from a surface that has been locked by Lockbuffer and that it has no clipping. Therefore it assumes the coordinate of the pixel you wish to read, will be inside the screen bounds.


      Note: Before you can use FastPoint correctly. After you lock the draw surface, it's hihgly recommended you read a pixel from this surface using Point(). This will ensure the address of the surface is seeded for FastPoint

      Any Improper use of this command may cause your program to crash !





FACTS:


      * FastPoint has no clipping. So the coordinate you give it must be legal, or you should expect your program to crash!

      * FastPoint() requires that the surface your reading from be locked prior to reading.

      * FastPoint() returns the pixel color in RGB format. Where each R,G,B component has a 0- 255 range. Use the RGBR(), RGBG(), RGBB() functions to calc the R,G,B values

      * Reading lots of Dots from the screen or an image manually can be very slow. The reason for this, is that each time you read or write a single dot, the surface your reading from, has to first be locked, then the pixel is read and then unlocked again. The locking is required to ensure that the surface is valid for reading, Which is controlled by the OS. So when your reading or writing lots of pixels, your constantly locking/unlocking the surface. Which will be extremely slow!. To overcome this, See LockBuffer + UnLockbuffer + for more speed.


      * It's important to note also that colour RGB values can be affected by the current screen mode your program is running in. In particular if your program is running in 16bit mode. In which case some finer colour accuracy will be lost!

      * If you attempt read a pixel outside of the current drawing surfaces size, FastPoint() will most likely crash !



 
Example Source: Download This Example
; *=-----------------------------------------=*
;  This example uses FASTDOT AND POINT to copy
;  pixels manually.
; *=-----------------------------------------=*
  
  
; Open A Screen of 640x by 480y, 32bit in Windowed mode
  OpenScreen 640,480,32,1
  
; Calc the center of the screen Height
  ScreenCenterY =GetScreenHeight()/2
  
  
  
; draw a shaded box to the top half of the screen
  ShadeBox 0,0,GetScreenWidth(),ScreenCenterY,_
  RGB(0,0,0),RGB(0,0,255),RGB(255,0,0),RGB(0,255,0)
  
; Dispaly some text in the center of the top half
  CenterText 320,160,"Mirrored Using FastDot + FastPoint"
  
; ---------------------------------------
; Flip the image manually PIxel by Pixel
; ---------------------------------------
; Lock the Screen Buffer
  LockBuffer
  
; Init the Source Y row postion where coping from
  SOurceY=0
; start a for next to loop down the Y axis
  For ylp=GetScreenHeight()-1 To CenterScreenY Step -1
   ; start Xlp to loop across the screens X axis
     For Xlp=0 To GetScreenWidth()-1
      ; Copy a Pixel from the Top section of the screen
      ; to the bottom
        FastDot Xlp,ylp,FastPoint(Xlp,SOurceY)
     Next
   ; add 1 to the Source Y row
     Inc SourceY
  Next
; Lock the Screen buffer
  UnLockBuffer
  
  
; Show the Screen
  Sync
  
; Wait For a Key press
  WaitKey
  
  
  
 
Related Info: Dot | DotC | FastDot | GetInk | GetInkB | GetInkG | Ink | Point :
 


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