Re: Working with images



muppet wrote:

<snipped>

how big is the fade image? it is actually 400x300? if you're using an offset of 50x100 to put it in a different place, then i wager it's smaller than 400x300, and you're getting garbage rendered into the remainder. this would be the source of the "rendering bugs" -- from the screenshot it looks like they are actually extrapolations of the edge pixels, to fill in missing pixel values since you asked it to draw pixels that don't exist.

i think what you actually want is to render only the bit that you need:

   # calculate the upper left corner such that the small image
   # is centered in the large one
   my ($x, $y) = (
       ($splash_frame->get_width - $fade_image->get_width) / 2,
       ($splash_frame->get_height - $fade_image->get_height) / 2,
   );
   $fade_image->composite(
       $splash_frame,
       $x, $y,  # dest x/y
       # render entire *source* image's area
       $fade_image->get_width, $fade_image->get_height,
       $x, $y,  # offset x/y (see below)
       1, 1, # no scaling
       'nearest',
       $splash_counter * 2
);

Right. So I need to have both the images the same size, is that right? When I dropped your code in, the background image ( which is 400x300 ) got clipped to the same size as the $fade_image. That's fine. I'm just mucking around with stray images at the moment. I can create 2 images of the same size.

<snipped>

Problem 1:
The first one is probably just my lack of understanding. What I *want* is to have the background image remain 'static' in the background, ie always completely visible. Then I want the $fade_image to fade in.


did you set the transparency color correctly in the fade image? (e.g., when you were saving from the gimp or whatever.)

Um ... no O:-)
I'll make another image...

I seem to have it figured out enough to continue from here.
Thanks for your help, muppet :)

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 87616

The following links have been inserted by the NUS Consulting internal spam filter and are for NUS Consulting staff only
Spam
Not spam
Forget previous vote


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]