I have a file that contains data as char (-128 to 127) about a design
that I want create in a View with Cocoa.
The file contains X and Y movements as tenths of millimeters (0.1mm).
I used the following code to do it:
#define XFORM_FACTOR 2.58 (pixel dimension of my screen)
#define MM2PX( val ) ( val / XFORM_FACTOR)
float coordX, coordY;
float centerX, centerY;
char buf[10000];
int i=0;
// class to construct the NSbezierpath of type line
LineaC *path;
NSData *data = [NSData dataWithContentsOfFile:pathFile];
[data getBytes:buf];
centerX = 833; //generic point of myView to center the design
centerY = 833;
while (i<10000)
{
coordX = centerX+buf[i];
i++;
coordY = centerY+buf[i];
// costruisco un nuovo elemento linea con le nuove coordinate
elem = [[ LineaC alloc] initStartPt: NSMakePoint( st->x,st->y) toPt:
NSMakePoint(end->x, end->y)] ;
Some movements are wrong as dimension and the effect is a kind of
trasposition (if it is the right name) of all path.
If someone could help me I can then sent an image as example of the
design resulting.
Thanks,
Alessandra
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden