コード例 #1
0
ファイル: AUMixer3DView.cpp プロジェクト: arnelh/Examples
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	DrawPowerMeter
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static void DrawPowerMeter(float avePower, float peakValue, int yoffset )
{
	if(avePower < -50.0 ) avePower = -50.0;		// only show from -50 -> 0dB
	float scaledPower = 200.0 * (avePower + 50.0) / 50.0;
	
	if(peakValue < -50.0 ) peakValue = -50.0;		// only show from -50 -> 0dB
	float scaledPeak = 200.0 * (peakValue + 50.0) / 50.0;
	
	RGBColor color;
	color.red = 0;
	color.blue = 0;
	color.green = 65535;
	RGBForeColor(&color);
	
	const int xoffset = 20;
	
	
	Rect powerRect = {yoffset, xoffset, yoffset+8, xoffset + int(scaledPower) };
	PaintRect(&powerRect);
	
	powerRect.left = xoffset + int(scaledPower);
	powerRect.right = xoffset + 200;
	color.red = 32768;
	color.blue = 32768;
	RGBForeColor(&color );
	PaintRect(&powerRect);
	
	color.red = 40000;
	color.blue = 40000;
	color.green = 40000;
	RGBForeColor(&color );
	MoveTo(xoffset + int(scaledPeak), yoffset );
	LineTo(xoffset + int(scaledPeak), yoffset+7 );
}
コード例 #2
0
static void drawcolorpopup (Rect menurect) {

	short i, j;
	Rect r;	
	
	pushforecolor (&lightbluecolor);
	
	PaintRect (&menurect);
	
	for (i = 0; i < 8; i++) {
	
		for (j = 0; j < 32; j++) {
		
			getitemrect (i * 32 + j + 1, &r);
			
			OffsetRect (&r, menurect.left, menurect.top);
			
			RGBForeColor (&blackcolor);
			
			InsetRect (&r, 1, 1);
			
			PaintRect (&r);
			
			InsetRect (&r, 1, 1);
			
			RGBForeColor (&(*ctable) [i * 32 + j].rgb);
			
			PaintRect (&r);
			} /*for*/
		} /*for*/
	
	popforecolor ();
	} /*drawcolorpopup*/
