Solved

About convert Point from Region

Posted on 1998-11-05
2
216 Views
Last Modified: 2013-12-26
Can  convert QickDraw Region to QickDraw Point?.
Can PtInRgn()-function only use ?.
0
Comment
Question by:nekoman
2 Comments
 
LVL 3

Accepted Solution

by:
boonstra earned 100 total points
ID: 1291579
Clearly, you cannot convert a Region to a single Point, because a Region would include many Points.  Perhaps the question is if you can convert a Region to an array of Points.  There is no function to do that.  However, you could convert a Region to a BitMap using the functions FillRgn or PaintRgn.  You could loop thru the bitmap to create points if you wanted to.

Note that you can easily get the bounding box for a RgnHandle rgnHdl by looking at the Rect at (**rgnHdl).rgnBBox

As for what other functions you might be able to use, the function RectInRgn tests whether any point in a Rect is inside a Region.  EmptyRgn tests to see if a region is empty.  DiffRgn calculates the area where two regions do not overlay.  UnionRgn calculates the union of two regions, and XorRgn calculates the union minus the overlap, and SectRgn calculates the intersection.

If I didnt' answer the question, please add a comment and I'll try again.
0
 

Author Comment

by:nekoman
ID: 1291580
Thank you.
I analyzed Region.
below..
void NewRegionDraw2(void)
{
      Rect            windRect,theRoundRect = { 100,125,200,400};
      Rect            theRoundRect2 = { 150,160,200,400};
      Rect            theRoundRect3 = { 105,105,200,200};
      Rect            theRoundRect4 = { 50,50,200,200};
      Rect            theRoundRect5 = { 110,110,115,115};
      short *ptr,i,cnt,x,x2,y,Oi,ii,iii,j;
      RGBColor color;
      RgnHandle gRgn;
       gRgn =  NewRgn();
      PenSize(1,1);
       OpenRgn();
      MoveTo(100,100);      
      //FrameRect(&theRoundRect);
      //FrameRect(&theRoundRect2);
      //FrameOval(&theRoundRect4);
//      FrameRect(&theRoundRect5);
      /*LineTo(50,300);
      LineTo(250,300);
      LineTo(100,100);*/
      FrameOval(&theRoundRect3);
      //myErr = BitMapToRegion(Rgn,&bMap);
      CloseRgn(gRgn);
      HLock((Handle)gRgn);
      ptr = (short *)(((char*)*gRgn) + 10);
      cnt = (((**gRgn).rgnSize - 10) >> 1);
      y = ptr[0] ;
      color.red = color.green = color.blue = 0;
      RGBForeColor(&color);
      for(i =0; i < cnt-1;) {
             short wk,wk_y;                         
            Oi = i;
            wk_y = ptr[i++] ;
                  if(i >= 150 ) {
                        a= 1;
                  }
            while(1) {
                  MoveTo(ptr[i],wk_y);
                  i++;
                  LineTo(ptr[i]-1,wk_y);            
                  i++;
                  if(ptr[i] == 0x7FFF ) {
                        i++;
                        break;
                  }
            }
            y = wk_y;
      }
      color.red = color.green = color.blue = 0;
      color.red = 0xFFFF;
      RGBForeColor(&color);
      FrameRgn(gRgn);
      DisposeRgn(gRgn);
      
      //PaintRgn(gRgn);
      return;
      
}

Region Data is
 top;
 y-
 x1-x2
 x3-x4....many
 0x7FFF --partition
 y-
 x5-x6
 x7-x8....many
0x7FFF --partition
0x7FFF --partition Last

This is incomplete.
Do you know good idea? .
(Apple is no support.--I know.)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 67
how do i create updater to My Activex application? 3 94
Separate files macro - Errors on larger data set 18 73
FizzBuzz challenge 9 82
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question