Fabrice  Closier <[EMAIL PROTECTED]> wrote:
> I have one script running where i use 2 members bitmap + 1 text member
> to generate a new composite of the 3... i need to [minimize and] rotate
> the text info before making the composite.
> how do i do this?

Hi Fabrice,

Here's a variation on Buzz's handler that allows you to scale the title, and
keep it transparent and in its original color.  It's a good deal faster than
the other handler of mine that was quoted, but it only deals with 90° turns.

If the text uses more than one color, you'll need to rotate the rgb channel
as well as the alpha channel: there's a line in the code below that you'll
need to uncomment.  (Caution, though: a bug in Director means that parts of
letters that overhang others may appear in the wrong color).

Cheers,

James

----------------------------------------------------------------------------
 

on RotateImage90(aTextMember, aScale) --------------------------------
  -- INPUT: <aTextMember> should be a text member, but the handler
  --         could be adapted for 32-bit bitmaps, Flash and
  --         VectorShape members
  --        <aScale> should be an integer or floating point number
  -- OUTPUT: an image object representing aTextMember rotated through
  --         90° and scaled by aScale
  --
  -- EXAMPLE:
  --    member("Bitmap").image = RotateImage90(member("Text"), 0.5)
  --------------------------------------------------------------------
  
  tSource = aTextMember.image.extractAlpha()
  tRect   = tSource.rect
  tWidth  = tRect.width * aScale
  tHeight = tRect.height * aScale
  
  -- Create a rotated alpha channel
  tAlpha  = image(tHeight, tWidth, 8)
  
  -- Read from top to bottom
  tQuad = [ \
point(tHeight, 0), \
point(tHeight, tWidth), \
point(0,       tWidth), \
point(0,       0)]
  
  --  -- To read from bottom to top, use this instead
  --  tQuad = [ \
--point(0,       tWidth), \
--point(0,       0), \
--point(tHeight, 0), \
--point(tHeight, tWidth)]
  
  -- Copy the rotated text image into the alpha channel
  tAlpha.copyPixels(tSource, tQuad, tRect)
  
  -- Make a new image (rotated) to put the rotated version in
  tTarget = image(tHeight, tWidth, 32, 8)
  tTarget.fill(tTarget.rect, aTextMember.color)--only for text members
  -- Use the following line instead for text in multiple colors or for
  -- non text members:
  -- tTarget.copyPixels(aTextMember.image, tQuad, tRect)
  
  tTarget.setAlpha(tAlpha)
  
  return tTarget
end RotateImage90

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to