Hi Simon,

You wrote:
> 
> Hi guys,
> 
> I am hoping some knows the answer to a question thats driving me nuts...
> Using imaging lingo ie. copyPixels, how do you copy five seperate graphic
> cast members onto one new cast member.

Don't know whether I well interpreted your question: copying five separate
graphic cast members should be accomplished by calling copyPixels five times,
I think. BTW here's a bit of code to play with. 

Copy and paste it into the movie script of a new movie. Then close the script
window and click the button Play on the Control Panel while observing wath happens
in the Internal Cast window. The code that follows uses no score and no sprites,
it runs and then stops.
It creates four 150x150 bitmaps in the first four free slots and names them
"1", "2", "3" and "4". "1" is an orange bitmap used as destination, while
"2", "3" and "4" are red, green and blue bitmaps used as sources. Three portions
of image, sized as 50x50, are copied from "2", "3" and "4" into "1" in such a
fashion that they are put along the diagonal of it.

-------------
on startMovie
  imgMbrNames = [ ]
  cleanUp(imgMbrNames)             -- delete any previously created bitmap
  fillMembers(imgMbrNames)         -- build four bitmaps
  copySourceIntoDest(imgMbrNames)  -- copy sources into destination
end

on cleanUp (mbrNames)
  repeat with i = 1 to 4
    if member(string(i)).type = #bitmap then member(string(i)).erase()
    mbrNames.append(string(i))
  end repeat
end

on copySourceIntoDest (mbrNames)
  i = 0
  j = 0
  repeat with k = 2 to mbrNames.count()
  -- this five local vars are here only for sake of clarity. Shouldn't be used. 
    imageObject = member(mbrNames[1]).image
    sourceImageObject = member(mbrNames[k]).image
    destinationRect = rect(i, j, i + 50, j + 50)
    sourceRect = rect(i, j, i + 50, j + 50)
    parameterList = [#ink: 36, #blendLevel:90]
    imageObject.copyPixels(sourceImageObject, destinationRect, sourceRect , 
parameterList)
    i = i + 50
    j = j + 50
  end repeat
end

on fillMembers (mbrNames)
  repeat with i = 1 to mbrNames.count()
    imgMbr = new(#bitmap) 
    imgMbr.name = mbrNames[i]
    member(imgMbr.name).image = image(150, 150, 16)
    img = member(imgMbr.name).image
    if i = 1 then
      img.fill(rect(0, 0, 150, 150), [#shapeType:#rect, #lineSize:1, #color:rgb(255, 
128, 64)])
    else
      img.fill(rect(0, 0, 150, 150), [#shapeType:#rect, #lineSize:1, #color:rgb(255 * 
(i = 2), 255 * (i = 3), 255 * (i = 4))])
    end if
  end repeat
end
-------------

Note #1: cleanUp(imgMbrNames) takes up the empty list imgMbrNames and fill
         it by reference with the names "1", "2", "3" and "4". Newly Lingo created
         members must be assigned with a name in order to avoid seeing them
         disappear while trying to access them.

Note #2: the sourceRect param in copySourceIntoDest was defined equal to the
         destinationRect. This means that e.g a portion of 50x50 is copied
         from the leftmost location of the red source rect into the leftmost
         location of the orange dest rect. The same holds for the other
         colors and locations. Of course this is not mandatory: you can
         copy from whatever location into whatever else.

The above code works but it's not optimized and doesn't involve anything special.
It's only for applying literally MM's definition of copyPixel four times.

HTH, 

Franco

IFC Programming Consultant
http://www.chnexus.com/main.htm
Private mailto:[EMAIL PROTECTED] | [EMAIL PROTECTED]

[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