Color plots

A PocketC native palm library offering native forms and assorted utilities

Postby jfield on Sun May 13, 2001 1:40 am

I cannot get color to work on my Palm IIIc. I'm using Pocket Toolbox 6.01. Below is the program:

// plot example
//draws a sharp triangle
#define PI 3.14159265
library "PToolboxLib"
main(){
int x,y,d,sd,pc,c,sf,sb,gp,i;
//mode = radius + width + point/line
int mode0=0x03030000;
int mode1=0x03030001;
float phase_offset;
// controls dir. of the sharp point
d=5; i=2;
graph_off();
sd=SetDepth(5);
puts(" SetDepth1: " + sd + "\n");
pc=PickColor();
puts(" PickColor1: " + pc + "\n");
sf=SetFore(pc);
puts(" SetFore1: " + sf + "\n");
sf=SetFore(pc);
puts(" SetFore2: " + sf + "\n");
pc=PickColor();
puts(" PickColor2: " + pc + "\n");
sb=SetBack(pc);
puts(" SetBack1: " + sf + "\n");
sb=SetBack(pc);
puts(" SetBack2: " + sf + "\n");
graph_on();
sd=SetDepth(5);
puts(" SetDepth2: " + sd + "\n");
waitp();
x=penx(); y=peny();
SetPixel(x,y);
gp=GetPixel(x,y);
puts(" GetPixel1: " + gp + "\n");
gp=GetPixel(x,y);
puts(" GetPixel2: " + gp + "\n");
phase_offset = 0;
// make triangle point upwards
plot(mode0,x,y,70,phase_offset); //sets up previous point
plot(mode1,x,y,30,2*PI/3+phase_offset);
// draw first line
plot(mode1,x,y,30,4*PI/3+phase_offset);
// draw second line
plot(mode1,x,y,70,2*PI+phase_offset); // draw last connecting line
waitp();
//graph_off();
}
jfield
 
Posts: 43
Joined: Sun May 13, 2001 1:36 am
Location: USA

Postby jstadolnik on Sun May 13, 2001 3:27 am

You need to set the colors after the graph_on() call.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby jfield on Sun May 13, 2001 12:36 pm

Thanks for the help.

Please add your comment to the Pocket Toolbox 6.01 documentation for SetFore(), SetBack() and SetTextColor(). Also CopyBuf and OpenBufDb are missing from the list of Screen Buffer Functions on page 2, there is a typo on page 7: "color of the for the specified" and there is a typo on page 8: "PtoolboxLib" vs. "PToolboxLib".

Thanks again for the help. Below is the version that worked:

// plot example
//draws point, arc and sharp triangle
#define PI 3.14159265
library "PToolboxLib"
main(){
int x,y,d,pcf,pcb,sf,sb,gp,stc,i;
//mode = radius + width + point/line
int mode0=0x03030000;
int mode1=0x03030001;
float phase_offset;
// controls dir. of the sharp point
d=8;
graph_on();
pcf=PickColor();
puts("PickColorF: " + pcf + "\n");
pcb=PickColor();
puts("PickColorB: " + pcb + "\n");
sf=SetFore(pcf);
sb=SetBack(pcb);
x=40; y=90;
SetPixel(x,y);
gp=GetPixel(x,y);
puts("GetPixel: " + gp + "\n");
phase_offset = PI/2;
// make triangle point upwards
arc(80,90,60,3*PI/2,5*PI/2);
plot(mode0,x,y,70,phase_offset); //sets up previous point
plot(mode1,x,y,30,2*PI/3+phase_offset);
// draw first line
plot(mode1,x,y,30,4*PI/3+phase_offset);
// draw second line
plot(mode1,x,y,70,2*PI+phase_offset); // draw last connecting line
waitp();
}
jfield
 
Posts: 43
Joined: Sun May 13, 2001 1:36 am
Location: USA


Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 4 guests

cron