61 | | ^(Describe your design here.)^ |
| 61 | * '''Algorithmic''': [[BR]] |
| 62 | This revision stabilizes and improves the design of the previous one. Most of the changes are minor and were introduced for performance optimisation. |
| 63 | * hashing [[BR]] |
| 64 | * Hash will not be an inner class for Hasher. |
| 65 | * Hasher will not aggregate a Hash object but will dublicate its state. Thus it will not be necessary to create a new Hash object every time a new entry is added which will make calculating hash values faster. A Hash object will be created only in the toHash() method. |
| 66 | * Most of the Hashable objects (especially sprites) will memoize their hash values. |
| 67 | * caching [[BR]] |
| 68 | * In QueryCache we will use LinkedHashMap instead of a simple HashMap. It will enable us to specify cache size and when the number of cache entries exceeds it, the least recently used entries will be deleted. |
| 69 | * inner representation of tiles - we are still looking for the best alternative. |
| 70 | * For each tile we can keep an array of integers representing its pixels (colors in ARGB format). We will have to write our own alpha composing function, color transformations and clipping operation. We hope that it will be faster than BufferedImage. |
| 71 | * The second option is to keep a BufferedImage for each tile and use its functions. It may prove that this is fast enough. |
| 72 | * Sprite fields: |
| 73 | * bounding rectangle - a rectangle that contains all points of the sprite |
| 74 | * space - a transformation matrix |
| 75 | * hash - memoized Hash code |
| 76 | * Sprite subclasses: |
| 77 | * ShapeSprite - sprite for filled shapes (ShapeSceneElements). It has a shape to fill and a filling to fill the shape with. |
| 78 | * ImageSprite - sprite for images. The only difference between ImageSprite and ShapeSprite with image as filling is that ImageSprite does not need a shape (it is determined by its space matrix only). |
| 79 | * ContourSprite - sprite for contour elements. It has an area and a line style (dashed or solid). |
| 80 | * ColorSprite - spite for color transformations. It multiplies all pixels of its source sprite by a given color. |
| 81 | * ClipSprite - sprite for clip effect. It limits the visible area of its source sprite. |
| 82 | * BlendSprite - sprite that combines two sprites in one. It has a static method that combines more than two sprites in one by constructing a binary tree of sprites. For now, the tree is almost a list, but it still enable us to reuse bottom tiles. |
| 83 | |
| 84 | * '''Hardware''': |