Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #31949 > unrolled thread

Graphics wordset primitive semantics survey - color specification

Started byRoger Levy <roger.levy@gmail.com>
First post2014-06-27 08:39 -0700
Last post2014-06-28 14:47 -0400
Articles 10 — 5 participants

Back to article view | Back to comp.lang.forth


Contents

  Graphics wordset primitive semantics survey - color specification Roger Levy <roger.levy@gmail.com> - 2014-06-27 08:39 -0700
    Re: Graphics wordset primitive semantics survey - color specification Roger Levy <roger.levy@gmail.com> - 2014-06-27 09:01 -0700
    Re: Graphics wordset primitive semantics survey - color specification bruce.mcfarling@gmail.com - 2014-06-27 16:14 -0700
      Re: Graphics wordset primitive semantics survey - color specification Roger Levy <roger.levy@gmail.com> - 2014-06-27 17:07 -0700
        Re: Graphics wordset primitive semantics survey - color specification bruce.mcfarling@gmail.com - 2014-06-27 17:29 -0700
    Re: Graphics wordset primitive semantics survey - color specification Pablo Hugo Reda <pabloreda@gmail.com> - 2014-06-27 19:01 -0700
      Re: Graphics wordset primitive semantics survey - color specification BruceMcF <agila61@netscape.net> - 2014-06-28 13:02 -0700
        Re: Graphics wordset primitive semantics survey - color specification Pablo Hugo Reda <pabloreda@gmail.com> - 2014-06-28 13:09 -0700
          Re: Graphics wordset primitive semantics survey - color specification BruceMcF <agila61@netscape.net> - 2014-06-28 13:49 -0700
    Re: Graphics wordset primitive semantics survey - color specification "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-28 14:47 -0400

#31949 — Graphics wordset primitive semantics survey - color specification

FromRoger Levy <roger.levy@gmail.com>
Date2014-06-27 08:39 -0700
SubjectGraphics wordset primitive semantics survey - color specification
Message-ID<36679b7a-691a-4bd1-a09d-7701aec0f43c@googlegroups.com>
I'm working on a component for drawing graphics primitives, called PencilBox. 

This is a survey to find out about opinions regarding the semantics of specifying colors and the current drawing color and the current "background" color, used for clearing the screen.

A)
variable fgcolor
variable bgcolor

$ff0000ff constant red
$ffffffff constant white

: colored ( rgba -- ) \ rgba being a packed 32-bit RGBA color.  sets FGCOLOR
: backdrop ( rgba -- ) \ sets BGCOLOR

white backdrop
0 0 at   red colored   100 100 draw-box



B)
variable fgcolor
variable bgcolor

: color     create rgba 2swap swap f, f, swap f, f, does> fgcolor ! ;
: backdrop  fgcolor @ bgcolor ! ;

$ff0000ff color red
$ffffffff color white

white backdrop
0 0 at   red           100 100 draw-box

: colored  ( rgba -- ) 

$ff808080 colored backdrop
0 0 at   $ff00ff00 colored   100 100 draw-box

[toc] | [next] | [standalone]


#31954

FromRoger Levy <roger.levy@gmail.com>
Date2014-06-27 09:01 -0700
Message-ID<001605a3-0582-4f04-89bc-abd9b04ddb0c@googlegroups.com>
In reply to#31949
Disclaimer: PencilBox targets desktop OS's, and platforms that Allegro 5 can target. http://alleg.sourceforge.net/download.html

[toc] | [prev] | [next] | [standalone]


#31977

Frombruce.mcfarling@gmail.com
Date2014-06-27 16:14 -0700
Message-ID<8580d5e6-edd4-4165-95e4-d300ca2f3fd7@googlegroups.com>
In reply to#31949
On Friday, June 27, 2014 11:39:59 AM UTC-4, Roger Levy wrote:
> I'm working on a component for drawing graphics primitives, called PencilBox. 
> 
> This is a survey to find out about opinions regarding the semantics of specifying colors and the current drawing color and the current "background" color, used for clearing the screen.
>
> A)
> 
> variable fgcolor 
> variable bgcolor
>
> $ff0000ff constant red 
> $ffffffff constant white
> 
> : colored ( rgba -- ) \ rgba being a packed 32-bit RGBA color.  sets FGCOLOR 
> : backdrop ( rgba -- ) \ sets BGCOLOR

From the part1, you may be able to infer I prefer this one, with the addition of:

: colored@ ( -- rgba ) \ retrieves FGCOLOR 
: backdrop@ ( -- rgba ) \ retrieves BGCOLOR

... so a user defined box structure & box-structure drawing tool that specifies foreground its color can do:

... colored@ ( caller_FGCOLOR R: box-id )
   R@ boxcolor@ ?DUP 0= IF DUP THEN colored
   ... do operation ...
   ( caller_FGCOLOR ) colored 

[toc] | [prev] | [next] | [standalone]


#31979

FromRoger Levy <roger.levy@gmail.com>
Date2014-06-27 17:07 -0700
Message-ID<de0371e9-0cf7-4ee4-ac2e-23627cd26b79@googlegroups.com>
In reply to#31977
> From the part1, you may be able to infer I prefer this one, with the addition of:
> 
> 
> 
> : colored@ ( -- rgba ) \ retrieves FGCOLOR 
> 
> : backdrop@ ( -- rgba ) \ retrieves BGCOLOR
> 
> 
> 
> ... so a user defined box structure & box-structure drawing tool that specifies foreground its color can do:
> 
> 
> 
> ... colored@ ( caller_FGCOLOR R: box-id )
> 
>    R@ boxcolor@ ?DUP 0= IF DUP THEN colored
> 
>    ... do operation ...
> 
>    ( caller_FGCOLOR ) colored

