Design Scripting Documentation
     
 
     
  Read bitmap pixel from file (slower access, lower memory)  
     
     
  Inputs:  
     
the bitmap object
the x, y coordinates
     
  Outputs:  
     
color value of the pixel
     
  Implementation
01  function bmp_readpixel( bitmap, x, y )
02    dim bpp: bpp = bitmap( BMP_INFO )( BMP_BITS ) \ 8
03    dim bps: bps = ( ( ( bitmap( BMP_INFO )( BMP_WIDTH ) * bitmap( BMP_INFO )( BMP_BITS ) ) + 31 ) \ 32 ) * 4
04    dim offset: offset = bitmap( BMP_HEADER )( BMP_BITOFFSET ) + x * bpp + y * bps
05    call file_moveto( bitmap( BMP_FILE ), offset )
06    select case bitmap( BMP_INFO )( BMP_BITS )
07      case 32
08        bmp_readpixel = file_readdword( bitmap( BMP_FILE ) )
09      case 24
10        dim b: b = file_readbyte( bitmap( BMP_FILE ) )
11        dim g: g = file_readbyte( bitmap( BMP_FILE ) )
12        dim r: r = file_readbyte( bitmap( BMP_FILE ) )
13        bmp_readpixel = rgb( r, g, b )
14      case else
15        bmp_readpixel = -1
16    end select
17  end function
 
     

Creative Commons License
The Design Scripting Library, including its sources, online documentation and graphics, are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Online Documentation generated by { vbdoclib } version 1.0
Color-Coding generated by { vbcc } version 2.0
Page timestamp: { Feb. 2, 2006 }





 
     
     
 
Documentation
Cover Page
Expand
Collapse
 
Array
 
Bitmap File
 
Bounding Box
 
Color
 
Container
 
Doclet
 
Ellipse
 
Intersection
 
Language
 
Map
 
Matrix
 
Number
 
Nurbs
 
Range
 
STL File
 
Streams
 
String
 
Surface
 
Text File
 
Triangle
 
Vector
 
Vertex
 
Wave File