-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding drag/paint functionality to drawing pane
- Loading branch information
1 parent
7b450f0
commit ee22974
Showing
3 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import javafx.scene.layout.FlowPane; | ||
import javafx.scene.paint.Color; | ||
import java.util.Map; | ||
|
||
public class PreviewPane extends FlowPane { | ||
private Map<Pixel, Color> pixelMap; | ||
private int workspaceSize = 32; | ||
private int bitStyle; | ||
|
||
public PreviewPane(int bitStyle) { | ||
this.bitStyle = bitStyle; | ||
updateSpace(); | ||
} | ||
|
||
public void updateColors(Map<Pixel, Color> pixelMap) { | ||
this.pixelMap = pixelMap; | ||
|
||
} | ||
|
||
private void updateSpace() { | ||
for(int i = 1; i <= bitStyle*bitStyle; i++) { | ||
int dim = workspaceSize/bitStyle; | ||
Pixel pix = new Pixel(dim); | ||
pixelMap.put(pix, Color.WHITE); | ||
|
||
pix.setFill(pixelMap.get(pix.getPixID())); | ||
|
||
getChildren().add(pix); | ||
} | ||
} | ||
|
||
private void updateSpace(Map<Pixel, Color> pixelMap) { | ||
|
||
} | ||
} |