de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Displaying multiple images at once
PostPosted: Mon May 25, 2015 11:20 am 
Offline
Veteran
User avatar
I never considered this, as I was stuck in the old CyberMistress "one image per 'page'" mindset, until I realized that the White Queen script loads multiple images at once to show the player and opponent's card hands!

I looked at the code for it but it made absolutely zero sense to me (way beyond my knowledge!), but I'd love to use a simpler technique for a big project I'm working on.

So, assuming this is indeed possible, can someone help me out with how I would display an image on TOP of another image?

Example:
* The "bottom" image fills the picture area just like a normal image. It could be a "background" of a bedroom.
* The smaller "top" image (which could be a person with a transparent background) appears centered over the bottom one, so the background can be seen where it is transparent.
* For those who know them, think of how visual novels (and engines like RenPy) display backgrounds and characters for the similar effect I'm trying to achieve here.

Can something like this be done with SexScripts/Groovy or am I wasting my time?


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Mon May 25, 2015 11:39 am 
Offline
Site Admin
User avatar
There is no simple mean, but it's not too hard. The White Queen use it. As it is done, it won't work with Android.

The second one must be a PNG file.

Here is an example
Code:
TODO


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Mon May 25, 2015 4:57 pm 
Offline
Veteran
User avatar
I wrote a function fro sexcards script (that I did not publish - as wanted to keep it android safe):
Code:
overlayimage(background,overlay)

I will try and dig the code for it out tomorrow as I don't have it on my laptop but I used it to overlay an image on a card so should do what you want :-)

_________________
Liz

You can't take something off the Internet - it's like taking pee out of a pool.
https://play-clan.site profile: Liz


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Mon May 25, 2015 9:23 pm 
Offline
Veteran
User avatar
Found it.. and updated it for ver 6..

Code:
// SetImageOverlay(background image, overlay image, x pos, y pos of overlay)
def setImageOverlay = { picture, opicture, xpos, ypos ->
  def image = java.awt.Toolkit.getDefaultToolkit().getImage("images/"+picture)
  def width = image.getWidth()
  def height = image.getHeight()
  def oimage = java.awt.Toolkit.getDefaultToolkit().getImage("images/"+opicture)
  def owidth = oimage.getWidth()
  def oheight = oimage.getHeight()
 
  def frameBuffer = new java.awt.image.BufferedImage(width, height, java.awt.image.BufferedImage.TYPE_4BYTE_ABGR)
  def sprite = javax.imageio.ImageIO.read(new File("images/"+picture))
  def osprite = javax.imageio.ImageIO.read(new File("images/"+opicture))
  java.awt.Graphics2D graphics = frameBuffer.createGraphics()
  graphics.drawImage(sprite,0,0,width,height, null)
  graphics.drawImage(osprite,xpos,ypos,owidth,oheight, null)
 
  java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream()
  javax.imageio.ImageIO.write(frameBuffer, "png", baos)
  setImage(baos.toByteArray(),0) 
}


so can use the function as follows:
setImageOverlay("part1.png","part2.png",40,0)

_________________
Liz

You can't take something off the Internet - it's like taking pee out of a pool.
https://play-clan.site profile: Liz


Last edited by Liz on Wed May 27, 2015 11:06 pm, edited 1 time in total.

Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Tue May 26, 2015 8:06 am 
Offline
Veteran
User avatar
Thank you SO much! That is awesome, and exactly what I was wanting to do!

In fact, it's so cool, can I include it in an update to my "tutorial" script, Liz?


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Tue May 26, 2015 10:21 am 
Offline
Veteran
User avatar
Banjo wrote:
Thank you SO much! That is awesome, and exactly what I was wanting to do!

In fact, it's so cool, can I include it in an update to my "tutorial" script, Liz?


You're welcome, feel free to use it in your tutorial - just a rehash of other peoples work anyway :-) I always thought it may be interesting to do something with the fight script with it.. but now you got me thinking I may write a visual novel with a bit of kinky twist to it for my next project...

_________________
Liz

You can't take something off the Internet - it's like taking pee out of a pool.
https://play-clan.site profile: Liz


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Wed May 27, 2015 11:09 pm 
Offline
Veteran
User avatar
Note:
Have fixed the bug above that stops it working on linux (second to last line jpg should be png)

_________________
Liz

You can't take something off the Internet - it's like taking pee out of a pool.
https://play-clan.site profile: Liz


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Wed Jun 10, 2015 5:17 pm 
Offline
Veteran
User avatar
Good to have that fixed, Liz... thanks!

One question for you or Doti, though... is it possible to display the overlay as "upside-down" (i.e. flipped vertically)? It doesn't have to be as a case-by-case parameter, just something in the actual setImageOverlay that says "show the overlay .png but rotate it 180 degrees").


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Wed Jun 10, 2015 5:57 pm 
Offline
Site Admin
User avatar
Everything is possible but : 180 degrees rotation is not a vertical flip


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Wed Jun 10, 2015 6:04 pm 
Offline
Veteran
User avatar
Quote:
is it possible to display the overlay as "upside-down" (i.e. flipped vertically)?


To flip vertically have a - height value in the overlay

graphics.drawImage(osprite,xpos,ypos,owidth,-oheight, null)

_________________
Liz

You can't take something off the Internet - it's like taking pee out of a pool.
https://play-clan.site profile: Liz


Top
 Profile Send private message 
 
 Re: Displaying multiple images at once
PostPosted: Thu Jun 11, 2015 7:28 am 
Offline
Veteran
User avatar
Thanks heaps, Liz!

And changing both width and height (to minus) "rotated" it upside-down.

Works perfectly. I appreciate the quick help.


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.