yeah, a fetcher for FGCOLOR is probably a good idea in any case.  should I just leave FGCOLOR exposed?  or is it better to encapsulate it?

with B),

my thought on color words like RED is maybe the only 2 times you'd be using them is to specify the current color for a graphics operation or to specify the color of a game or GUI object you're about to create.  

if you need to manipulate the color "red" for any other purpose you'd just write $FF0000FF.  the rgba packed format is fixed, RED is just a convenience where supported.

[toc] | [prev] | [next] | [standalone]


#31980

Frombruce.mcfarling@gmail.com
Date2014-06-27 17:29 -0700
Message-ID<0833d9ee-f9ca-40b1-8375-281d8992e1aa@googlegroups.com>
In reply to#31979
On Friday, June 27, 2014 8:07:35 PM UTC-4, Roger Levy wrote:
> my thought on color words like RED is maybe the only 2 times you'd be using them is to specify the current color for a graphics operation or to specify the color of a game or GUI object you're about to create.

> if you need to manipulate the color "red" for any other purpose you'd just write $FF0000FF.  the rgba packed format is fixed, RED is just a convenience where supported.

Though a script can define color constants by role and then its possible to shift the palette of an existing script by defining them as values instead of constants and resetting them when desired and rerun the script.

You could, indeed, have a palette in the application and instead of a constant when the script was originally developed and tested, the same names are grabbing color values out of a slot in the palette.

[toc] | [prev] | [next] | [standalone]


#31983

FromPablo Hugo Reda <pabloreda@gmail.com>
Date2014-06-27 19:01 -0700
Message-ID<bd7ee386-d824-4a54-8021-55221fdd9482@googlegroups.com>
In reply to#31949
I use INK and PAPER from the old spectrum microcomputer

[toc] | [prev] | [next] | [standalone]


#32019

FromBruceMcF <agila61@netscape.net>
Date2014-06-28 13:02 -0700
Message-ID<fba4f913-e8b3-4188-9478-607904ac4ab6@googlegroups.com>
In reply to#31983
On Friday, June 27, 2014 10:01:18 PM UTC-4, Pablo Hugo Reda wrote:
> I use INK and PAPER from the old spectrum microcomputer

So would:
   get-ink -( -- FG-color )
   set-ink( FG-color -- )
   get-paper ( -- BG-color )
   set-paper ( BG-color -- )

... be good? Its a fixed 4 byte sized specification, so one cell in a 32 bit forth, two cells in a 16 or 20 bit forth.

[toc] | [prev] | [next] | [standalone]


#32020

FromPablo Hugo Reda <pabloreda@gmail.com>
Date2014-06-28 13:09 -0700
Message-ID<02f2c901-5e12-4440-b7d3-413157e85e26@googlegroups.com>
In reply to#32019
El sábado, 28 de junio de 2014 17:02:59 UTC-3, BruceMcF  escribió:
> On Friday, June 27, 2014 10:01:18 PM UTC-4, Pablo Hugo Reda wrote:
> 
> > I use INK and PAPER from the old spectrum microcomputer
> 
> 
> 
> So would:
> 
>    get-ink -( -- FG-color )
> 
>    set-ink( FG-color -- )
> 
>    get-paper ( -- BG-color )
> 
>    set-paper ( BG-color -- )
> 
> 
> 
> ... be good? Its a fixed 4 byte sized specification, so one cell in a 32 bit forth, two cells in a 16 or 20 bit forth.

I use 
INK | rgb32 --
INK@ | -- rgb32
PAPER | rgb32 --

PAPER@ not have much sense
INK@ yes, for build words like DARKER 

::darker ink@ 2/ $7f7f7f and ink ;

[toc] | [prev] | [next] | [standalone]


#32021

FromBruceMcF <agila61@netscape.net>
Date2014-06-28 13:49 -0700
Message-ID<2674ebf8-c29d-457b-a331-0776183e31c3@googlegroups.com>
In reply to#32020
On Saturday, June 28, 2014 4:09:15 PM UTC-4, Pablo Hugo Reda wrote:
> I use  
> INK | rgb32 --
> INK@ | -- rgb32
> PAPER | rgb32 --

> PAPER@ not have much sense

I'd think the point of PAPER@ is ``PAPER@ INK'' to erase a figure by redrawing it in the background color.

[toc] | [prev] | [next] | [standalone]


#32013

From"Rod Pemberton" <dont_use_email@xnothavet.cqm>
Date2014-06-28 14:47 -0400
Message-ID<op.xh6g5lis6zenlw@localhost>
In reply to#31949
On Fri, 27 Jun 2014 11:39:59 -0400, Roger Levy <roger.levy@gmail.com>  
wrote:

> : colored ( rgba -- ) \ rgba being a packed 32-bit RGBA color.  sets  
> FGCOLOR

As an aside, perhaps, you'd like "docolor" or "setcolor" instead of
"colored".  I'm not black, nor African American, so I don't find
"colored" to be offensive, but some of different race or color might,
even though the context is non-racist.

E.g., I'm Ms. Rather, or any woman, would be offended if the C-word or
P-word or F-word was found in programming code.

Sensitivity?


Rod Pemberton

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web