BBjDrawPanel::drawImage

Description

In BBj 16.0 and higher, this method draws a BBjImage on the BBjDrawPanel.

Syntax

Return Value

Method

void

drawImage(BBjImage image, int x1, int y1, int x2, int y2)

Parameters

Variable

Description

image

The BBjImage to be drawn.

x1

Horizontal position of upper left corner of the image.

y1

Vertical position of the upper left corner of the image.

x2

Horizontal position of the lower right corner of the image.

y2

Vertical position of the lower right corner of the image.

Return Value

None.

Remarks

If (x1,y1) equals (x2,y2), the image is not scaled to fit the specified rectangle but is instead drawn in its intrinsic size, with the upper right corner of the image at (x1,y1).

Example

rem ' BBjDrawPanel::drawImage

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = "BBjDrawPanel::drawImage"
window! = sysgui!.addWindow(25,25,400,300,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
drawpanel! = window!.getDrawPanel()
url$ = "https://www.basis.cloud/images/basislogo.jpg"
image! = javax.imageio.ImageIO.read(new java.net.URL(url$))
os! = new java.io.ByteArrayOutputStream()
javax.imageio.ImageIO.write(image!,"png",os!)
bytes! = os!.toByteArray()
imagemanager! = sysgui!.getImageManager()
image! = imagemanager!.loadImageFromBytes(bytes!)
x1 = 25
y1 = 25
x2 = 25
y2 = 25
drawpanel!.drawImage(image!,x1,y1,x2,y2)
w = image!.getWidth()
h = image!.getHeight()
x1 = 25
y1 = 25 + h + 25
x2 = x1 + w * 2
y2 = y1 + h * 2
drawpanel!.drawImage(image!,x1,y1,x2,y2)
process_events

eoj:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

IMAGE Mnemonic - Draw Bitmapped Image (SYSGUI)

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.