コード例 #3
0
ファイル: screen_drawing.c プロジェクト: DrItanium/moo
void _draw_screen_shape_at_x_y(
	shape_descriptor shape,
	short x,
	short y)
{
	PixMapHandle pixmap;
	RGBColor old_fore, old_back;
	Rect destination;

	/* Avoid unwanted coloring.. */
	GetForeColor(&old_fore);
	GetBackColor(&old_back);
	RGBForeColor(&rgb_black);
	RGBBackColor(&rgb_white);
	
	/* Draw the panels... */
	pixmap= get_shape_pixmap(shape, FALSE);
	
	/* Offset to zero base, and add in x, y */
	destination= (*pixmap)->bounds;
	OffsetRect(&destination, x-destination.left, y-destination.top);
	
	/* Slam the puppy...  */
	assert(destination_graphics_port);
	CopyBits((BitMapPtr) *pixmap, &destination_graphics_port->portBits, //&screen_window->portBits,
		&(*pixmap)->bounds, &destination, srcCopy, (RgnHandle) nil);

	/* Restore the colors.. */
	RGBForeColor(&old_fore);
	RGBBackColor(&old_back);
}
コード例 #4
0
static void mac_ctl_refresh_trc()
{
	int		i;
	Rect	r;
	RGBColor	black={0,0,0},
				darkGray={0x2000,0x2000,0x2000};

	if( !win.show ) return;
	SetPortWindowPort(win.ref);
	for( i=0; i<16; i++ ){
		DrawInstrumentName(i, instr_comment[i].comm);
	}
	
#define MAX_NOTE_NUM 120
	r.top=		UPPER_MERGIN;
	r.left=		LEFT_MERGIN;
	r.bottom=	r.top+CHANNEL_HIGHT*16;
	r.right=	r.left+CHANNEL_WIDTH*MAX_NOTE_NUM;
	RGBForeColor(&darkGray);
	PaintRect(&r);
	
		//draw separater line
	RGBForeColor(&black);
	for(i=1; i<16; i++){	//horizontal
		MoveTo(LEFT_MERGIN, UPPER_MERGIN+CHANNEL_HIGHT*i-1);
		Line(CHANNEL_WIDTH*MAX_NOTE_NUM-1, 0);
	}
	for(i=12; i<MAX_NOTE_NUM; i+=12){	//vertical
		MoveTo(LEFT_MERGIN+CHANNEL_WIDTH*i-1, UPPER_MERGIN);
		Line(0, CHANNEL_HIGHT*16-1);
	}
}
コード例 #5
0
ファイル: CONTDLG.cpp プロジェクト: JamesMakela-NOAA/PyGnome
void DrawContourLevelValue(short x, short y, double level)
{
	char numstr[40];
	RGBColor savecolor;
	MyNumToStr(level,numstr);
	GetForeColor(&savecolor);
	RGBForeColor(&colors[RED]);
	MyDrawString(/*CENTERED,*/x,y,numstr,true,POINTDRAWFLAG);
	RGBForeColor(&savecolor);
}
コード例 #6
0
void DrawMapBoundsPoly (CMap* theMap, PolyObjectHdl MapPolyHdl, DrawSpecRecPtr drawSettings, Boolean erasePolygon)
{
	long numPts = (**MapPolyHdl).pointCount;
	POINT **pointsH = (POINT**)_NewHandle(numPts *sizeof(POINT));
	POINT *pointsPtr = (POINT*)_NewPtr(numPts *sizeof(POINT));
	LongPoint** thisPointsHdl=nil;
	Point pt;
	LongPoint wPt;
	long i;
	Boolean offQuickDrawPlane = false;
	RGBColor saveColor; // JLM ?? wouldn't compile without this
	if(!pointsH || !pointsPtr) {SysBeep(5); return;}
	
	thisPointsHdl = (LongPoint**) (**MapPolyHdl).objectDataHdl;
	for(i = 0; i< numPts;i++)
	{
		wPt = INDEXH(thisPointsHdl,i);
		pt = GetQuickDrawPt(wPt.h,wPt.v,&gRect,&offQuickDrawPlane);
		INDEXH(pointsH,i) = MakePOINT(pt.h,pt.v);
		(pointsPtr)[i] = MakePOINT(pt.h,pt.v);
		// code goes here, make sure this point does not equal previous point JLM
	}
	GetForeColor (&saveColor);		/* save original forecolor */

		if (erasePolygon)
		{
			RgnHandle newClip=0;
			HBRUSH whiteBrush;
			newClip = CreatePolygonRgn((const POINT*)pointsPtr,numPts,ALTERNATE);
			whiteBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
			//err = SelectClipRgn(currentHDC,savedClip);
			FillRgn(currentHDC, newClip, whiteBrush);
			//DeleteObject(newClip);
			DisposeRgn(newClip);
			//SelectClipRgn(currentHDC,0);
		}
		else
		{
			POINT p[2];
			p[0] = INDEXH(pointsH,numPts-1);
			p[1] = INDEXH(pointsH,0);
			RGBForeColor(&colors[BLACK]);
			if(numPts >= 2) 
			{
				Polyline(currentHDC,*pointsH,numPts);
				Polyline(currentHDC,p,2);	// close the polygon
			}
		}

	RGBForeColor (&saveColor);
	DisposeHandle((Handle)pointsH);
	if(pointsPtr) {_DisposePtr((Ptr)pointsPtr); pointsPtr = 0;}
}
コード例 #7
0
ファイル: screen_drawing.c プロジェクト: DrItanium/moo
void _fill_screen_rectangle(
	screen_rectangle *rectangle, 
	short color_index)
{
	RGBColor old_color, new_color;

	GetForeColor(&old_color);
	_get_interface_color(color_index, &new_color);
	RGBForeColor(&new_color);
	PaintRect((Rect *) rectangle);
	RGBForeColor(&old_color);
}
コード例 #8
0
ファイル: MapUtils.cpp プロジェクト: JamesMakela-NOAA/PyGnome
void DrawLat(long latVal, Rect r, WorldRect view, short precision, Boolean label)
{
	short /*x1, x2, y, */ w;
	Point x_y1, x_y2;
	WorldPoint wp;
	Boolean offQuickDrawPlane;
	char roundLat, roundLong, longString[20], latString[20];
	
	if (latVal > 90000010 || latVal < -90000000) return;
	//view.loLong = _min(view.loLong, 180000000);
	view.loLong = _min(view.loLong, 360000000);
	//view.loLong = _max(view.loLong, -180000000);
	view.loLong = _max(view.loLong, -360000000);
	//x1 = SameDifferenceX(view.loLong);
	x_y1 = GetQuickDrawPt(view.loLong,latVal,&r,&offQuickDrawPlane);
	//view.hiLong = _min(view.hiLong, 180000000);
	view.hiLong = _min(view.hiLong, 360000000);
	//view.hiLong = _max(view.hiLong, -180000000);
	view.hiLong = _max(view.hiLong, -360000000);
	//x2 = SameDifferenceX(view.hiLong);
	x_y2 = GetQuickDrawPt(view.hiLong,latVal,&r,&offQuickDrawPlane);
	//y = (r.bottom + r.top) - SameDifferenceY(latVal);
	
	//if (y > (r.bottom - 30)) return; // don't let low lat line write over long values
	if (x_y1.v > (r.bottom - 30)) return; // don't let low lat line write over long values
	
	wp.pLong = 0;
	wp.pLat = latVal;
	WorldPointToStrings2(wp, latString, &roundLat, longString, &roundLong);	
	SimplifyLLString(latString, precision, roundLat);
	
	w = label ? stringwidth(latString) : 0;
	
	RGBForeColor(&colors[LIGHTGRAY]);
//	SetPenPat(label ? BLACK : GRAY);
	
	//MyMoveTo(x1, y);
	MyMoveTo(x_y1.h, x_y1.v);
//	MyMoveTo(x1 + w + 10, y);
	//MyLineTo(x2, y);
	MyLineTo(x_y2.h, x_y2.v);
	
	if (label) {
		RGBForeColor(&colors[BLACK]);
//		MyMoveTo(x1 + 5, y + 3);
		//MyMoveTo(x1 + 1, y);
		MyMoveTo(x_y1.h + 1, x_y1.v);
		drawstring(latString);
	}
}
コード例 #9
0
ファイル: screen_drawing.c プロジェクト: DrItanium/moo
void _draw_screen_shape_centered(
	shape_descriptor shape,
	screen_rectangle *rectangle,
	short flags)
{
	PixMapHandle pixmap;
	RGBColor old_fore, old_back;
	Rect destination, source;
	short left_offset, top_offset;
return;
	/* Avoid unwanted coloring.. */
	GetForeColor(&old_fore);
	GetBackColor(&old_back);
	RGBForeColor(&rgb_black);
	RGBBackColor(&rgb_white);
	
	/* Draw the panels... */
	pixmap= get_shape_pixmap(shape, FALSE);
	
	/* Offset to zero base, and add in x, y */
	destination= source= (*pixmap)->bounds;
	
	if(flags & _center_horizontal)
	{
		left_offset= (RECTANGLE_WIDTH(rectangle)-RECTANGLE_WIDTH(&source))/2;
	} else {
		left_offset= 0;
	}
	
	if(flags & _center_vertical)
	{
		top_offset= (RECTANGLE_HEIGHT(rectangle)-RECTANGLE_HEIGHT(&source))/2;
	} else if (flags & _bottom_justified) {
		top_offset= RECTANGLE_HEIGHT(rectangle)-RECTANGLE_HEIGHT(&destination);
	} else {
		top_offset= 0;
	}
	
	OffsetRect(&destination, rectangle->left+left_offset, 
		rectangle->top+top_offset);
	
	/* Slam the puppy...  */
	assert(destination_graphics_port);
	CopyBits((BitMapPtr) *pixmap, &destination_graphics_port->portBits, // &screen_window->portBits,
		&source, &destination, srcCopy, (RgnHandle) nil);

	/* Restore the colors.. */
	RGBForeColor(&old_fore);
	RGBBackColor(&old_back);
}
コード例 #10
0
ファイル: screen_drawing.c プロジェクト: DrItanium/moo
/* If source==NULL, source= the shapes bounding rectangle */
void _draw_screen_shape(
	shape_descriptor shape_id, 
	screen_rectangle *destination, 
	screen_rectangle *source)
{
	PixMapHandle pixmap;
	RGBColor old_fore, old_back;
	Rect actual_source;

	/* Avoid unwanted coloring.. */
	GetForeColor(&old_fore);
	GetBackColor(&old_back);
	RGBForeColor(&rgb_black);
	RGBBackColor(&rgb_white);
	
	/* Draw the panels... */
	pixmap= get_shape_pixmap(shape_id, FALSE);
	if(!source)
	{
		actual_source= (*pixmap)->bounds;
#ifdef DEBUG
{
	short dest_width, source_width;
	short dest_height, source_height;
	
	dest_width= destination->right-destination->left;
	source_width= (*pixmap)->bounds.right-(*pixmap)->bounds.left;
	dest_height= destination->bottom-destination->top;
	source_height= (*pixmap)->bounds.bottom-(*pixmap)->bounds.top;
	if(source_height != dest_height || source_width != dest_width)
	{
		dprintf("Changing size of %d Original: %d %d New: %d %d", shape_id,
			source_width, source_height, dest_width, dest_height);
	}
}
#endif
	} else {
		actual_source= *((Rect *) source);
	}

	assert(destination_graphics_port);
	CopyBits((BitMapPtr) *pixmap, &destination_graphics_port->portBits,
		&actual_source, (Rect *) destination, srcCopy, (RgnHandle) nil);

	/* Restore the colors.. */
	RGBForeColor(&old_fore);
	RGBBackColor(&old_back);
}
コード例 #11
0
void PreviewDrawer(ControlRef Ctrl, void *Data)
{
	// Don't need the data arg here
	CrosshairData &Crosshairs = GetCrosshairData();	// An alias for the global crosshair data
	
	// No need for the window context -- it's assumed
	Rect Bounds = {0,0,0,0};
	
	GetControlBounds(Ctrl, &Bounds);
	
	// Get ready to draw!
	PenNormal();
	
	// Draw the background
	RGBForeColor(&BkgdColor);
	PaintRect(&Bounds);
	
	// Clip to inside of box
	ClipRect(&Bounds);
	
	// Draw the crosshairs
	Crosshairs_Render(Bounds);
	
	// Draw the boundary line
	ForeColor(blackColor);
	FrameRect(&Bounds);
}
コード例 #12
0
void _HYPlatformGraphicPane::_EndDraw	 (void)
{
	UnlockPixels (GetGWorldPixMap(thePane));
	SetGWorld 	 (savedPort,savedDevice);
	RGBForeColor (&saveFG);
	RGBBackColor (&saveBG);
}				
コード例 #13
0
ファイル: main.c プロジェクト: fruitsamples/QuickDraw_FX
void drawBackground()
{
	Rect		rect;
	RGBColor	color;
	Rect		tempRect1;
	
	color.red = color.green = color.blue = 8700;
	
	RGBForeColor( &color );
	PaintRect( GetPortBounds(GetWindowPort(gWindow), &tempRect1));
	
	TextFont( kFontIDTimes );
	TextMode( srcOr );
	TextSize( 24 );
	
	drawName( 85, 22, "\pSource Image" );
	drawName( GetPortBounds(GetWindowPort(gWindow), &tempRect1)->right - 215, 22, "\pNew Image" );
	
	GetPortBounds(GetWindowPort(gWindow), &tempRect1);
	SetRect( &rect, 15, tempRect1.bottom - 180, tempRect1.right - 15, tempRect1.bottom - 30);
	drawDeepBox( &rect );
	
	TextSize( 12 );
	
	drawName( tItem[0].rect.left, tItem[0].rect.top - 8, "\pTransfer Mode" );
	drawName( aItem[0].rect.left, aItem[0].rect.top - 8, "\pArithmetic Mode" );
	drawName( cItem[0].rect.left, cItem[0].rect.top - 8, "\pColorization" );
	drawName( dItem[0].rect.left, dItem[0].rect.top - 8, "\pDither" );
	drawName( mItem[0].rect.left, mItem[0].rect.top - 8, "\pColor Mapping" );
	drawName( bItem[0].rect.left, bItem[0].rect.top - 8, "\pDestination" );
	drawName( pItem[0].rect.left, pItem[0].rect.top - 8, "\pPaint Bucket" );
	drawName( lItem[0].rect.left, lItem[0].rect.top - 8, "\pLasso Tool" );
}
コード例 #14
0
ファイル: pict.cpp プロジェクト: PBrookfield/cboe-msvc
void cPict::draw(){
	RGBColor store_color;
	Rect rect = frame;
	GrafPtr cur_port;
	GetPort(&cur_port);
	SetPortWindowPort(parent->win);
	
	if(!visible){ // Erase it
		InsetRect(&rect, -3, -3);
		tileImage(rect,bg_gworld,bg[parent->bg]);
		return;
	}
	if(picNum < 0) { // Just fill with black
		GetForeColor(&store_color);
		ForeColor(blackColor);
		PaintRect(&rect);
		RGBForeColor(&store_color);
		return;
	}
	GetBackColor(&store_color);
	BackColor(whiteColor);
	
	drawPict()[picType](picNum,rect);
	if(drawFramed) drawFrame(2,0);
	SetPort(cur_port);
}
コード例 #15
0
void GBGraphics::UseColor(const GBColor & c) {
	RGBColor color;
	color.red = 0xFFFF * c.Red();
	color.green = 0xFFFF * c.Green();
	color.blue = 0xFFFF * c.Blue();
	RGBForeColor(&color);
}
コード例 #16
0
void DrawMapBoundsPoly (CMap* theMap, PolyObjectHdl MapPolyHdl, DrawSpecRecPtr drawSettings, Boolean erasePolygon)
{
	long numPts = (**MapPolyHdl).pointCount;
	PolyHandle poly;

	LongPoint** thisPointsHdl=nil;
	Point pt,startPt;
	LongPoint wPt;
	long i;
	Boolean offQuickDrawPlane = false;
	RGBColor saveColor; // JLM ?? wouldn't compile without this

	GetForeColor (&saveColor);		/* save original forecolor */
	
	thisPointsHdl = (LongPoint**) (**MapPolyHdl).objectDataHdl;
	poly = OpenPoly();
	wPt = INDEXH(thisPointsHdl,0);
	startPt = GetQuickDrawPt(wPt.h,wPt.v,&gRect,&offQuickDrawPlane);
	MyMoveTo(startPt.h,startPt.v);
	for(i = 1; i< numPts;i++)
	{
		wPt = INDEXH(thisPointsHdl,i);
		pt = GetQuickDrawPt(wPt.h,wPt.v,&gRect,&offQuickDrawPlane);
		MyLineTo(pt.h,pt.v);
	}
	MyLineTo(startPt.h,startPt.v);
	ClosePoly();
	if (erasePolygon) ErasePoly(poly);
	FramePoly(poly);
	ErasePoly(poly);
	KillPoly(poly);

	RGBForeColor (&saveColor);
}
コード例 #17
0
void drawPixelImageData()
{
	int				row, col;
	Rect			rect;
	unsigned char	value;
	char			*image;
	int				index = 0;
	Str255			string;
	RGBColor		color = { 32000, 32000, 32000 };
	//Byte			mode;
	Rect			tempRect1;
	
	ForeColor( blackColor );
	
	SetRect( &rect, 0, 0, 20, 20 );
	
	/* For this example, let's just use only the upper left corner of the image. */
	
	// Draw the offscreen image to the screen to see what it looks like.
	//CopyBits( (BitMap *)*gPixmap, &gWindow->portBits, &rect,
	//		&gWindow->portRect, srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	CopyBits( (BitMap *)*gPixmap, GetPortBitMapForCopyBits(GetWindowPort(gWindow)), &rect,
			GetPortBounds(GetWindowPort(gWindow), &tempRect1), srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	
	RGBForeColor( &color );
	
	// Again, set the pointer to the beginning of the pixel image.
	image = GetPixBaseAddr( gPixmap );
	
	/***************************************************************/
	/* Finally let's display the pixel values on top of the image. */
	/***************************************************************/
	
	/* Loop through the first 20 rows of the pixel image. */
	for (row = 0; row < rect.bottom; row++)
	{
		// Loop through the first 20 columns of the pixel image. 
		for (index = 0, col = 0; col < rect.right; col++)
		{
			// Get the value at this index into the pixel image. 
			value = (unsigned char)*(image + index);
			
			MoveTo( col * 30, row * 20 );
			LineTo( col * 30, (row + 1) * 20 );
			LineTo( (col + 1) * 30, (row + 1) * 20 );
			
			MoveTo( (col * 30) + 6, (row * 20) + 14 );
			NumToString( (long)value, string );
			DrawString( string );
			
			index++;
		}
		
		// Increment the pointer to the next row of the pixel image. 
		image += ((**gPixmap).rowBytes & 0x7fff);
	}
}
コード例 #18
0
void _HYPlatformGraphicPane::_SetColor  (_HYColor c)
{
	RGBColor      sysColor;
	sysColor.red   = c.R*256;
	sysColor.green = c.G*256;
	sysColor.blue  = c.B*256;
	MakeRGBPat (fillColor,&sysColor);
	RGBForeColor (&sysColor);
}
コード例 #19
0
ファイル: main.c プロジェクト: fruitsamples/QuickDraw_FX
void eraseRect( Rect *rect )
{
	RGBColor	color;
	
	color.red = color.green = color.blue = 8700;
	
	RGBForeColor( &color );
	PaintRect( rect );
}
コード例 #20
0
ファイル: device_dialog.c プロジェクト: DrItanium/moo
static void draw_device_area(
	GDSpecPtr device_spec,
	GDHandle selected_device,
	Rect *frame)
{
	Point offset;
	GDHandle device;

	get_device_area_offset(frame, &offset);
	
	EraseRect(frame);
	FrameRect(frame);
	
	for (device= GetDeviceList(); device; device= GetNextDevice(device))
	{
		if (TestDeviceAttribute(device, screenDevice) && TestDeviceAttribute(device, screenActive))
		{
			GDSpec spec;
			Rect bounds;
			
			BuildExplicitGDSpec(&spec, device, device_spec->flags, device_spec->bit_depth, 0, 0);
			
			get_device_area_frame(device, &bounds, offset);
			
			RGBForeColor(HasDepthGDSpec(&spec) ? &rgb_dark_gray : &rgb_white);
			PaintRect(&bounds);
			RGBForeColor(&rgb_black);
			
			if (device==selected_device) PenSize(2, 2);
			FrameRect(&bounds);
			PenSize(1, 1);
			
			if (device==GetMainDevice())
			{
				bounds.bottom= bounds.top + DEVICE_AREA_MENU_BAR_HEIGHT;
				EraseRect(&bounds);
				FrameRect(&bounds);
			}
		}
	}
	
	return;
}
コード例 #21
0
ファイル: MapUtils.cpp プロジェクト: JamesMakela-NOAA/PyGnome
void DrawLong(long longVal, Rect r, WorldRect view, short precision, Boolean label)
{
	short /*x, y1, y2, */ w;
	Point x_y1,x_y2;
	WorldPoint wp;
	Boolean offQuickDrawPlane;
	char roundLat, roundLong, longString[20], latString[20];
	
	//if (longVal > 180000010 || longVal < -180000000) return;
	//if (longVal > 360000010 || longVal < -180000000) return;
	if (longVal > 360000010 || longVal < -360000000) return;
	//x = SameDifferenceX(longVal);
	view.loLat = _min(view.loLat, 90000000);
	view.loLat = _max(view.loLat, -90000000);
	//y1 = (r.bottom + r.top) - SameDifferenceY(view.loLat);
	x_y1 = GetQuickDrawPt(longVal,view.loLat,&r,&offQuickDrawPlane);
	view.hiLat = _min(view.hiLat, 90000000);
	view.hiLat = _max(view.hiLat, -90000000);
	//y2 = (r.bottom + r.top) - SameDifferenceY(view.hiLat);
	x_y2 = GetQuickDrawPt(longVal,view.hiLat,&r,&offQuickDrawPlane);
	
//	RGBForeColor(&colors[label ? BLACK : LIGHTGRAY]);
	RGBForeColor(&colors[LIGHTGRAY]);
// 	SetPenPat(label ? BLACK : GRAY);
	
//	MyMoveTo(x, y1 - 20);
	//MyMoveTo(x, y1);		// bottom edge of view
	//MyLineTo(x, y2 - 1);	// top edge of view
	MyMoveTo(x_y1.h, x_y1.v);		// bottom edge of view
	MyLineTo(x_y2.h, x_y2.v - 1);	// top edge of view
	
	if (label) {
		RGBForeColor(&colors[BLACK]);
		wp.pLong = longVal;
		wp.pLat = 0;
		WorldPointToStrings2(wp, latString, &roundLat, longString, &roundLong);	
		SimplifyLLString(longString, precision, roundLong);
		w = stringwidth(longString);
		//MyMoveTo(x - (w / 2), y1 - 1);
		MyMoveTo(x_y1.h - (w / 2), x_y1.v - 1);
		drawstring(longString);
	}
}
コード例 #22
0
ファイル: lcd.c プロジェクト: CNMAT/CNMAT-Externs
void restorePalette(Lcd *x, RGBColor *oldColor, PaletteHandle *oldPalette)
{
	if (hasColorQD) {
		if (numPaletteColors>2){
			SetPalette(&x->lcd_box.b_patcher->p_wind->w_gp,*oldPalette,FALSE);
			RGBForeColor(oldColor);
		}
	}
	SetPenState(&x->lcd_penState);
}
コード例 #23
0
static unsigned int UpdateNote(int status, int ch, int note, int vel)
{
	//int	vel;
	Rect r1,r2;
    unsigned int onoff=0 /*, check, prev_check*/;
	const RGBColor	dieColor=	{0x3000,0x3000,0x3000},	//dark gray
					freeColor=	{0x3000,0x3000,0x3000},	//dark gray
			onColor=	{0xffff,0xffff,0}, 	//yellow
					sustainedColor={0x8000,0x8000,0},	//dark yellow
			offColor=	{0x4000,0x4000,0},	//dark yellow
			noColor=	{0x2000,0x2000,0x2000};
	RGBColor	color;
	
	vel=(10 * vel) / 128; /* 0-9 */
	if( vel>9 ) vel=9;
	
	r1.left=r2.left=	LEFT_MERGIN+CHANNEL_WIDTH* note;
	r1.right=r2.right=	r1.left+CHANNEL_WIDTH-1;

	r1.top=		UPPER_MERGIN+CHANNEL_HIGHT* ch;
	r1.bottom= 	r1.top+(9-vel);
	r2.top=		r1.bottom;
	r2.bottom=	r1.top+CHANNEL_HIGHT-1;
	
	SetPortWindowPort(win.ref);
    
    color=vel_color[vel];
    switch(status){
	case VOICE_DIE:	 DARKEN2(color);  onoff = 1;	break;
	case VOICE_FREE: color=freeColor; onoff = 0;	break;
	case VOICE_SUSTAINED:DARKEN2(color); onoff = 1;	break;
	case VOICE_OFF:	DARKEN4(color); onoff = 1;		break;
	case VOICE_ON:			onoff = 1;		break;
	default:	color= noColor; break;
    }
    RGBForeColor(&freeColor);
    PaintRect(&r1);    
    RGBForeColor(&color);
    PaintRect(&r2);
    return onoff;
}
コード例 #24
0
ファイル: MacGraph.c プロジェクト: rolk/ug
static void MacErasePolygon (SHORT_POINT *points, INT n)
{
  int i;
  PolyHandle myPoly;
  RGBColor ForeColor, BackColor;

  if (n<3) return;

  GetForeColor(&ForeColor);
  GetBackColor(&BackColor);
  myPoly = OpenPoly();
  MoveTo (points[0].x, points[0].y);
  for (i=1; i<n; i++) LineTo (points[i].x, points[i].y);
  LineTo (points[0].x, points[0].y);
  ClosePoly();
  ErasePoly(myPoly);
  RGBForeColor(&BackColor);
  FramePoly(myPoly);
  KillPoly(myPoly);
  RGBForeColor(&ForeColor);
}
コード例 #25
0
void mac_trc_update_voices()
{
	char	buf[20];
	static	int	prev=-1;

	if( !mac_TraceWindow.show ) return;
	SetPortWindowPort(win.ref);
	
	snprintf(buf, 20, "Voice %3d/%3d   ", current_voices, voices);
	RGBForeColor(&black);
	MoveTo(450,24); DrawText(buf, 0, strlen(buf));
}
コード例 #26
0
static void update_title()
{
	char	buf[256]="";

	if( !mac_TraceWindow.show ) return;
	SetPortWindowPort(win.ref);
	if( mac_n_files>0 && nPlaying<=mac_n_files && fileList[nPlaying].mfn &&
										fileList[nPlaying].mfn->title )
		snprintf(buf, 256, "Title: %s", fileList[nPlaying].mfn->title);
	RGBForeColor(&black);
	MoveTo(2,24); DrawText(buf, 0, strlen(buf));
}
コード例 #27
0
ファイル: tkMacOSXBitmap.c プロジェクト: cogitokat/brlcad
Pixmap
TkpCreateNativeBitmap(
    Display *display,
    CONST char *source)		/* Info about the icon to build. */
{
    Pixmap pix;
    Rect destRect;
    CGrafPtr savePort;
    Boolean portChanged;
    const NativeIcon *nativeIconPtr;

    pix = Tk_GetPixmap(display, None, 32, 32, 0);
    portChanged = QDSwapPort(TkMacOSXGetDrawablePort(pix), &savePort);

    nativeIconPtr = (const NativeIcon *) source;
    SetRect(&destRect, 0, 0, 32, 32);
    if (nativeIconPtr->type == TYPE1) {
	RGBColor white = {0xFFFF, 0xFFFF, 0xFFFF};

	RGBForeColor(&white);
	PaintRect(&destRect);
	PlotIconID(&destRect, atAbsoluteCenter, ttNone, nativeIconPtr->id);
    } else if (nativeIconPtr->type == TYPE2) {
	Handle icon = GetIcon(nativeIconPtr->id);

	if (icon != NULL) {
	    RGBColor black = {0, 0, 0};

	    RGBForeColor(&black);
	    PlotIcon(&destRect, icon);
	    ReleaseResource(icon);
	}
    }

    if (portChanged) {
	QDSwapPort(savePort, NULL);
    }
    return pix;
}
コード例 #28
0
ファイル: qColor.c プロジェクト: LarBob/executor
P1(PUBLIC pascal trap, void, ForeColor, LONGINT, c)
{
  GrafPtr the_port;

  the_port = thePort;
  if (the_port)
    {
      if (CGrafPort_p (the_port))
	RGBForeColor (ROMlib_qd_color_to_rgb (c));
      else
	PORT_FG_COLOR_X (the_port) = CL (c);
    }
}
コード例 #29
0
ファイル: QDDrawingState.c プロジェクト: NikolaBorisov/racket
void RestoreQDDrawingState( QDDrawingState *inDrawingState, const Boolean inDisposeNow )
{//	PixPatHandle	tempPixPat;

#if !(ALIST_USEAPPEARANCEMGR && TARGET_RT_MAC_CFM )
	#pragma unused( inDisposeNow )	// Eliminate compiler warnings in 68K targets because PixPatHandle stuff is screwed up!
#endif

	Assert( inDrawingState != nil );

	// Restore the pen/foreground state.
/*	if ( !inDisposeNow && inDrawingState->penPixPatH != nil ) {
		// Make a copy of the penPixPatH so we can put it somewhere else later because we're not supposed to dispose of it now.
		tempPixPat = NewPixPat( );
		if ( tempPixPat != nil )
			CopyPixPat( inDrawingState->penPixPatH, tempPixPat );
	} else
		tempPixPat = nil;
	PenPixPat( inDrawingState->penPixPatH );
	inDrawingState->penPixPatH = tempPixPat;
*/	RGBForeColor( &inDrawingState->foreColor );
	SetPenState( &inDrawingState->penState );

	// Restore the background state.
/*	if ( !inDisposeNow && inDrawingState->backPixPatH != nil ) {
		// Make a copy of the backPixPatH so we can put it somewhere else later because we're not supposed to dispose of it now.
		tempPixPat = NewPixPat( );
		if ( tempPixPat != nil )
			CopyPixPat( inDrawingState->backPixPatH, tempPixPat );
	} else
		tempPixPat = nil;
	BackPixPat( inDrawingState->backPixPatH );
	inDrawingState->penPixPatH = tempPixPat;
*/	RGBBackColor( &inDrawingState->backColor );

	// Optionally restore the text state.
	if ( inDrawingState->haveTextState ) {
		TextFont( inDrawingState->textStyle.tsFont );
		TextFace( inDrawingState->textStyle.tsFace );
		TextSize( inDrawingState->textStyle.tsSize );
		TextMode( inDrawingState->textMode );
	}

#if ALIST_USEAPPEARANCEMGR && TARGET_RT_MAC_CFM
	// If we're running under CFM and have Appearance Mgr 1.1 or later, use the ThemeDrawingState routines.
	if ( inDrawingState->haveThemeState ) {
		SetThemeDrawingState( inDrawingState->themeState, inDisposeNow );
		if ( inDisposeNow )
			inDrawingState->themeState = nil;
	}
#endif
}
コード例 #30
0
ファイル: DRAW.CPP プロジェクト: JamesMakela-NOAA/PyGnome
float DrawTimeBarTriangle(short h, Boolean bErasePrevious)
// returns the ratio corresponding to the last triangle X-pos
{
	Rect 			r = TimeLineRect();
	float			ratio = 0;
	static short	sPrevH =-100;

	if (h > r.right)
		h = r.right;
	if (h < r.left + 1)
		h = r.left + 1;
	
	if (bErasePrevious)
	{
		Rect rect;
		RGBForeColor(&colors[LIGHTGRAY]);
		DrawTimeTriangle(sPrevH);
		RGBForeColor(&colors[BLACK]);
	}
	
	{
		//PenState	penStatus;
		//GetPenState (&penStatus);	// save original pen state / mode
		//PenMode (srcXor);			// set mode to xor
//		PenPat((ConstPatternParam)&qd.gray);
		DrawTimeTriangle(h);
		
		//SetPenState (&penStatus);	// restore original pen state / mode
		
		// save last one used
		sPrevH = h;
	}
		
	// calculate and return ratio
	ratio = (float) (h - r.left) / (float) (r.right - r.left);

	return ratio;
}