forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trans. Images

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
2Xtremes2004



Joined: 31 Aug 2005
Posts: 53

PostPosted: Sat Dec 03, 2005 1:21 pm    Post subject: Trans. Images Reply with quote

I noticed that on the first function I call, I can use transparent images but if i press (X) to go to the next function, it wont blit the pic as transparent. Is this a bug or is there something Im doing wrong?
_________________
I want my money back!?
Back to top
View user's profile Send private message
2Xtremes2004



Joined: 31 Aug 2005
Posts: 53

PostPosted: Wed Dec 07, 2005 1:20 am    Post subject: Reply with quote

44 views and no help? Common ppl! :P

Ok, I have created a sample code to show you what im talking about.

Blank.png = 480*272 blank image with colors of (77,77,77)
Trans.png = 138*126 blank image with colors of (255,255,255) Opacity of 50%
Code:

-------------------------------------------
-- USB
System.usbDiskModeActivate()
-------------------------------------------

-------------------------------------------
-- Load Images
Skin = {
First = Image.load("Blank.png"),
TransPic = Image.load("Trans.png")
}
-------------------------------------------

-------------------------------------------
-- Main App
function MainApp()

   while true do
   pad = Controls.read()
   
      screen:blit(0,0, Skin.First)
   
      if pad:cross() then
      SecApp()
      end
   
      if pad:square() then
      screen:blit(50,50, Skin.TransPic)
      end
   
      if pad:start() then
      break
      end
   
      screen.waitVblankStart()
      screen.flip()
   
      end
end
-------------------------------------------

-------------------------------------------
-- Second App
function SecApp()

   while true do
   pad = Controls.read()
   
      screen:blit(50,50, Skin.TransPic)
   
      if pad:start() then
      break
      end
   
      screen.waitVblankStart()
      screen.flip()
   
      end
end
-------------------------------------------

-------------------------------------------
while not Controls.read():start() do
   MainApp()
end
-------------------------------------------

_________________
I want my money back!?
Back to top
View user's profile Send private message
JoshDB



Joined: 05 Oct 2005
Posts: 87

PostPosted: Wed Dec 07, 2005 4:13 am    Post subject: Reply with quote

Okay... What's your problem, more specifically?
Back to top
View user's profile Send private message Send e-mail AIM Address
2Xtremes2004



Joined: 31 Aug 2005
Posts: 53

PostPosted: Wed Dec 07, 2005 8:54 am    Post subject: Reply with quote

ok, if you press square it will blit the image with transparent just like its supose to. However if you press cross it will load the second function but the image is no longer transparent, just a white square. I was wonder if this is something i am doing wrong or if its a bug, or if it can only blit trans images to the first function.
_________________
I want my money back!?
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Wed Dec 07, 2005 9:23 am    Post subject: Reply with quote

2Xtremes2004 wrote:
I was wonder if this is something i am doing wrong or if its a bug, or if it can only blit trans images to the first function.


This is by design. When you press square, first the Skin.First image is blitted, which sets the screen to a fixed color, then your Skin.TransPic is blitted and all this in a loop. When you press cross, Skin.TransPic is blitted in a loop. Blitting Skin.TransPic the first time it is merged with the background with an alpha value of 50%. The second time there is already a bit white and Skin.TransPic is merged with this and so forth, until there is white only.
Back to top
View user's profile Send private message
2Xtremes2004



Joined: 31 Aug 2005
Posts: 53

PostPosted: Wed Dec 07, 2005 10:08 am    Post subject: Reply with quote

Ok, thx for clearing that up. I now have it fixed :)
_________________
I want my money back!?
Back to top
View user's profile Send private message
sjurk



Joined: 08 Dec 2005
Posts: 4
Location: Oslo, Norway

PostPosted: Thu Jan 05, 2006 8:46 am    Post subject: Reply with quote

Um. Maybe a stupid question: Does this mean transparent PNGs are now supported in the latest Lua Player?

I tried something similar with a normal screen:blit using a gradient (black to transparent) 24-bit PNG created in Photoshop, resulting in only the first, black, line (i.e at 100% opacity) being blitted.

I can't see anything special in the code example above that sets the transparency apart from alpha data inside the PNG. Can't see any reference to transparancy in the function reference either.

Anyone able to shed some light on this?
Back to top
View user's profile Send private message Visit poster's website
JoshDB



Joined: 05 Oct 2005
Posts: 87

PostPosted: Thu Jan 05, 2006 9:46 am    Post subject: Reply with quote

The latst lua player supports aplha transparency from 0% to 100%, i.e. partial transparency
Back to top
View user's profile Send private message Send e-mail AIM Address
sjurk



Joined: 08 Dec 2005
Posts: 4
Location: Oslo, Norway

PostPosted: Sat Jan 07, 2006 5:50 am    Post subject: Reply with quote

Thanks for the reply. But, where do I enable partial transparency?

The function reference for blit still says "nil image:blit(x, y, Image source, [sourcex, sourcey, width, height], [alpha = true])". Does this mean that transparency should be set when creating the PNG image (if so, I haven't managed it - see my post above), or as a percentage for alpha (i.e not a boolean value as stated in the reference?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group