Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

QBasic/Images

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

WARNING NONE of these functions work in IDEs other than QB64. Simple image rem image_display cls Dim Image as long x = 1000 'resolution y = 1000 Image = _loadimage("TEST.jpg") 'loading the image screen _newimage(x,y,32) 'putting screen sizes _putimage (0,0),Image 'putting image So you were most probably expecting miles of code. And there you have it, all you need to display an image in QB64! So, what does this astoundingly simple piece of code even do? A step-by-step explanation: We have DIMed our variable Image as a long value. This is because the image handle returned by the _loadimage function is a long value. x and y are our variables. They hold the values we need to put as the resolution. Thus ,for a 8n00 x 900 image, x = 800 ,y = 900. The image variable Image is next being put the handle values of the image "TEST.jpg". A healthy warning: Keep the image in the folder of the QB64 IDE. Or else, the function won't work! Next, we have resized the screen to fit the image. The newimage function requires three parameters, the resolution parameters and the color mode parameters. Here we have used 32-bit color modes, you can also use 256-bit pallete color modes. Lastly, we put the image using _putimage, which takes the Image variable (our image handle) as its parameter. 500px|an example of images in qbasic Secondary use of _newimage for setting screen details Well, you must be thinking, all these commands must be used in this exact same order. Nah, that isn't the case. You can use _newimage solo, to set the screen details, like shown below: screen _Newimage(1000,1000,256) This code sets the screen to a massive 1000 x 1000 resolution, with 256-bit palette color modes! 500px