Skip to content
New issue

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

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

Already on GitHub? # to your account

Cast more functions from double to int #184

Closed
gaocegege opened this issue Jul 23, 2017 · 4 comments
Closed

Cast more functions from double to int #184

gaocegege opened this issue Jul 23, 2017 · 4 comments

Comments

@gaocegege
Copy link
Member

  • Anything named "mode":
    • blendMode()
    • colorMode()
    • ellipseMode()
    • imageMode()
    • rectMode()
    • shapeMode()
    • textureMode()
    • textMode()
  • Other configuration-setting functions:
    • pixelDensity()
    • strokeCap()
    • strokeJoin()
    • textureWrap()
@jeremydouglass
Copy link
Member

If I recall right, originally you were putting casts from double to int in BuiltinApplet for anything that would set a global configuration variable. However, rather than adding more (from this list), all the casting was removed.

https://github.com/gaocegege/Processing.R/commits/master/src/rprocessing/applet/BuiltinApplet.java

Now the issue is closed. Can you remind me why the casting was removed, and how this was resolved?

@gaocegege
Copy link
Member Author

I am not sure if I understand you. The mode functions such as blendMode accept int parameter but actually, it only accepts the constants defined in PConstants, so there is no need to cast those functions.

@jeremydouglass
Copy link
Member

jeremydouglass commented Aug 21, 2017

I mean, this issue was created when BuiltinApplet.java had things like this:

https://github.com/gaocegege/Processing.R/blob/97dd10c5020b10f8eb1caec58b08dc0636c165c5/src/rprocessing/applet/BuiltinApplet.java#L61-L63

and later on cast warnings were added:

https://github.com/gaocegege/Processing.R/blob/c3b98be2657921b7b4efb274c74b6a91443df74d/src/rprocessing/applet/BuiltinApplet.java#L73-L76

...so is this issue resolved because that whole approach was dropped in favor of using PConstants as arguments? I believe that everything in the list takes a PConstant except pixelDensity().

@gaocegege
Copy link
Member Author

Yeah the colorMode could be removed. Only pixelDensity should be casted manually.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants