Re: Windows & backgrounds
| From: | Joel De Gan | Date: | Fri, 06 Aug 2004 18:01:00 +0000 |
| Subject: | Re: Windows & backgrounds | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4942@lists.php.net to get a copy of this message | ||
There are several ways to do this.
The preferred way:
http://us3.php.net/manual/en/function.imagettftext.php
But you need to have php with xpm compiled in.
Or, the hard way which is a lot of programming:
Take the following font files I have at http://lucifer.intercosmos.net/fonts/
and map them over to what you need to display. (you can find others
online as examples of fonts).
For a "general" purpose (i.e. work on anything/anywhere) the second
method would be okay, but would require a lot of work and would be
pain. I would say after you have created the xpm in php, you just use
the builtin text writing funtions.
I have some examples here in the source for that weather app I sent
you a screencap of earlier:
http://lucifer.intercosmos.net/index.php?view=phpalphawall
That is heavy on the alpha channels though, so ignore most of that and
remove the alpha parts if they are around in there too much. Pay
special attention to the "placetext" function.
Hope that helps
-joeldg
On Fri, 06 Aug 2004 20:46:26 +0300, Cosmin <cosminb@as.ro> wrote:
> The files are located at:
> http://www3.infoiasi.ro/~cosmin/down/10.xpm
> http://www3.infoiasi.ro/~cosmin/down/bg.xpm
> http://www3.infoiasi.ro/~cosmin/down/screen.jpg (this is how is
> supposed
> to look like in the end, that's the karamba app I was talking about, and
> my dog :))
> I don't think I was trying to do the same thing you are suggesting. Let
> me give you an example from HTML: put a picture in the background(HTML,
> BODY, whatever ..) and then add text,pics, etc. ... meaning that I don't
> want to modify the image every time I want to modify the text.
>
>
>
>
> On Fri, 2004-08-06 at 19:59, Joel De Gan wrote:
> > I would need to see the XPM's you are using.
> > In the heading of the XPM, the color set for transparent needs to be
> > set to "None" in the colors definitions (it is always at the top)..
> >
> > >From a quick glance, it looks like you have everything set correctly
> > in how you are creating the images for display, so I will assume that
> > the XPM itself does not have transparency set.. please correct me if I
> > am wrong.
> >
> > I am assuming you are trying to do something similar to what I did here:
> >
> > http://lucifer.intercosmos.net/images/screenshot_2003-05-23_16:31:51.png
> > (on the right, the weather applet; that one is actually done in PHP,
> > but not done in php-gtk, it is a script that paints to the background
> > image and then refreshes the background image once every few hours,
> > but just for how it looks I am assuming that is what you are going
> > for).
> >
> > If you have a website somewhere that you can post the images you are
> > trying to use, it would help to see and I would be more than happy to
> > set up the image for you.
> >
> > -joeldg
> >
> > On Fri, 06 Aug 2004 19:52:05 +0300, Cosmin <cosminb@as.ro> wrote:
> > > First of all let me tell you what I'm to do: I'm trying to do a weather
> > > program. something that will tell me what's the weather in my city(no, i
> > > didn't stole your idea :), I've already did this thing using
> > > karamba&php
> > > almost a year ago and I've thought it would be nice to do it with
> > > php-gtk and use it on my windows machine)
> > >
> > > I've managed to put the image in the background. But now I have another
> > > problem. The images I add are not transparent. Here is what I've did so
> > > far:
> > > <?php
> > > dl('php_gtk.'.PHP_SHLIB_SUFFIX);
> > > $window = &new GtkWindow(GTK_WINDOW_DIALOG);
> > > $window->connect_object('destroy', array('gtk',
> > > 'main_quit'));
> > > $window->set_uposition(gdk::screen_width()/3.7, gdk::screen_height()/4);
> > > $window->realize();
> > > list($pixmap, $mask) = gdk::pixmap_create_from_xpm($window->window,
> > > null, dirname(__FILE__).'/images/bg.xpm');
> > > list($pixmap1, $mask1) = gdk::pixmap_create_from_xpm($window->window,
> > > null, dirname(__FILE__).'/images/10.xpm');
> > > $tpixmap1 = &new GtkPixmap($pixmap1, $mask1);
> > > $tpixmap = &new GtkPixmap($pixmap, $mask);
> > > $window->unrealize();
> > >
> > > $window->shape_combine_mask($mask, 0, 0);
> > > $vbox = &new GtkVBox();
> > > $vbox->pack_start($tpixmap1);
> > > $vbox->pack_start(new GtkButton('test'));
> > > $vbox->add($tpixmap);
> > > $vbox->show_all();
> > > $window->add($vbox);
> > >
> > > $window->show_all();
> > > gtk::main_iteration();
> > > gtk::main();
> > > ?>
> > >
> > > I don't know if the trick with $vbox->pack_start() and then $vbox->add()
> > > is bug or a feature but it works(only if I do pack_start() first and
> > > then add()) on my linux machine(I'll test it on windows later). If you
> > > have any code on how to make the images transparent or maybe another way
> > > to achieve this I'll be very grateful.
> > >
> > > ps: sorry for my bad english
> > >
> > > Regards,
> > > Cosmin Budinschi
> > >
> > >
> > >
> > > On Fri, 2004-08-06 at 18:53, Joel De Gan wrote:
> > > > (sorry didn't click to send to the list as well as you)
> > > >
> > > > Hi, I wrote that tutorial.
> > > >
> > > > Yes it is.
> > > > Look over the functions and you will see the function that creates the
> > > > base XPM that I use to draw on.
> > > > You can replace that with a different image (i.e. a transparent image
> > > > with a border) and draw on that as you need. I have played around with
> > > > LCD-like interfaces that do mouse-overs and hold button state etc.
> > > >
> > > > But that base xpm function is the one you need to focus on.
> > > >
> > > > -joeldg
> > > >
> > > > On Fri, 06 Aug 2004 14:46:33 +0300, Cosmin <cosminb@as.ro> wrote:
> > > > > Is it possible to put an image(.xpm) as background to a window? or at
> > > > > least to make the window transparent?
> > > > >
> > > > > I've read this tutorial: ©îèeoÜÓÖ\‹�ÛÔ
> > > > > VÇhttp://lucifer.intercosmos.net/tut/ but it only
> > > > > modifies some xpms and then displays them.
> > > > > I need to put an image in the background and the add some buttons and
> > > > > other stuff(who will also be images or created from one with
> > > > > shape_combine_mask()) to the window.
> > > > >
> > > > > --
> > > > > PHP-GTK General Mailing List (http://gtk.php.net/)
> > > > > To unsubscribe, visit:
> > > > > http://www.php.net/unsub.php
> > > > >
> > > > >
> > >
> > > --
> > > PHP-GTK General Mailing List (http://gtk.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>