Claims
- 1. A method in a data processing system for managing color maps, the method comprising:
responsive to a request to add a color map to a color table, determining whether the color map is already installed in the color table; if the color map is not already installed in the color table, deciding whether a free block of color table entries sufficient to hold the color map is present in the color table; determining whether existing blocks of color table entries in the color table can be rearranged to form a new free block of color table entries, if the free block of color table entries is insufficient to hold the color map; rearranging the existing blocks of color table entries in the color table if the existing blocks of color table entries can be rearranged to form the new free block of color table entries; and installing the color map in the new free block of color table entries after the block of color table entries has been formed by rearranging the existing blocks of color table entries.
- 2. The method of claim 1 further comprising:
terminating the method if the color map is already installed in the color table.
- 3. The method of claim 1 further comprising:
removing a selected block of color table entries if the existing blocks of color table entries cannot be rearranged to form the block of color table entries.
- 4. The method of claim 1, wherein the selected block is selected as a block of color table entries having a size that is at least equal to a size of the block of color table entries.
- 5. The method of claim 1, wherein the selected block is selected as a least recently used block of color table entries.
- 6. The method of claim 3 further comprising:
repeating to the determining step after removing the selected block of color table entries.
- 7. The method of claim 1, wherein the rearranging step rearranges all empty slots within the color table into a single block of color table entries.
- 8. The method of claim 1, further comprising:
allocating a color map structure; and storing colors and a last color identification in the color map structure.
- 9. A data processing system for managing color maps, the data processing system comprising:
a bus system; a memory connected to the bus system, wherein the memory includes a set of instructions; and a processing unit, wherein the processing unit executes the set of instructions to determine whether the color map is already installed in the color table in response to a request to add a color map to a color table; decide whether a free block of color table entries sufficient to hold the color map is present in the color table if the color map is not already installed in the color table; determine whether existing blocks of color table entries in the color table can be rearranged to form a new free block of color table entries if the free block of color table entries is insufficient to hold the color map; rearrange the existing blocks of color table entries in the color table if the existing blocks of color table entries can be rearranged to form the new free block of color table entries; and install the color map in the new free block of color table entries after the block of color table entries has been formed by rearranging the existing blocks of color table entries.
- 10. A data processing system for managing color maps, the data processing system comprising:
first determining means, responsive to a request to add a color map to a color table, for determining whether the color map is already installed in the color table; deciding means for deciding whether a free block of color table entries sufficient to hold the color map is present in the color table if the color map is not already installed in the color table; second determining means for determining whether existing blocks of color table entries in the color table can be rearranged to form a new free block of color table entries, if the free block of color table entries is insufficient to hold the color map; rearranging means for rearranging the existing blocks of color table entries in the color table if the existing blocks of color table entries can be rearranged to form the new free block of color table entries; and installing means for installing the color map in the new free block of color table entries after the block of color table entries has been formed by rearranging the existing blocks of color table entries.
- 11. The data processing system of claim 10 further comprising:
removing a selected block of color table entries if the existing blocks of color table entries cannot be rearranged to form the block of color table entries.
- 12. The data processing system of claim 10, wherein the selected block is selected as a block of color table entries having a size that is at least equal to a size of the block of color table entries.
- 13. The data processing system of claim 10, wherein the selected block is selected as a least recently used block of color table entries.
- 14. The data processing system of claim 11 further comprising:
repeating to the determining step after deleting the selected block of color table entries.
- 15. The data processing system of claim 10, wherein the rearranging step rearranges all empty slots within the color table into a single block of color table entries.
- 16. A computer program product in a computer readable medium for managing color maps, the computer program product comprising:
first instructions responsive to a request to add a color map to a color table, for determining whether the color map is already installed in the color table; second instructions for deciding whether a free block of color table entries sufficient to hold the color map is present in the color table if the color map is not already installed in the color table; third instructions for determining whether existing blocks of color table entries in the color table can be rearranged to form a new free block of color table entries, if the free block of color table entries is insufficient to hold the color map; fourth instructions for rearranging the existing blocks of color table entries in the color table if the existing blocks of color table entries can be rearranged to form the new free block of color table entries; and fifth instructions for installing the color map in the new free block of color table entries after the block of color table entries has been formed by rearranging the existing blocks of color table entries.
- 17. The computer program product of claim 16 further comprising:
sixth instructions for terminating the method if the color map is already installed in the color table.
- 18. The computer program product of claim 16 further comprising:
sixth instructions for removing a selected block of color table entries if the existing blocks of color table entries cannot be rearranged to form the block of color table entries.
- 19. The computer program product of claim 16, wherein the selected block is selected as a block of color table entries having a size that is at least equal to a size of the block of color table entries.
- 20. The computer program product of claim 16, wherein the selected block is selected as a least recently used block of color table entries.
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] The present invention is related to the following applications entitled: “Method and Apparatus for Dynamically Sizing Color Tables,” Ser. No. ______ , attorney docket no. AUS920030027US1; all filed even date hereof, assigned to the same assignee, and incorporated herein by reference.