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

colorize but only for the outline color of a pict #82

Open
mgunyho opened this issue Dec 18, 2023 · 8 comments
Open

colorize but only for the outline color of a pict #82

mgunyho opened this issue Dec 18, 2023 · 8 comments

Comments

@mgunyho
Copy link

mgunyho commented Dec 18, 2023

Pict has adjuster functions linewidth and linestyle to adjust the properties of the outline of a pict, and colorize which changes either the fill color or both the fill color and outline color depending on which ones are not specified (as far as I can tell). Is there a way to change only the outline color of an existing pict? To me it feels more "functional" to compose line styles and colors with (linewidth <style> <pict>) than to specify #:border-color and #:color keyword arguments for each kind of function that creates new picts.

@rfindler
Copy link
Member

This seems like a nice addition to the library; maybe colorize should get some new options? Looking at the implementation, I see that colorize is using the internal sexp data structure directly which may or may not be the best way to continue with this library; I think we went away from extending that at some point in the past.

@mgunyho
Copy link
Author

mgunyho commented Dec 18, 2023

maybe colorize should get some new options?

To me it feels more natural to have separate functions for the outline and the fill color (to me the logical grouping would be one function for line color/width/dash style and another for fill color/texture). But I only have a little experience with Pict, so I don't know which would work better.

@soegaard
Copy link
Member

soegaard commented Dec 18, 2023

Metapict has a collection of functions that control the pen and brush of a pict.

https://docs.racket-lang.org/metapict/index.html#%28part._.Pen_.Adjusters%29

In this case, I think you want pencolor.

image

@mgunyho
Copy link
Author

mgunyho commented Dec 19, 2023

Ah, that is indeed what I was looking for. Perhaps I should look into Metapict. As I said in another comment, Metapict seemed to me like an advanced extension to Pict with lots of fancy functions, so I wanted to learn the base library first.

@rfindler
Copy link
Member

Sounds to me like you're ready for metapict! I'd say that the separation between the libraries is more a product of history than a careful design that learners are meant to progress through.

@samth
Copy link
Member

samth commented Dec 19, 2023

Metapict is a great library but I also think that both this and the suggestion in #81 would be good to add to pict itself.

@rfindler
Copy link
Member

rfindler commented Dec 19, 2023 via email

@soegaard
Copy link
Member

soegaard commented Dec 19, 2023

It would indeed be natural for the pen and brush adjusters to live in pict.

The code lives here:
https://github.com/soegaard/metapict/blob/master/metapict/pict.rkt

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

4 participants