Hi,
I am trying to draw a series of "T"s and "L"s on the screen. The catch
is that the Ts and Ls have to be tilted either right or left at 45
degree angles from upright. I am not using the Application Builder to
do this (I’d rather write the C code myself), but am using Photon to do
the drawing.
The following code was a test version I was trying to run. I get no
warnings or errors either at compile-time or at run-time. I put in lots
of print statements to try to see where things were getting messed up,
but every print statement is “ok”. However, nothing appears on the
screen.
If any one sees what I’m doing wrong (or alternatively, if anyone knows
of a way to rotate drawings), I’d appreciate the feedback.
Thanks,
Shannon
code:
int display_slide( void *data, pid_t pid, void message, ushort_t size){
/ This routine is called when the app builder main loop is
interrupted by a QNX message (initiated by a call to Send
in another process). Note that this is set up by the call
to PtAppAddInput in register_name. First, display_slide calls
Reply to unblock the sending process. Next it extracts the
message
sent by the Send routine by assigning it to the struct variable
msg. (Note that the routine [in rex] which calls Send must use
the identical variable type [i.e. struct definition.]) In this
case
the message is an unsigned integer which holds an ecode. The
image
files use ecodes as filenames. */
struct msg_s {
int dot_density;
char set_to ;
} *msg;
PhImage_t *foo ;
int worked ;
PhPoint_t p = {100,100} ;
msg = ( struct msg_s ) message;
/ Reply should always be called to unblock the sending process
*/
printf(“received msg. dot_density = %d, set_to = %c\n”,
msg->dot_density, msg->set_to );
Reply( pid, “OK!”, 4);
printf(“replied to msg!\n”);
foo = PxLoadImage (“t1.bmp”, NULL) ;
if (foo == NULL) {
printf (“Didn’t load picture.\n”) ;
}
else {
printf (“Loaded ok.\n”) ;
worked = PgDrawBitmap ( foo->image, 0, &p,
&foo->size, foo->bpl, 0) ;
}
if (worked == 0 ) {
printf (“I think I’m drawing.\n”) ;
}
else {
printf (“Ha, ha. I’m not drawing your picture.\n”) ;
}
PtFlush ();
foo->flags = Ph_RELEASE_IMAGE ;
PhReleaseImage (foo) ;
return( Pt_CONTINUE);
}