# Grixel - Retro Tools

>This is an application for creating bitmap structures to be used in Atari 8-bit computer programming.
The program assumes the user knows what they are doing, so it does not validate settings that don't make sense.
We can create single-screen structures or larger ones. The width will always be adjusted to a multiple of a data byte.
We can create in HiRes or LoRes with single or double pixel height in display lines.
The program allows for colorizing using the Atari sprite system (only players, missiles are not included yet).
It is possible to change the color of any register via DLI interrupt. DLI additionally supports changing the width of sprites.
The program supports multiple projects at once.

---

##### # Project
>
>A project can be created/loaded from the menu or selection bar:
![](Assets/Image/en-US/grixel_1.png)
`Project Name` is informational to help the user not get lost.
`TV System` determines which color palette we will be using.
`Pixel Mode` determines the mode for Antic.
`Width` for HiRes is a multiple of 8, and for LoRes it is a multiple of 4.
`Height` is "arbitrary".

---

##### # Editor

>1. Left part, selection, palette, and tools:
![](Assets/Image/en-US/grixel_2.png)
`Selection` indicates which register is assigned to the mouse buttons.
`Palette` contains the registers used to draw on the image. Clicking with the mouse assigns the register to the appropriate `Selection` field. Double-clicking opens the color selection that will be assigned to the register as the starting color (from the top line of the image). Registers BG (background), PF1, PF2 correspond to graphic data, while PM0, PM1, PM2, and PM3 are sprites. PM01 is the resulting color from overlapping PM0 and PM1, and similarly PM23 from PM2 and PM3. A sprite's color change is always in pairs. Small buttons 1, 2, and 4 below a specific sprite denote its starting width.
`Tools` is a set of tools supporting drawing:
 => Pencil, drawing pixel by pixel, we can increase the pencil thickness and shape.
 => Line, drawing lines, we start by pressing the mouse button and finish by releasing it. We can increase the line thickness and the shape of the endings.
 => Fill, we fill an area (not color but register) by choosing a pattern. White color on the pattern corresponds to LMB, and black to RMB.
 => Shape, we draw one of three shapes: square, circle, or ellipse. We can choose three variants: frame only (LMB color), fill only (LMB), or frame with fill (LMB, RMB).
 => Text, we can insert text from the content field, choose any system font and size. The color will be selected depending on the color button used. By holding the button, we can position it and confirm by releasing the button.
 => Selection, we can move and copy it. We confirm by clicking outside the selection area or by pressing "Enter".

---

##### # Color Selection Window
>
> 1. Single color.
![](Assets/Image/en-US/grixel_3.png)
Here we choose a single color, indicated by the marker in the bottom left corner of the window. The selection is made using the left mouse button.
> 2. Sprites Color.
![](Assets/Image/en-US/grixel_4.png)
Here we choose colors for sprite 0, 1 or 2,3. 0 or 2 are selected with the left mouse button and 1 or 3 with the right. The MIX color is updated in real time.

---

##### # Layers
>
>The program supports layers.
![](Assets/Image/en-US/grixel_5.png)
We draw on the active layer. We can add, remove, move, and merge them.
You can use the reference layer. It will be visible as the background of the image. It is located at the bottom of the layers panel. Its visibility can be toggled with the spacebar.

---

##### # Image Control Bars
>
>![](Assets/Image/en-US/grixel_6.png)

1. DLI Bar shows color changes for the register selected with LMB. To change the color, click the left mouse button on this bar at the desired place. The color selection window will open. From the top, the first color comes from the starting settings on the left side of the window on the "Palette" object.
If we want to change the color range, shift its beginning to another line, point the cursor at the bar in that range and use the mouse scroll wheel. This applies exclusively to the beginnings of ranges.
If we want to remove a color change range, click on it with the middle mouse button.
If we want to change the color of the range, right-click on this range.
2. Width Bar shows the width of the paired sprite registers, i.e., PM0 and PM1 or PM2 and PM3. Naturally, only when one of them is assigned to the LMB. The bar is designed so that it has three vertical lines for one register: the first green means that in this image line the sprite will have single width, the second yellow means double width, and the third red means quadruple width. To change the width, click on this bar for the respective register, and the width will cyclically change in a 1,2,4,1,2... sequence. Here, remember that the change affects the entire remaining height from the line you click on.
3. Validation Bar. When drawing with sprite registers, we must strictly adhere to the rules controlling sprite display on Atari. If we violate them, a horizontal red and/or yellow line will be drawn on the image in the line where the error occurs. This line is 4 pixels wide, one for each sprite register. If a pixel is red, it means that this register has violated the rules in that line. Such a line can be selected by clicking on this bar to ease finding the problem.

---

##### # Sprite Rules

1. With single width, the sprite width is 8 LoRes pixels. This means the extreme pixels for a given sprite register cannot be further apart than 8 pixels in one image line. In every subsequent image line, the rule is naturally the same but its usage position can vary. Appropriate DLI interrupt code will be added during export.
2. With double width, the sprite pixel is 2 LoRes pixels wide. When drawing, you must account for this since a single pixel will always generate an error. So here we also have 8 sprite pixels, but they have double width, allowing you to cover 16 LoRes pixels on the image.
3. With quadruple width, the sprite pixel is 4 LoRes pixels wide, and you can cover 32 LoRes pixels. You just need to remember about sprite pixel coherence.
4. It is slightly different in HiRes because the data pixels are smaller than the sprite pixel. Drawing with a normal register makes a small HiRes pixel, but the sprite uses a standard LoRes one. The rest of the rules remain unchanged.

---

##### # HiRes
>
>Unlike LoRes where we draw with all regular registers, in HiRes we only draw with PF1 (shade only) and PF2 (color and shade). Selecting a color for both registers sets the color for both registers. However, we must individually select the brightness.

---

##### # Export
>
>If the image fits on one Atari screen, the export will contain full code to launch and display the picture. Otherwise, it will generate raw data.
