Hi Mahmood

There is a method by which you can do this using director 8 and imaging
lingo. This is all email lingo and not intended to be optimized but it
should give you a rough idea as to where to start. I'm sure someone can
clean it up and optimize it a bit better

on mConvertImage
        vWidth = member("imageToConvert").width
        vHeight = member("imageToConvert").height
        vNewImage = image(vWidth, vHeight, 8, #somePallette)
        vNewImage.copyPixels( member("imageToConvert").image,\
        vNewImage.rect,  vNewImage.rect)
        vNewMember = new(#Bitmap)
        vNewMember.name = "someNewName"
        vNewMember.image = vNewImage
end mConvertImage

basically what I'm doing here is to create a new image object (vNewImage),
in order to create this object, I need to know upfront what the width and
height of this new image, which if you are just trying to remap an existing
castmember to a new palette, you can get from the rect of that member (hence
the reference to member("imageToConvert"). Assuming that you know the symbol
name of the palette that you wish to convert to (name of the palette
castmember plus the "#" sign out front). Assuming this is an 8 bit image,
your new image object will be the size of the original image, with a
bitdepth of 8 bits and the palette being the appropriate palette. The next
step is to copy the pixels from the original bitmap to the new image object
using the copyPixel command. You need to state the sourceRect and the
Destination Quad. Since these are identical, I've just used the rect of the
image object that I've just created.

Next you need some place to put that image ie.. put it back into an
castmember for safe storage. There seems to be a bit of disagreement on
whether it is advisable to overwrite an image of a higher bitdepth with an 8
bit image that is mapped to a specific palette (or for that matter to
overwrite an existing 8 bit image mapped to a different palette). Therefore
I've created a new bitmap castmember new(#Bitmap), gave it some descriptive
name so I can find it back and then assigned the image object to that
bitmap. I could have done the same thing by just getting the member
reference info from the original image, erased the member, created the new
member in the same place as the original, assigned it the original members
name and assigned the image. Alternatively, you could simply attempt to
assign the new image object to the original bitmap castmember, trusting that
Director does not get confused with color depth and palette references.

Okay, I'll leave it at that. Please note that this is all email lingo and
has not been tested. It will not work in Director 7 or below. I don't know
of any method to do it via lingo in D7 or below. You could batch process
this by selecting all the castmembers that you want to map to a specific
palette and choose modify -> transform bitmap and assign all of them the
correct palette.

Hope this helps.

Sincerely

Mark

--------------------------------------------
Mark R. Jonkman
Mark R. Jonkman Consulting
ADDRESS: 20 Windermere Crt., Guelph, ON, CANADA N1E 3L4
PHONE: 519-837-8509
EMAIL: [EMAIL PROTECTED]
--------------------------------------------


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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