[Q] drawing in colour...
Quote from Forum Archives on December 10, 1997, 8:02 pmPosted by: mel <mel@...>
Okay I have to be doing something wrong. According to Inside Mac when I set
the ForeColor and draw it should show up in that colour. It don't. Least
not on my window. Change the color using any of the colour commands and it
will be displayed in B&W. But if you use the OLD colour command and print
something, it shows up in colour. Weird.Someone want to point out why this is so? Seems illogical to me.
'
LOCAL FN drawPlot
DIM rect;8
DIM oldFore;6:' old foreground colour
DIM newFore;0,dR,dG,dB
CALL GETFORECOLOR(#@oldFore):' record the old foreground colour
CALL PENMODE(_patCopy)
yAdjust=WINDOW(_height):' where the bottom of Y is
OSErr=FN HLOCK(memBlock&):' lock down the memory block
blockPtr&=[memBlock&]
blockPtr&=blockPtr&+38:' now point past the header
counter&=totalPoints:' we need to track how many points
DO
BLOCKMOVE blockPtr&,@xStart,9:' we ALWAYS move 9 at a time
LONG IF yDummy=3:' is this a COLOUR CHANGE record?
SELECT xStart:' see which colour we are going to
CASE 0:' set to black
dR=0:dG=0:dB=0
CASE 1
dR=0:dG=0:dB=32767
CASE 2
dR=0:dG=0:dB=65535
CASE 3
dR=0:dG=2600:dB=30000
CASE 4
dR=0:dG=64911:dB=65535
CASE 5
dR=30000:dG=0:dB=30000
CASE 6
dR=65492:dG=1237:dB=65535
CASE 7
dR=45000:dG=0:dB=0
CASE 8
dR=65535:dG=0:dB=0
CASE 9
dR=0:dG=45000:dB=0
CASE 10
dR=0:dG=65535:dB=0
CASE 11
dR=32767:dG=16500:dB=0
CASE 12
dR=65535:dG=65535:dB=0
CASE 13
dR=32767:dG=32767:dB=32767
CASE 14
dR=49000:dG=49000:dB=49000
CASE 15
dR=65535:dG=65535:dB=65535
END SELECT
CALL RGBFORECOLOR(#@newFore):' set new colour
'INC(totalColourChanges):' add 1 to the total colour changes
XELSE:' else its a point record
LONG IF counter&=totalPoints:' is this the starting point
newY=(yAdjust+smallY)-yPos
newX=xPos-smallX:' move it back towards the left
CALL MOVETO(newX,newY):' start with the cursor here
XELSE
newY=(yAdjust+smallY)-yPos:' move towards the bottom of window
newX=xPos-smallX:' move it back towards the left
CALL LINETO(newX,newY):' and set the stitches in place
END IF
DEC(counter&):' minus one from the point counter
END IF
blockPtr&=blockPtr&+9:' and move to the next record
UNTIL counter&=0:' loop til we have done all the point
OSErr=FN HUNLOCK(memBlock&):' unlock the memory block
CALL RGBFORECOLOR(#@oldFore):' set old colour
CALL PENNORMAL
END FN
'Mel Patrick - theWabbitGuy - mel@intergate.bc.ca
www.intergate.bc.ca/business/mel
Posted by: mel <mel@...>
the ForeColor and draw it should show up in that colour. It don't. Least
not on my window. Change the color using any of the colour commands and it
will be displayed in B&W. But if you use the OLD colour command and print
something, it shows up in colour. Weird.
Someone want to point out why this is so? Seems illogical to me.
'
LOCAL FN drawPlot
DIM rect;8
DIM oldFore;6:' old foreground colour
DIM newFore;0,dR,dG,dB
CALL GETFORECOLOR(#@oldFore):' record the old foreground colour
CALL PENMODE(_patCopy)
yAdjust=WINDOW(_height):' where the bottom of Y is
OSErr=FN HLOCK(memBlock&):' lock down the memory block
blockPtr&=[memBlock&]
blockPtr&=blockPtr&+38:' now point past the header
counter&=totalPoints:' we need to track how many points
DO
BLOCKMOVE blockPtr&,@xStart,9:' we ALWAYS move 9 at a time
LONG IF yDummy=3:' is this a COLOUR CHANGE record?
SELECT xStart:' see which colour we are going to
CASE 0:' set to black
dR=0:dG=0:dB=0
CASE 1
dR=0:dG=0:dB=32767
CASE 2
dR=0:dG=0:dB=65535
CASE 3
dR=0:dG=2600:dB=30000
CASE 4
dR=0:dG=64911:dB=65535
CASE 5
dR=30000:dG=0:dB=30000
CASE 6
dR=65492:dG=1237:dB=65535
CASE 7
dR=45000:dG=0:dB=0
CASE 8
dR=65535:dG=0:dB=0
CASE 9
dR=0:dG=45000:dB=0
CASE 10
dR=0:dG=65535:dB=0
CASE 11
dR=32767:dG=16500:dB=0
CASE 12
dR=65535:dG=65535:dB=0
CASE 13
dR=32767:dG=32767:dB=32767
CASE 14
dR=49000:dG=49000:dB=49000
CASE 15
dR=65535:dG=65535:dB=65535
END SELECT
CALL RGBFORECOLOR(#@newFore):' set new colour
'INC(totalColourChanges):' add 1 to the total colour changes
XELSE:' else its a point record
LONG IF counter&=totalPoints:' is this the starting point
newY=(yAdjust+smallY)-yPos
newX=xPos-smallX:' move it back towards the left
CALL MOVETO(newX,newY):' start with the cursor here
XELSE
newY=(yAdjust+smallY)-yPos:' move towards the bottom of window
newX=xPos-smallX:' move it back towards the left
CALL LINETO(newX,newY):' and set the stitches in place
END IF
DEC(counter&):' minus one from the point counter
END IF
blockPtr&=blockPtr&+9:' and move to the next record
UNTIL counter&=0:' loop til we have done all the point
OSErr=FN HUNLOCK(memBlock&):' unlock the memory block
CALL RGBFORECOLOR(#@oldFore):' set old colour
CALL PENNORMAL
END FN
'
Mel Patrick - theWabbitGuy - mel@intergate.bc.ca
http://www.intergate.bc.ca/business/mel