Author: duncan
Date: Wed Jan 10 19:01:25 2007
New Revision: 8959
Modified:
branches/rel-1/freevo/src/skins/main/area.py
branches/rel-1/freevo/src/skins/main/skin_utils.py
Log:
[ 1631758 ] Change pygame.scale for kaa.imlib2.scale
Patch from Gorka Olaizola applied, with a small modification
Modified: branches/rel-1/freevo/src/skins/main/area.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/area.py (original)
+++ branches/rel-1/freevo/src/skins/main/area.py Wed Jan 10 19:01:25 2007
@@ -576,7 +576,7 @@
if not image:
image = osd.loadbitmap(imagefile)
if image:
- image =
pygame.transform.scale(image,(bg.width,bg.height))
+ image = pygamesurface_imlib2_scale(image,
(bg.width,bg.height))
f = vfs.open(cache, 'w')
f.write(pygame.image.tostring(image, 'RGBA'))
f.close()
@@ -680,7 +680,7 @@
if self.xml_settings.anamorphic:
w = w * 0.75
if w > 0 and h > 0:
- cimage = pygame.transform.scale(cimage, (w, h))
+ cimage = pygamesurface_imlib2_scale(cimage, (w, h))
self.imagecache[cname] = cimage
return cimage
Modified: branches/rel-1/freevo/src/skins/main/skin_utils.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/skin_utils.py (original)
+++ branches/rel-1/freevo/src/skins/main/skin_utils.py Wed Jan 10 19:01:25 2007
@@ -31,7 +31,7 @@
import pygame
from pygame.locals import *
-import kaa.imlib2 as Image
+import kaa.imlib2 as imlib2
import osd
import os
@@ -44,6 +44,17 @@
load_imagecache = util.objectcache.ObjectCache(20, desc='load_image')
+def pygamesurface_imlib2_scale(image, newsize):
+
+ buf = pygame.image.tostring(image, 'RGBA')
+ im2 = imlib2.new(image.get_size(), buf)
+ scaled_im2 = im2.scale(newsize)
+
+ buf = str(scaled_im2.get_raw_data('BGRA'))
+
+ return pygame.image.frombuffer(buf, newsize, 'RGBA')
+
+
def format_image(settings, item, width, height, force=0, anamorphic=0):
try:
type = item.display_type
@@ -72,7 +83,7 @@
imagefile = None
if item.image:
- if isinstance(item.image, Image.Image):
+ if isinstance(item.image, imlib2.Image):
image = osd.loadbitmap(item.image)
else:
image = load_imagecache['thumb://%s' % item.image]
@@ -96,7 +107,7 @@
except Exception, e:
pass
- if item['rotation']:
+ if image and item['rotation']:
image = pygame.transform.rotate(image, item['rotation'])
if not image:
@@ -171,7 +182,7 @@
else:
height = int(float(width * i_h) / i_w)
- cimage = pygame.transform.scale(image, (width, height))
+ cimage = pygamesurface_imlib2_scale(image, (width, height))
format_imagecache[cname] = cimage, width, height
return cimage, width, height
@@ -206,7 +217,7 @@
else:
height = int(float(width * i_h) / i_w)
- cimage = pygame.transform.scale(image, (width, height))
+ cimage = pygamesurface_imlib2_scale(image, (width, height))
cimage.set_alpha(cimage.get_alpha(), RLEACCEL)
x_mod = 0
if l[1] == 'CENTER':
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog