Refactor.

This commit is contained in:
Brad Nelson
2022-02-21 13:28:44 -08:00
parent 560d5e4936
commit 474ce68cbb
4 changed files with 51 additions and 22 deletions

View File

@ -190,7 +190,8 @@ COMMON_PHASE2 = common/tasks.fs common/utils.fs common/locals.fs \
common/filetools.fs common/including.fs \ common/filetools.fs common/including.fs \
common/streams.fs common/blocks.fs common/streams.fs common/blocks.fs
COMMON_DESKTOP = common/ansi.fs common/desktop.fs common/grf.fs common/heart.fs COMMON_DESKTOP = common/ansi.fs common/desktop.fs \
common/grf.fs common/grf_utils.fs common/heart.fs
POSIX_BOOT = $(COMMON_PHASE1) \ POSIX_BOOT = $(COMMON_PHASE1) \
posix/posix.fs posix/allocation.fs posix/termios.fs \ posix/posix.fs posix/allocation.fs posix/termios.fs \

View File

@ -54,7 +54,6 @@ vocabulary internals
0 value event 0 value event
0 value width 0 value width
0 value height 0 value height
0 value color
internals definitions internals definitions
@ -64,25 +63,6 @@ grf definitions also internals
: pixel ( w h -- a ) width * + 4* backbuffer + ; : pixel ( w h -- a ) width * + 4* backbuffer + ;
internals definitions ( Rest of the core definitions per platform. )
: hline { x y w }
x y pixel w 1- for color over l! 4 + next drop ;
grf definitions also internals
: box { left top w h }
left w + top h + { right bottom }
left 0 max to left
top 0 max to top
right width min to right
bottom height min to bottom
left right >= top bottom >= or if exit then
right left - to w
bottom top - to h
top h 1- for left over w hline 1+ next drop
;
( Rest of definitions per platform. )
only forth definitions only forth definitions

View File

@ -0,0 +1,44 @@
\ Copyright 2022 Bradley D. Nelson
\
\ Licensed under the Apache License, Version 2.0 (the "License");
\ you may not use this file except in compliance with the License.
\ You may obtain a copy of the License at
\
\ http://www.apache.org/licenses/LICENSE-2.0
\
\ Unless required by applicable law or agreed to in writing, software
\ distributed under the License is distributed on an "AS IS" BASIS,
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\ See the License for the specific language governing permissions and
\ limitations under the License.
( Graphics Utilities )
\ Pen:
\ ( n ) to color
\ Drawing:
\ box ( x y w h -- )
grf definitions
0 value color
internals definitions
: hline { x y w }
x y pixel w 1- for color over l! 4 + next drop ;
grf definitions also internals
: box { left top w h }
left w + top h + { right bottom }
left 0 max to left
top 0 max to top
right width min to right
bottom height min to bottom
left right >= top bottom >= or if exit then
right left - to w
bottom top - to h
top h 1- for left over w hline 1+ next drop
;
only forth definitions

View File

@ -12,6 +12,10 @@
\ See the License for the specific language governing permissions and \ See the License for the specific language governing permissions and
\ limitations under the License. \ limitations under the License.
( Graphics Heart )
\ Drawing:
\ heart ( x y h -- )
grf internals definitions grf internals definitions
\ For t = 0 to 2pi \ For t = 0 to 2pi