Example #1
0
int Graphics_init (I) {
    iam (Graphics);
    my x1DC = my x1DCmin = 0;
    my x2DC = my x2DCmax = 32767;
    my y1DC = my y1DCmin = 0;
    my y2DC = my y2DCmax = 32767;
    my x1WC = my x1NDC = my x1wNDC = 0.0;
    my x2WC = my x2NDC = my x2wNDC = 1.0;
    my y1WC = my y1NDC = my y1wNDC = 0.0;
    my y2WC = my y2NDC = my y2wNDC = 1.0;
    widgetToWindowCoordinates (me);
    computeTrafo (me);
    my lineWidth = 1.0;
    my arrowSize = 1.0;
    my font = kGraphics_font_HELVETICA;
    my fontSize = 10;
    my fontStyle = Graphics_NORMAL;
    my record = NULL;
    my irecord = my nrecord = 0;
    my percentSignIsItalic = 1;
    my numberSignIsBold = 1;
    my circumflexIsSuperscript = 1;
    my underscoreIsSubscript = 1;
    my dollarSignIsCode = 0;
    my atSignIsLink = 0;
    return 1;
}
Example #2
0
void Graphics_setWsViewport (Graphics me,
	long x1DC, long x2DC, long y1DC, long y2DC)
{
	if (x1DC < my d_x1DCmin || x2DC > my d_x2DCmax || y1DC < my d_y1DCmin || y2DC > my d_y2DCmax) {
		Melder_warning (U"Graphics_setWsViewport: coordinates too large:\n",
			x1DC, U"..", x2DC, U" x ", y1DC, U"..", y2DC,
			U" goes outside ",
			my d_x1DCmin, U"..", my d_x2DCmax, U" x ", my d_y1DCmin, U"..", my d_y2DCmax,
			U"."
		);
		x1DC = my d_x1DCmin;
		x2DC = my d_x2DCmax;
		y1DC = my d_y1DCmin;
		y2DC = my d_y2DCmax;
	}
	my d_x1DC = x1DC;
	my d_x2DC = x2DC;
	my d_y1DC = y1DC;
	my d_y2DC = y2DC;
	widgetToWindowCoordinates (me);
	#if win
		if (my screen && my printer) {
			GraphicsScreen mescreen = (GraphicsScreen) me;
			/*
			 * Map page coordinates to paper coordinates.
			 */
			mescreen -> d_x1DC -=  GetDeviceCaps (mescreen -> d_gdiGraphicsContext, PHYSICALOFFSETX);
			mescreen -> d_x2DC -=  GetDeviceCaps (mescreen -> d_gdiGraphicsContext, PHYSICALOFFSETX);
			mescreen -> d_y1DC -=  GetDeviceCaps (mescreen -> d_gdiGraphicsContext, PHYSICALOFFSETY);
			mescreen -> d_y2DC -=  GetDeviceCaps (mescreen -> d_gdiGraphicsContext, PHYSICALOFFSETY);
		}
	#endif
	computeTrafo (me);
}
Example #3
0
void Graphics_init (Graphics me, int resolution) {
	my resolution = resolution;
	if (resolution == 96) {
		my resolutionNumber = kGraphics_resolution_96;
	} else if (resolution == 100) {
		my resolutionNumber = kGraphics_resolution_100;
	} else if (resolution == 180) {
		my resolutionNumber = kGraphics_resolution_180;
	} else if (resolution == 200) {
		my resolutionNumber = kGraphics_resolution_200;
	} else if (resolution == 300) {
		my resolutionNumber = kGraphics_resolution_300;
	} else if (resolution == 360) {
		my resolutionNumber = kGraphics_resolution_360;
	} else if (resolution == 600) {
		my resolutionNumber = kGraphics_resolution_600;
	} else if (resolution == 720) {
		my resolutionNumber = kGraphics_resolution_720;
	} else if (resolution == 1200) {
		my resolutionNumber = kGraphics_resolution_1200;
	} else {
		Melder_fatal (U"Unsupported resolution ", resolution, U" dpi.");
	}
	my d_x1DC = my d_x1DCmin = 0;	my d_x2DC = my d_x2DCmax = 32767;
	my d_y1DC = my d_y1DCmin = 0;	my d_y2DC = my d_y2DCmax = 32767;
	my d_x1WC = my d_x1NDC = my d_x1wNDC = 0.0;
	my d_x2WC = my d_x2NDC = my d_x2wNDC = 1.0;
	my d_y1WC = my d_y1NDC = my d_y1wNDC = 0.0;
	my d_y2WC = my d_y2NDC = my d_y2wNDC = 1.0;
	widgetToWindowCoordinates (me);
	computeTrafo (me);
	my lineWidth = 1.0;
	my arrowSize = 1.0;
	my speckleSize = 1.0;
	my font = kGraphics_font_HELVETICA;
	my fontSize = 10;
	my fontStyle = Graphics_NORMAL;
	my record = nullptr;
	my irecord = my nrecord = 0;
	my percentSignIsItalic = 1;
	my numberSignIsBold = 1;
	my circumflexIsSuperscript = 1;
	my underscoreIsSubscript = 1;
	my dollarSignIsCode = 0;
	my atSignIsLink = 0;
}
Example #4
0
void Graphics_setWsViewport (I,
                             long x1DC, long x2DC, long y1DC, long y2DC)
{
    iam (Graphics);
    if (x1DC < my x1DCmin || x2DC > my x2DCmax || y1DC < my y1DCmin || y2DC > my y2DCmax) {
        static MelderString warning = { 0 };
        MelderString_empty (& warning);
        MelderString_append8 (& warning, L"Graphics_setWsViewport: coordinates too large:\n",
                              Melder_integer (x1DC), L"..", Melder_integer (x2DC), L" x ", Melder_integer (y1DC), L"..", Melder_integer (y2DC));
        MelderString_append9 (& warning, L" goes outside ",
                              Melder_integer (my x1DCmin), L"..", Melder_integer (my x2DCmax), L" x ", Melder_integer (my y1DCmin), L"..", Melder_integer (my y2DCmax), L".");
        Melder_warning1 (warning.string);
        x1DC = my x1DCmin;
        x2DC = my x2DCmax;
        y1DC = my y1DCmin;
        y2DC = my y2DCmax;
    }
    my x1DC = x1DC;
    my x2DC = x2DC;
    my y1DC = y1DC;
    my y2DC = y2DC;
    widgetToWindowCoordinates (me);
#if win
    if (my screen && my printer) {
        iam (GraphicsScreen);
        /*
         * Map page coordinates to paper coordinates.
         */
        my x1DC -=  GetDeviceCaps (my dc, PHYSICALOFFSETX);
        my x2DC -=  GetDeviceCaps (my dc, PHYSICALOFFSETX);
        my y1DC -=  GetDeviceCaps (my dc, PHYSICALOFFSETY);
        my y2DC -=  GetDeviceCaps (my dc, PHYSICALOFFSETY);
    }
#endif
    computeTrafo (me);
}