Update of /cvsroot/freevo/freevo/src/gui/widgets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3187

Modified Files:
        image.py 
Log Message:
add shadow support for images

Index: image.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/widgets/image.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** image.py    7 Sep 2004 18:48:57 -0000       1.4
--- image.py    9 Oct 2004 16:21:51 -0000       1.5
***************
*** 1,30 ****
  # -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------
  # image.py - basic image widget
! # -----------------------------------------------------------------------
  # $Id$
  #
! # -----------------------------------------------------------------------
! # $Log$
! # Revision 1.4  2004/09/07 18:48:57  dischi
! # internal colors are now lists, not int
! #
! # Revision 1.3  2004/08/22 20:06:21  dischi
! # Switch to mevas as backend for all drawing operations. The mevas
! # package can be found in lib/mevas. This is the first version using
! # mevas, there are some problems left, some popup boxes and the tv
! # listing isn't working yet.
! #
! # Revision 1.2  2004/07/27 18:52:31  dischi
! # support more layer (see README.txt in backends for details
! #
! # Revision 1.1  2004/07/25 18:14:05  dischi
! # make some widgets and boxes work with the new gui interface
! #
! # -----------------------------------------------------------------------
  #
  # Freevo - A Home Theater PC framework
  #
! # Copyright (C) 2002 Krister Lagerstrom, et al.
  #
  # This program is free software; you can redistribute it and/or modify
--- 1,19 ----
  # -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------------
  # image.py - basic image widget
! # -----------------------------------------------------------------------------
  # $Id$
  #
! # This file defines an image widget to use on a container or display. Besides
! # the normal CanvasImage this class can also auto-resize the image and draw
! # a shadow behind the image.
  #
+ # -----------------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
+ # Copyright (C) 2002-2004 Krister Lagerstrom, Dirk Meyer, et al.
  #
! # Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
! #
! # Please see the file freevo/Docs/CREDITS for a complete list of authors.
  #
  # This program is free software; you can redistribute it and/or modify
***************
*** 42,46 ****
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # ----------------------------------------------------------------------
  
  from mevas.image import CanvasImage
--- 31,35 ----
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # -----------------------------------------------------------------------------
  
  from mevas.image import CanvasImage
***************
*** 48,60 ****
  class Image(CanvasImage):
      """
!     An image object that can be drawn onto a layer
      """
!     def __init__(self, image, (x, y), size=None):
          if not image:
              CanvasImage.__init__(self, (1,1))
              return
!         
!         CanvasImage.__init__(self, image)
          if size:
              width, height = size
              # check width and height for scaling
--- 37,77 ----
  class Image(CanvasImage):
      """
!     An image that can be added to a container or display. It can be created
!     with an imagelib image or a filename and can optional position or resize
!     the image or create a shadow behind it.
      """
!     def __init__(self, image, pos=None, size=None, shadow=None):
!         """
!         Create the image.
!         Parameter description:
!         image    an imagelib image or string
!         pos      postion of the image on the parent
!         size     if set, the image will be scalled the given size. If width or
!                  height is None or -1, the image will be scalled to keep the
!                  aspect ratio
!         shadow   a tripple x,y,color defining the attributes of the shadow
!                  that will be added behind the image
!         """
          if not image:
+             # invalid image, return 1x1 empty space
              CanvasImage.__init__(self, (1,1))
              return
! 
!         if shadow:
!             # shadow used, drop a shadow at x,y with the given color
!             sx, sy, scolor = shadow
!             CanvasImage.__init__(self, (image.width + sx,
!                                         image.height + sy))
!             # draw shadow
!             self.draw_rectangle((sx, sy), (image.width, image.height),
!                                 scolor, 1)
!             # draw image
!             self.draw_image(image)
!         else:
!             # CanvasImage is only the image itself
!             CanvasImage.__init__(self, image)
! 
          if size:
+             # resize the image
              width, height = size
              # check width and height for scaling
***************
*** 68,70 ****
                  self.image.scale((width, height))
  
!         self.set_pos((x, y))
--- 85,89 ----
                  self.image.scale((width, height))
  
!         if pos:
!             # set position on parent
!             self.set_pos(pos)



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to