
-----------------------------------
Superskull85
Sat Mar 31, 2007 5:43 pm

Image Transparency
-----------------------------------
I'm using BMP images and I can make BMP's with white backgrounds transparent using picMerge, but I wanted to know how to make any background transparent (If thats possible with Turing). This is the code I am using now:

unit

module XMBPreview

    export XMB1, XMB2

    %Declare variables
    var XMB1Background, XMB2Background : int %Variable to store the users background picture
    var XMB1Icon1, XMB1Icon2, XMB1Icon3, XMB1Icon4, XMB1Icon5, XMB1Icon6 : int %Variables to store main XMB icons for XMB1
    var XMB2Icon1, XMB2Icon2, XMB2Icon3, XMB2Icon4, XMB2Icon5, XMB2Icon6 : int %Variables to store main XMB icons for XMB2

    XMB1Background := Pic.FileNew ("XMB One/background.bmp")

    XMB1Icon1 := Pic.FileNew ("XMB One/1.bmp")
    XMB1Icon2 := Pic.FileNew ("XMB One/2.bmp")
    XMB1Icon3 := Pic.FileNew ("XMB One/3.bmp")
    XMB1Icon4 := Pic.FileNew ("XMB One/4.bmp")
    XMB1Icon5 := Pic.FileNew ("XMB One/5.bmp")
    XMB1Icon6 := Pic.FileNew ("XMB One/6.bmp")

    %XMB One
    procedure XMB1

	Draw.FillBox (0, 0, 485, 277, black)

	%Background

	Pic.Draw (XMB1Background, 0, 0, picCopy)

	%Icons

	%Settings Icon
	Pic.Draw (XMB1Icon1, 20, 102, picMerge)

	%Photo Icon
	Pic.Draw (XMB1Icon2, 104, 102, picMerge)

	%Music Icon
	Pic.Draw (XMB1Icon3, 173, 102, picMerge)

	%Video Icon
	Pic.Draw (XMB1Icon4, 242, 102, picMerge)

	%Game Icon
	Pic.Draw (XMB1Icon5, 311, 102, picMerge)

	%Network Icon
	Pic.Draw (XMB1Icon6, 380, 102, picMerge)
    end XMB1

    XMB2Background := Pic.FileNew ("XMB Two/background.bmp")

    XMB2Icon1 := Pic.FileNew ("XMB Two/1.bmp")
    XMB2Icon2 := Pic.FileNew ("XMB Two/2.bmp")
    XMB2Icon3 := Pic.FileNew ("XMB Two/3.bmp")
    XMB2Icon4 := Pic.FileNew ("XMB Two/4.bmp")
    XMB2Icon5 := Pic.FileNew ("XMB Two/5.bmp")
    XMB2Icon6 := Pic.FileNew ("XMB Two/6.bmp")

    %XMB Two
    procedure XMB2

	Draw.FillBox (485, 0, 970, 277, black)

	Pic.Draw (XMB2Background, 485, 0, picCopy)

	%Icons

	%Settings Icon
	Pic.Draw (XMB2Icon1, 20 + 485, 102, picMerge)

	%Photo Icon
	Pic.Draw (XMB2Icon2, 104 + 485, 102, picMerge)

	%Music Icon
	Pic.Draw (XMB2Icon3, 173 + 485, 102, picMerge)

	%Video Icon
	Pic.Draw (XMB2Icon4, 242 + 485, 102, picMerge)

	%Game Icon
	Pic.Draw (XMB2Icon5, 311 + 485, 102, picMerge)

	%Network Icon
	Pic.Draw (XMB2Icon6, 380 + 485, 102, picMerge)
    end XMB2

end XMBPreview


Also is it possible to properly view BMP that have their information stored in the ALPHA layer in Turing?

-----------------------------------
lordroba
Sat Mar 31, 2007 6:21 pm

Re: Image Transparency
-----------------------------------
Use Pic.SetTransparentColor

example:
var pic1 : int := Pic.FileNew ("pic1.bmp")
Pic.SetTransparentColor (pic1, blue)
Pic.Draw (pic1, x, y, picMerge)

This will make the color 'blue' transparent in your picture.  

Btw, post your XMB once you're done with it, I'd like to see how it turns out.

-----------------------------------
Clayton
Sat Mar 31, 2007 6:59 pm

RE:Image Transparency
-----------------------------------
var XMB1Icon1, XMB1Icon2, XMB1Icon3, XMB1Icon4, XMB1Icon5, XMB1Icon6 : int %Variables to store main XMB icons for XMB1
    var XMB2Icon1, XMB2Icon2, XMB2Icon3, XMB2Icon4, XMB2Icon5, XMB2Icon6 : int %Variables to store main XMB icons for XMB2 


Code like that just screams arrays. Take a look at my tutorial in the Turing Walkthrough :D

-----------------------------------
Superskull85
Sat Mar 31, 2007 7:12 pm

Re: Image Transparency
-----------------------------------
Use Pic.SetTransparentColor

example:
var pic1 : int := Pic.FileNew ("pic1.bmp")
Pic.SetTransparentColor (pic1, blue)
Pic.Draw (pic1, x, y, picMerge)

This will make the color 'blue' transparent in your picture.  

Btw, post your XMB once you're done with it, I'd like to see how it turns out.

Thanks, this will be very helpful! I'll post my XMB when I'm done, I could also submit the entire program as well. 

I've never even used arrays before, but I'll make sure to read the tutorial.
