# Processing bug?

**URL:** https://discourse.processing.org/t/processing-bug/6561
**Category:** Processing
**Created:** [December 13, 2018, 1:27pm UTC](https://discourse.processing.org/t/processing-bug/6561 "2018-12-13T13:27:14Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [December 14, 2018, 3:00pm UTC](https://discourse.processing.org/t/processing-bug/6561/21 "2018-12-14T15:00:00Z")

</div>

> [@clankill3r](#):
>
> Also for a gui library where you might wan’t to draw on a different PGraphics instead of the main one.

You could also just change the code in the OP to -

```auto
PGraphics v;

void setup() {
  size(300, 300, P2D);
  v = createGraphics(260, 200, JAVA2D);
  updateBuffer();
}

void draw() {
  background(200, 200, 255);
  image(v, 20, 20);
}

void updateBuffer() {
  v.beginDraw();
  v.background(255);
  colorMode(HSB, 360, 100, 100);
  int c = color(300, 100, 100); //NO 'unexpected token:.' runtime error?
  colorMode(RGB, 255, 255, 255);
  v.fill(c);
  v.noStroke();
  v.ellipse(130, 100, 130, 100);
  v.endDraw();
}

```

I’m not saying it’s ideal, but it’s not a _requirement_ to be able to use color with an offscreen graphics (unless you’re getting into threading)

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [December 14, 2018, 3:04pm UTC](https://discourse.processing.org/t/processing-bug/6561/22 "2018-12-14T15:04:34Z")

</div>

@neilcsmith you have taken my words out of context so giving them a different meaning and then contradict them. Wow

I said the pre-processor hid the OO syntax for newbies, I call that simplification! The decision to use `color` as an alias for `int` was again aimed at early sketchers / graphic designers, personally I think it was a huge error of judgement. Fancy having a data type with the same name as a method, its just wrong.

Whatever the rights and wrongs of the pre-processor the problem is, it takes valid Processing code (according to API) and converting it to invalid Java code, and I would like it fixed.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [December 14, 2018, 3:09pm UTC](https://discourse.processing.org/t/processing-bug/6561/23 "2018-12-14T15:09:10Z")

</div>

> [@neilcsmith](#):
>
> I’m not saying it’s ideal, but it’s not a _requirement_ to be able to use color with an offscreen graphics (unless you’re getting into threading)

It _is a requirement_ that an instance of PGraphics can call the method `color` it is in the documented API and in the source code. It is just the pre-processor makes a mess of it.

I was already aware of the code fix you posted and I agree it will do the job but is ineligant and shouldn’t be necessary. I **HATE** writing code like that.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [December 14, 2018, 3:15pm UTC](https://discourse.processing.org/t/processing-bug/6561/24 "2018-12-14T15:15:00Z")

</div>

> [@quark](#):
>
> @neilcsmith you have taken my words out of context so giving them a different meaning and then contradict them. Wow

Sorry! But then you took mine out of context too then! 😉 But that comes to some ambiguity as to what syntax and structure are in programming languages. Hiding the OOP stuff isn’t what I was criticising in the first place.

> [@quark](#):
>
> I was already aware of the code fix you posted and I agree it will do the job but is ineligant and shouldn’t be necessary. I **HATE** writing code like that.

Up to you! It’s not much different to any other “global” mathematical function in Processing in my mind - it’s not a property of the underlying PGraphics.

---

<div class="post-metadata">

### Author: ![clankill3r](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/clankill3r/32/1098_2.png) [@clankill3r](https://discourse.processing.org/u/clankill3r)
#### Post date: [January 1, 2019, 7:27pm UTC](https://discourse.processing.org/t/processing-bug/6561/25 "2019-01-01T19:27:13Z")

</div>

I just noticed something, in the `preferences.txt` you can change:

`preproc.color_datatype=true`

to

`preproc.color_datatype=false`

It will brake all examples using color as a datatype, but for me that is worth it.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [January 2, 2019, 9:26am UTC](https://discourse.processing.org/t/processing-bug/6561/26 "2019-01-02T09:26:40Z")

</div>

Nice one, shame its not false by default.

[Previous page](https://discourse.processing.org/t/processing-bug/6561.md?page=1)
