[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Surfarray question
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Surfarray question
- From: "Abhinav Lele" <abhinav.lele@xxxxxxxxx>
- Date: Tue, 21 Oct 2008 23:18:07 +0530
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 21 Oct 2008 13:48:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=4XpWo6IGD5CmbWGiC9We0drB7G3NaGnJ1GVyeaVBkUc=; b=LfjW/c4sDsZT0CX/cJTzeYdpNcmzZTvzP3CWoroPvzpMzxjzM+CgYrLI6R6kCTq1K4 1weWNQOOnqv+eqino/Nu/4d6hLp2GGxzind3w/Uld7MUMeFNkt1Zg6KLeSzG9AZbUQXg zDxCajwndyAy2FCUmN/bVY1hOQnec0p2VCpEQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=ul/Uawsc3u5vdvQV5ovJ+H3XZgRODqT58t2CFmvRPDaqFhaH1z0ugz7Q9QwFaP6dPZ 0ipytTJWr0JX0goaMSDY/L11l5j1dhBUsYj3bNnlv77hhqukfz+Je1eRtKT053wburiD DBOSEtsqBeqw3ilsHZ+h4Jxj9uJCD7q085w7s=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi,
I am using surfarray to blit an image.
When i use array2d i see the image being renderer, but with array3d i dont.
I use the following code to load image :
r_temp_surface = pygame.image.load(fpath).convert_alpha()
salpha = r_temp_surface.get_alpha()
r_surface = pygame.Surface((o_w,o_h)).convert_alpha()
pygame.transform.smoothscale(r_temp_surface,(o_w,o_h),r_surface)
#if salpha != None:
# r_surface.set_alpha(salpha)
r_array = pygame.surfarray.array3d(r_surface)
print "New Surface Alpha: " , r_surface.get_alpha()
storeObject.lib_set(o_id,"__render_surface",r_surface)
storeObject.lib_set(o_id,"__render_array",r_array)
To render I use :
r_myarray = storeObject.lib_get(o_id,"__render_array")
r_mysurface = storeObject.lib_get(o_id,"__render_surface")
pygame.surfarray.blit_array(r_mysurface, r_myarray)
surface.blit (r_mysurface,(gx,gy))
Plz help.
-Abhinav