Revision history for KeyPgScreenptr


Revision [21126]

Last edited on 2016-03-13 10:27:33 by fxm [Formatting]

No Differences

Revision [20508]

Edited on 2016-02-10 16:08:20 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Screenptr** ( ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
##**Screenptr**## provides a way to directly read/write the working page's frame buffer. ##[[KeyPgScreenlock|Screenlock]]## should be used before any read or writes are attempted. The pointer returned is valid up until any subsequent call to ##[[KeyPgScreengraphics|Screen]]## or ##[[KeyPgScreenres|Screenres]]##, which invalidates it.
##**Screenptr**## can also be used to test if a call to ##[[KeyPgScreengraphics|Screen]]## or ##[[KeyPgScreenres|Screenres]]## was successful, indicated by a non-NULL (##<> 0##) return value.
In order to access a pixel in the screen buffer, you will need to know the screen's bytes per pixel and pitch (bytes per row), and also the width and height to avoid going out of bounds. This information can be found out using ##[[KeyPgScreeninfo|Screeninfo]]##.

'' Set pixel address to the start of the row
'' It's a 32-bit pixel, so use a ULong Ptr
Dim As ULong Ptr pixel = row

For x As Integer = 0 To w - 1

'' Set the pixel value
*pixel = Rgb(x, x Xor y, y)

'' Get the next pixel address
'' (ULong Ptr will increment by 4 bytes)
pixel += 1

Next x

'' Go to the next row
row += pitch

- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Screenptr""**##.
- ##[[KeyPgScreengraphics|Screen (Graphics)]]##
- ##[[KeyPgScreenres|Screenres]]##
- ##[[KeyPgScreeninfo|ScreenInfo]]##
- ##[[KeyPgScreenlock|Screenlock]]##
- ##[[KeyPgScreenunlock|Screenunlock]]##
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Screenptr** ( ) [[KeyPgAs as]] [[KeyPgAny any]] [[KeyPgPtr ptr]]
##**Screenptr**## provides a way to directly read/write the working page's frame buffer. ##[[KeyPgScreenlock Screenlock]]## should be used before any read or writes are attempted. The pointer returned is valid up until any subsequent call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]##, which invalidates it.
##**Screenptr**## can also be used to test if a call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]## was successful, indicated by a non-NULL (##<> 0##) return value.
In order to access a pixel in the screen buffer, you will need to know the screen's bytes per pixel and pitch (bytes per row), and also the width and height to avoid going out of bounds. This information can be found out using ##[[KeyPgScreeninfo Screeninfo]]##.

'' Set pixel address to the start of the row
'' It's a 32-bit pixel, so use a ULong Ptr
Dim As ULong Ptr pixel = row

For x As Integer = 0 To w - 1

'' Set the pixel value
*pixel = Rgb(x, x Xor y, y)

'' Get the next pixel address
'' (ULong Ptr will increment by 4 bytes)
pixel += 1

Next x

'' Go to the next row
row += pitch

- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Screenptr""**##.
- ##[[KeyPgScreengraphics Screen (Graphics)]]##
- ##[[KeyPgScreenres Screenres]]##
- ##[[KeyPgScreeninfo ScreenInfo]]##
- ##[[KeyPgScreenlock Screenlock]]##
- ##[[KeyPgScreenunlock Screenunlock]]##


Revision [17742]

Edited on 2015-08-06 03:14:13 by FxMwikki [Changed 'ULong Ptr' instead of 'UInteger Ptr' in 2nd example for 64-bit compatibility]
Additions:
'' It's a 32-bit pixel, so use a ULong Ptr
Dim As ULong Ptr pixel = row
'' (ULong Ptr will increment by 4 bytes)
Deletions:
'' It's a 32-bit pixel, so use a UInteger Ptr
Dim As UInteger Ptr pixel = row
'' (UInteger Ptr will increment by 4 bytes)


Revision [16345]

Edited on 2012-09-16 11:12:11 by Chris319 [Changed 'ULong Ptr' instead of 'UInteger Ptr' in 2nd example for 64-bit compatibility]
Additions:
Returns a pointer to the current work page's frame buffer
a pointer to the current work page frame buffer memory, or NULL (##0##) if no graphics mode is set.
##**Screenptr**## provides a way to directly read/write the working page's frame buffer. ##[[KeyPgScreenlock Screenlock]]## should be used before any read or writes are attempted. The pointer returned is valid up until any subsequent call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]##, which invalidates it.
'' Lock the screen to allow direct frame buffer access
'' Lock the screen to allow direct frame buffer access
Deletions:
Returns a pointer to the current work page's framebuffer
a pointer to the current work page framebuffer memory, or NULL (##0##) if no graphics mode is set.
##**Screenptr**## provides a way to directly read/write the working page's framebuffer. ##[[KeyPgScreenlock Screenlock]]## should be used before any read or writes are attempted. The pointer returned is valid up until any subsequent call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]##, which invalidates it.
'' Lock the screen to allow direct framebuffer access
'' Lock the screen to allow direct framebuffer access


Revision [16330]

Edited on 2012-09-05 15:24:06 by CountingPine [Formatting, minor changes, give pitch more importance than width]
Additions:
a pointer to the current work page framebuffer memory, or NULL (##0##) if no graphics mode is set.
##**Screenptr**## can also be used to test if a call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]## was successful, indicated by a non-NULL (##<> 0##) return value.
In order to access a pixel in the screen buffer, you will need to know the screen's bytes per pixel and pitch (bytes per row), and also the width and height to avoid going out of bounds. This information can be found out using ##[[KeyPgScreeninfo Screeninfo]]##.
Because of the design of ""FreeBASIC"" graphics library, ##**Screenptr**## (if non-NULL) will always point to the backbuffer, and never to actual video RAM.
Deletions:
a pointer to the current work page framebuffer memory, or NULL (0) if no graphics mode is set.
##**Screenptr**## can also be used to test if a call to ##[[KeyPgScreengraphics Screen]]## or ##[[KeyPgScreenres Screenres]]## was successful, indicated by a non-NULL (<> 0) return value.
In order to access a pixel in the screen buffer, you will need to know the screen's width, height, bytes per pixel and pitch (bytes per row). This information can be found out using ##[[KeyPgScreeninfo Screeninfo]]##.
Because of the design of ""FreeBasic"" graphics library, ##**Screenptr**## (if non-ZERO) will always point to the backbuffer, and never to actual video RAM.


Revision [14519]

Edited on 2009-11-06 00:01:35 by DoS386 [backbuf vs VRAM]
Additions:
Because of the design of ""FreeBasic"" graphics library, ##**Screenptr**## (if non-ZERO) will always point to the backbuffer, and never to actual video RAM.
Deletions:
Because of the design of ''FreeBasic"" graphics library, ##**Screenptr**## (if non-ZERO) will always point to the backbuffer, and never to actual video RAM.


Revision [14518]

Edited on 2009-11-06 00:00:58 by DoS386 [backbuf vs VRAM]
Additions:
Because of the design of ''FreeBasic"" graphics library, ##**Screenptr**## (if non-ZERO) will always point to the backbuffer, and never to actual video RAM.


Revision [14441]

Edited on 2009-08-29 21:56:59 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]
Additions:
- New to ""FreeBASIC""
Deletions:
- New to FreeBASIC


Revision [14202]

Edited on 2009-08-02 19:25:33 by MeRick [corrected the second example, the comment said 8-bit when it actually makes a 32-bit screen]
Additions:
'' Make 32-bit screen.


Revision [13378]

The oldest known version of this page was created on 2008-05-21 11:56:04 by EcLipzer [corrected the second example, the comment said 8-bit when it actually makes a 32-bit screen]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode