File size: 959 Bytes
806d4b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
//Test image which we will determine the extents of.
<1>/* Graphics Not Rendered in HTML */
U0 Extents()
{
CDC *dc=DCAlias;
I64 min_x,max_x,min_y,max_y;
//Scrn, not win coordinates.
I64 h=Fs->pix_left+Fs->scroll_x,v=Fs->pix_top+Fs->scroll_y;
DocClear;
DCFill;
//This sets a flag to record the
//extents of what we draw and inits
//the max's and min's. Vals are
//scrn coordinates.
DCExtentsInit(dc);
dc->thick=3;
Sprite3(dc,40,GR_HEIGHT>>1,0,<1>);
dc->color=LTRED;
dc->thick=1;
//This box is the extents.
GrLine(dc,dc->min_x-h,dc->min_y-v,dc->max_x-h,dc->min_y-v);
GrLine(dc,dc->min_x-h,dc->min_y-v,dc->min_x-h,dc->max_y-v);
GrLine(dc,dc->max_x-h,dc->max_y-v,dc->max_x-h,dc->min_y-v);
GrLine(dc,dc->max_x-h,dc->max_y-v,dc->min_x-h,dc->max_y-v);
DCDel(dc);
PressAKey;
DCFill;
SpriteExtents(<1>,&min_x,&max_x,&min_y,&max_y);
"X: %d to %d\n",min_x,max_x;
"Y: %d to %d\n",min_y,max_y;
}
Extents;
|