Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

image transparent

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-03-2007, 10:41 AM
Junior Member
 
Join Date: Jul 2007
Location: Hong Kong
Posts: 49
Send a message via MSN to hung Send a message via Yahoo to hung Send a message via Skype™ to hung
Default image transparent

I am using forelayer and drawer (imagelib.dll) to drawimage1. The transparent color on drawimage1 works fine and the background can be view through the transparent color.

However, when I draw two images, the second image overlaps the first image, then I find the first image is covered by the second image and the transparent color.

I thought it is due to I can use only onle forelayer. Any walkaround to solve that?
Attached Images
File Type: jpg fallingball.JPG (9.5 KB, 30 views)
__________________
Yours,

Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth
Reply With Quote
  #2 (permalink)  
Old 08-03-2007, 12:13 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

If you are using ImageLib, then you could draw on the back layer with transparency.
That way, many drawings can overlap without hiding each other.
Code:
Sub App_Start
      Form1.Show
      drawer1.New1(
"Form1",false)
      bmpSrc.New1(AppPath & 
"\smiley.gif"'Loads an image from a file named smiley.gif
      rectSrc.New1(0,0,bmpSrc.Width,bmpSrc.Height) 'Same size as the image.
      rectDest.New1(100,100,25,25)
      drawer1.SetTransparentColor1(bmpSrc.GetPixel1(
0,0)) 'Sets the transparent color to be the color of pixel (0,0) in the bitmap
      drawer1.DrawImage1(bmpSrc.Value,rectSrc.Value,rectDest.Value,true)
       rectDest.X = 
80
        drawer1.DrawImage1(bmpSrc.Value,rectSrc.Value,rectDest.Value,
true)
      drawer1.Refresh2(rectDest.Value)     
End Sub
Reply With Quote
  #3 (permalink)  
Old 08-06-2007, 04:03 AM
Junior Member
 
Join Date: Jul 2007
Location: Hong Kong
Posts: 49
Send a message via MSN to hung Send a message via Yahoo to hung Send a message via Skype™ to hung
Default

Thanks. Yes, that works for static objects.

For simulating moving objects, I was using drawer.fillrectangle with forelayer transparency to to erase the forelayer so the background can resume viewable.

If I use background layer to draw the objects, I can not resume the background image easily. As shown in the attached screen cap.


To recover the background image, Is this the only way?:
- instead of erase old image, redraw the background image on background with only the portion that is covered but old image.

... it would be great if the transparency setting on background layer can apply to forelayer.
Attached Images
File Type: jpg transparent problem1.JPG (27.7 KB, 20 views)
File Type: jpg transparent problem2.JPG (14.6 KB, 15 views)
__________________
Yours,

Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth
Reply With Quote
  #4 (permalink)  
Old 08-07-2007, 06:41 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You could also draw on the fore layer using transparency.
That way, the background will not be altered from the drawings.
Attached Files
File Type: sbp BouncingSmiley.sbp (2.6 KB, 26 views)
Reply With Quote
  #5 (permalink)  
Old 08-08-2007, 03:00 AM
Junior Member
 
Join Date: Jul 2007
Location: Hong Kong
Posts: 49
Send a message via MSN to hung Send a message via Yahoo to hung Send a message via Skype™ to hung
Default

Quote:
Originally Posted by Erel View Post
You could also draw on the fore layer using transparency.
That way, the background will not be altered from the drawings.
Yes, I used fore layer in first sample but I found the problem that the fore layer transparency is referring to background image only, if second image overlaps first image, the transparent part of second image will show the background image part, but not the first image part (as attached in my first message).

When I use background layer to draw overlap image, in the Repaint loop, I need to draw the background image portion, then first image, at last the second image, so I can see the second image is on top of first image (as attached).

So what I see is the transparency of forelayer will redraw background image, but instead if it would be good if the transparency is on forelayer then on backgound layer, so when I use fore layer, I don't need to redraw backgound image in the Repaint loop but got the result as in the attached image.
Attached Images
File Type: jpg transparent problem3.JPG (13.3 KB, 15 views)
Attached Files
File Type: sbp fallingball.sbp (5.7 KB, 23 views)
__________________
Yours,

Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
transparent and toolbarbutton Byak@ Questions (Windows Mobile) 6 07-22-2008 03:45 PM
Transparent .gif? Zenerdiode Questions (Windows Mobile) 2 06-29-2008 03:58 PM
No 8-bit alpha for transparent pngs? Mistrel Questions (Windows Mobile) 2 10-13-2007 07:39 AM
transparent background,label cdeane Questions (Windows Mobile) 4 09-20-2007 06:45 AM
Something transparent (invisible) sloopa Questions (Windows Mobile) 1 05-20-2007 10:27 AM


All times are GMT. The time now is 01:04 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0