packages feed

BigPixel 1.2.0 → 1.3.0

raw patch · 2 files changed

+26/−9 lines, 2 files

Files

BigPixel.cabal view
@@ -1,5 +1,5 @@ Name:           BigPixel-Version:        1.2.0+Version:        1.3.0 License:        BSD3 License-File:   LICENSE Copyright:      Copyright (c) 2013 Manuel M T Chakravarty & Leon A Chakravarty@@ -11,7 +11,7 @@ Synopsis:       Image editor for pixel art Description:    BigPixel is an image editor for pixel art. It is aimed at creating graphics assets for retro or                 Minecraft-style 2D games. It supports the creation of pixelated images with 8x8 big pixels in-                256 colours with 16 levels of transparency. It is an OpenGL-based cross-platform application.+                256 colours including some with transparency. It is an OpenGL-based cross-platform application.                 BigPixel currently only supports the BMP image format.                 .                 As BigPixel is a plain OpenGL application without platform-specific GUI support, you need to start@@ -20,11 +20,12 @@                 created. All changes made to an image are persistent — i.e., reflected in the on disk image without                 explicit saving.                 .-                > Left mouse button          — draw with current colour-                > Left mouse button + Shift  — erase with transparency-                > Right mouse button         — erase with transparency-                > 'W', 'S', 'A', 'D'         - enlarge canvas to the top, bottom, left, and right, respectively-                > 'W', 'S', 'A', 'D' + Shift - shrink canvas from the top, bottom, left, and right, respectively+                > Left mouse button           — draw with current colour+                > Left mouse button + Shift   — erase with transparency+                > Left mouse button + Control — pick colour from image+                > Right mouse button          — erase with transparency+                > 'W', 'S', 'A', 'D'          - enlarge canvas to the top, bottom, left, and right, respectively+                > 'W', 'S', 'A', 'D' + Shift  - shrink canvas from the top, bottom, left, and right, respectively                 .                 WARNING: There is currently no undo facility! Make copies of image files if you are unsure whether                 you like to keep the changes. (However, if you shrink the visible canvas, the removed content can
src/BigPixel.hs view
@@ -537,7 +537,12 @@    -- Drawing and colour selection handleEvent (EventKey (MouseButton LeftButton) Down mods mousePos) state-  = let newState = state { penDown = Just (if shift mods == Up then colour state else transparent) }+  = let newState | ctrl  mods == Down = let pickedColour = pick mousePos state+                                        in+                                        state { penDown = Just pickedColour+                                              , colour  = pickedColour        }+                 | shift mods == Down = state { penDown = Just transparent    }+                 | otherwise          = state { penDown = Just (colour state) }     in return $ draw mousePos newState handleEvent (EventKey (MouseButton RightButton) Down mods mousePos) state   = let newState = state { penDown = Just transparent }@@ -572,7 +577,7 @@  -- Draw onto the canvas if mouse position is within canvas boundaries. ----- NB: Does image conversion as well; i.e., only use once per frame in the current form.+-- (NB: Does image conversion as well; i.e., only use once per frame in the current form.) -- draw :: Point -> State -> State draw mousePos (state@State { penDown = Just col })@@ -587,6 +592,17 @@                         } draw _mousePos state   = state++-- Determine the colour at the given point in the image, or return the current colour if the position is outside the+-- image.+--+pick :: Point -> State -> Color+pick mousePos (state@State { colour = col })+  = case windowPosToCanvas (canvasSize state) mousePos of+    Nothing  -> col+    Just idx -> canvas state ! (base `vplus` idx)+      where+        base = fst (area state)  -- Select a colour if mouse position is within palette boundaries. --