Transparent Background?
 
 
 
PST User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Transparent Background? Expand / Collapse
Author
Message
Posted 7/29/2008 1:07:29 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/30/2008 3:02:07 PM
Posts: 6, Visits: 17
Hi all,

I am designing an experiment that has to do with distance and face perception.  I designed the stimulus background and I need two face images to appear simultaneously.  My experiment is running well, except that I cannot make the backgrounds of my images transparent.  Even though I edit them to be transparent in GIMP, and I set the background to transparent in eprime, they show up on a colored background.  Basically, what I need is floating heads.  I have tried to save these images in multiple formats.  This is a major obstacle, because if there is no way to make the background of the sub-images transparent I must go through each and every image (hundreds) and position them where I want them to be in the background, copy, paste, and all of that. Please help!

Thanks,

cshay

Post #1883
Posted 7/30/2008 4:06:46 PM


Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Yesterday @ 4:03:21 PM
Posts: 34, Visits: 153
As far as I know, the only way to do this is to design your images with a specific color that you want to become transparent. Then, you can use Canvas.SourceColorKey to make that color transparent at runtime.

Here is the example code from the help topic:

'This example loads an image to the current canvas, copies that image to
'an off-screen canvas, then uses that image to present animation.



'Create a Canvas
Dim cnvs As Canvas
Set cnvs = Display.Canvas

Dim x, y, i, carlength As Integer
x = 10
y = 150
carlength = 250

'Create off-screen canvas
Dim offScreenCnvs As Canvas
Set offScreenCnvs = Display.CreateCanvas
offScreenCnvs.Clear
offScreenCnvs.SourceColorKey = CColor("black")

'Define the source and destination rectangles
Dim carRect As Rect
carRect.Left = 0
carRect.Right = carlength
carRect.Top = 0
carRect.Bottom = 150

'Load the image to the active display, then copy off-screen
ImageDisplay1.Draw
Sleep 2000
offScreenCnvs.Copy cnvs, carRect, carRect

'Define destination rectangle
Dim destRect As Rect
destRect.Left = x
destRect.Right = x+carlength
destRect.Top = y
destRect.Bottom = y+150

cnvs.FillColor = CColor("blue")

For i = 1 to Display.XRes-carlength
cnvs.clear
Display.WaitForVerticalBlank
cnvs.Copy offScreenCnvs, carRect, destRect, ebEffectSourceColorKey
x = x+1
destRect.Left = x
destRect.Right = x+carlength
Sleep 20
Next i

'To run this example with E-BasicExample.es, copy the script
'above and paste it into the After InLine object. Create the
'ImageDisplay1 object in the Unreferenced E-Objects folder.
'In the Properties Window for ImageDisplay1, set Filename to
'"redcar.bmp", and BackColor to "blue". RedCar.bmp is located
'in the Samples\PictureRT folder as part of the E-Prime install. In
'addition, set the AlignHorizontal to "left" and 'AlignVertical to "top".

Post #1896
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -5:00, Time now is 10:16am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 9 queries. Compression Disabled.