Name
ExtractPalette -- extract palette from object (V9.0)
Synopsis
[id] = ExtractPalette(id, srctype, srcid[, frame])
Function
This function extracts the palette from the object specified by srctype and srcid, creates a new palette and assigns the identifier id to that new palette. If you pass Nil as id, ExtractPalette() will return a handle to the new palette to you. Otherwise the new palette will use the identifier specified in id.

The following object types can be passed in srctype:

#ANIM:
Extract palette from an anim frame. If you set srctype to #ANIM, you also need to pass the anim frame whose palette should be extracted in the frame parameter. Frames are counted from 1, which is also the default value for frame.

#BGPIC:
Extract palette from a BGPic.

#BRUSH:
Extract palette from a brush.

#FONT:
Extract palette from a color font.

#SPRITE:
Extract palette from a sprite frame. If you set srctype to #SPRITE, you also need to pass the sprite frame whose palette should be extracted in the frame parameter. Frames are counted from 1, which is also the default value for frame.

Inputs
id
identifier of the palette to be created or Nil for auto id selection
srctype
object type to use as source (see above)
srcid
id of source object to use
frame
optional: number of frame to use if object type is #ANIM or #SPRITE (defaults to 1)
Results
id
optional: handle to the new palette; will only be returned if you specified Nil in id
Example
ExtractPalette(1, #BRUSH, 10)
The code above extracts the palette from brush 10 and stores it as palette object 1.

Show TOC