Version 15 (modified by danvisel, 16 years ago) (diff) |
---|
Analysis
Overview
When the fill style is "pattern", the background of the frame or the page becomes another image which may be repeated.
Task requirements
- If the user chooses the PATTERN fill type in the frame or page border & fill HUD, a "pattern settings" button should be shown instead of the color square.
- The default pattern fill is empty.
- When the pattern settings button is clicked, the pattern settings window is opened, allowing the user to change the pattern settings.
- Pattern fill must support general fill opacity.
- The pattern settings window has the following elements:
- A drop box, where an image can be dragged from the resources. This image becomes the pattern; dragging a second image onto the drop box changes the pattern to the second image.
- Image x- and y-offset fields: these can either be in percent or in points, default being 0; these values can be negative. The image is moved right and down from the top left corner of the frame by the value of the offset.
- A "repeat" checkbox. If this is checked and the image is smaller than the frame, the image repeats. If it is not checked, the image does not repeat. Default is to repeat.
- An "Okay" button: when this is clicked, the pattern settings window is closed.
Task result
The result of this task is source code.
Implementation idea
Calculate the needed scene image elements to fill the frame and add them to the frame scene element. Use the java.awt.Graphics2D methods to show the image resource.
Related
FRAME_APPEARANCE_HALO_AND_HUD_R0
FRAME_FILLING_GRADIENT_R0
FRAME_FILLING_SOLID_R0
FRAME_FILLING_IMAGE_R0
How to demo
- Make a new book, add an image to the resources. Open page's border & fill HUD, choose pattern fill, set the image in the resources as the pattern image, change settings to demonstrated possibilities. Then add a text frame to a page. Open frame's border & fill HUD, choose pattern fill, set the image in the resources as the pattern image, change settings to something different from what is used on the page.
Design
Implementation
(Implementation results should be described and linked here (from the wiki or the repository))
Testing
Comments
- It would be nice to be able to rotate the image used for the pattern (this was in Sophie 1).
- It would be nice to be able to resize the image used for the pattern, proportionately as well as disproportionately (this was in Sophie 1).