Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mask support to floodFill #27

Closed
basvandijk opened this issue Sep 2, 2016 · 0 comments
Closed

Add mask support to floodFill #27

basvandijk opened this issue Sep 2, 2016 · 0 comments

Comments

@basvandijk
Copy link
Collaborator

basvandijk commented Sep 2, 2016

In #20 @timjb mentioned the following issue regarding the floodFill function:

Mask matrix support is still missing. I propose adding an argument of the following type to floodFill:

data FloodFillMask shape
   = FloodFillNoMask
   | FloodFillMask (MutMat (TwoLarger shape) ('S 1) Word8 (PrimState m))

type family TwoLarger :: DS [DS Nat] -> DS [DS Nat] where
    TwoLarger 'D = 'D
    TwoLarger ('S '[w, h]) = 'S [PlusTwo w, PlusTwo h]

type family PlusTwo :: DS Nat -> DS Nat where
    PlusTwo 'D = 'D
    PlusTwo ('S n) = 'S (n + 2)

Another issue: When using the FLOODFILL_MASK_ONLY flag, the image matrix can be immutable, since only the mask is written (and we don't need to ask the user for a fill color in this case). Maybe there should be a separate function for that usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant