mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-31 06:30:18 +00:00
52 lines
2.4 KiB
Text
52 lines
2.4 KiB
Text
|
{{KW|BLOAD}} loads a binary graphics file created by {{KW|BSAVE}} to an array.
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
::: '''BLOAD {{Parameter|Filename$}}, {{KW|VARPTR}}({{Parameter|ImageArray%(index)}})'''
|
||
|
|
||
|
|
||
|
|
||
|
{{PageDescription}}
|
||
|
* {{Parameter|Filename$}} is the name of the file that the image should be saved to.
|
||
|
* {{Parameter|ImageArray%(index)}} is the Integer array that holds the image you want to save.
|
||
|
* There MUST be an Integer array of adequate size (up to 26K) to hold the graphic data!
|
||
|
* A {{KW|DEF SEG}} pointing to the array is required. {{KW|DEF SEG}} = {{KW|VARSEG}}(ImageArray%(index))
|
||
|
* {{Parameter|index}} is the starting image element of the Array. Can also include RGB color settings at the start index.
|
||
|
* Fullscreen images in {{KW|SCREEN}} 12 require 3 file {{KW|BLOAD}}s. A 26K array can hold 1/3 of screen.
|
||
|
* Custom RGB color settings can be embedded(indexed) at the start of the image array.
|
||
|
* {{KW|BLOAD}} Can be used to load any arrays that was saved with {{KW|BSAVE}}, not just graphics.
|
||
|
* Array sizes are limited to 32767 Integer elements due to use of {{KW|VARPTR}} in QB and '''QB64'''!.
|
||
|
* '''QB64''' can load larger arrays directly to and from binary files using {{KW|PUT}} # and {{KW|GET}} #.
|
||
|
|
||
|
|
||
|
''Example 1:'' Loading data to an array from a BSAVED file.
|
||
|
{{CodeStart}} '' ''
|
||
|
{{Cl|DEF SEG}} = {{Cl|VARSEG}}(Array(0))
|
||
|
{{Cl|BLOAD}} filename$, {{Cl|VARPTR}}(Array({{Cl|LBOUND}}(Array))) ' changeable index
|
||
|
{{Cl|DEF SEG}} '' ''
|
||
|
{{CodeEnd}}
|
||
|
:''Explanation:'' Referance any type of array that matches the data saved. Can work with Integer, Single, Double, Long, fixed length Strings or {{KW|TYPE}} arrays. {{KW|LBOUND}} determines the starting offset of the array or another index could be used.
|
||
|
|
||
|
|
||
|
''Example 2:'' Using a QB default colored image.
|
||
|
{{CodeStart}} '' ''
|
||
|
{{Cl|DEF SEG}} = {{Cl|VARSEG}}(Image%(0)) ' pointer to first image element of an array
|
||
|
{{Cl|BLOAD}} FileName$, {{Cl|VARPTR}}(Image%(0)) ' place data into array at index position 0
|
||
|
{{Cl|PUT (graphics statement)|PUT}}(Col, Row), Image%(0), PSET ' Put the image on the screen from index 0
|
||
|
{{Cl|DEF SEG}} '' ''
|
||
|
{{CodeEnd}}
|
||
|
: ''Note:'' [[PSET]] is used as a [[PUT (graphics statement)|PUT]] action that places the image over any background objects.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
{{PageSeeAlso}}
|
||
|
* [[BSAVE]], [[OPEN]], [[BINARY]]
|
||
|
* [[PUT]], [[GET]] {{text|(file statement)}}
|
||
|
* [[GET (graphics statement)]], [[PUT (graphics statement)]]
|
||
|
* [[VARSEG]], [[VARPTR]]
|
||
|
* [[DEF SEG]]
|
||
|
* [[Text Using Graphics]]
|
||
|
|
||
|
|
||
|
{{PageNavigation}}
|