Notifications
Clear all

[Closed] bitmaps without a "frame"

Is there a way to add a bitmap in the background in a floater without getting the “border” that’s around the bitmap object?

What I would like to do is simply have a few buttons above a small background image.

One way would be to do a button with an image, problem is then the user can click it. You can of course also have a background image in the dialog object, but then it covers the complete rollout which i would like to avoid.

Ideas?

/Andreas

5 Replies

Have you tried the imgtag control? Sounds like the thing you’re looking for.

Cheers,
Martijn

1 Reply
(@f97ao)
Joined: 2 years ago

Posts: 0

Thanks, I had missed that one!

/Andreas

Is there a simple way to make a bitmap so that it’s infront of other ui items covering them?

/Andreas

Ok, I just found a serious problem with using the ImgTag in the background.
If you have it in the background you can’t press any buttons or touch any other ui objects.
So only useful as long as nothing is in front I’m afraid. Ideas?

/Andreas

1 Reply
(@magicm)
Joined: 2 years ago

Posts: 0

I think in your case (buttons on top of an image) the only option you have is to use a dialog background image. The example below takes the existing UI background color and creates an empty bitmap using that color. The custom image is then pasted onto that bitmap.

Note: The <pasteBitmap> command requires the avguard extensions. Obviously you can replace this with getpixels/setpixels if you don’t want to rely on the extension.

rollout bitmapDialog "Bitmap Dialog" width:230 height:167
(
	button btnTest "Test" pos:[16,16] width:80 height:24
	
	on bitmapDialog open do
	(
		-- get UI background color
		bgcolor = ((colorman.getcolor #background) * 255) as color
		-- create bitmap with size of dialog
		bgbitmap = bitmap bitmapDialog.width bitmapDialog.height color:bgcolor
		-- load custom bitmap
		mybitmap = openbitmap "C:/WINDOWS/Blue Lace 16.bmp"
		-- paste custom bitmap into background bitmap
		pastebitmap mybitmap bgbitmap [0, 0] [10, 10]
		-- assign background bitmap to dialog
		setdialogbitmap bitmapDialog bgbitmap
	)
)

createdialog bitmapDialog

Cheers,
Martijn