I want to apply alpha/brightness effects manipulating the rgba components on the fly, which will be configurable as properties. That code is to be added after this works.
On 10/21/08, Noah Kantrowitz <[EMAIL PROTECTED]> wrote: > Why would you store them as arrays? That's pretty non-trivial overhead. > > --Noah > >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> On Behalf Of Abhinav Lele >> Sent: Tuesday, October 21, 2008 10:48 AM >> To: [email protected] >> Subject: [pygame] Surfarray question >> >> 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 > >
