Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Image Transparency
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Superskull85




PostPosted: Sat Mar 31, 2007 5:43 pm   Post subject: 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:

code:
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?
Sponsor
Sponsor
Sponsor
sponsor
lordroba




PostPosted: Sat Mar 31, 2007 6:21 pm   Post subject: Re: Image Transparency

Use Pic.SetTransparentColor

example:
code:
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




PostPosted: Sat Mar 31, 2007 6:59 pm   Post subject: RE:Image Transparency

code:
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 Very Happy
Superskull85




PostPosted: Sat Mar 31, 2007 7:12 pm   Post subject: Re: Image Transparency

lordroba @ Sat Mar 31, 2007 6:21 pm wrote:
Use Pic.SetTransparentColor

example:
code:
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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: