mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
Fix printing and colors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@13388 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1b31f62beb
commit
a0a3300b3a
12 changed files with 258 additions and 225 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2002-04-06 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure.in: Renable XIM by default again.
|
||||
|
||||
* Source/gsc/GSStreamContext.m (GSSetFont:): Implement.
|
||||
Fix up show methods and fix spaces in method names.
|
||||
|
||||
* Source/xlib/XGContext.m (-initWithContextInfo:): Return
|
||||
alternate (PS) context when indicated.
|
||||
|
||||
* Source/xlib/xrtools.c: Simplify color conversion routines.
|
||||
* Source/xlib/XGGState.m: Use them
|
||||
|
||||
2002-04-03 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/GNUmakefile.preamble: Fix LIB_DIRS and
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
#include "gsc/GSGState.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "xlib/xrtools.h"
|
||||
|
||||
@class NSBezierPath;
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
#ifndef _XGPrivate_h_INCLUDE
|
||||
#define _XGPrivate_h_INCLUDE
|
||||
|
||||
#ifdef HAVE_WRASTER_H
|
||||
#include "wraster.h"
|
||||
#else
|
||||
#include "x11/wraster.h"
|
||||
#endif
|
||||
|
||||
#include "xlib/XGContext.h"
|
||||
#include "xlib/xrtools.h"
|
||||
#include <AppKit/GSFontInfo.h>
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
#ifndef _xrtools_h_INCLUDE
|
||||
#define _xrtools_h_INCLUDE
|
||||
|
||||
#ifdef HAVE_WRASTER_H
|
||||
#include "wraster.h"
|
||||
#else
|
||||
#include "x11/wraster.h"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
gray_colorspace, rgb_colorspace, hsb_colorspace, cmyk_colorspace
|
||||
} xr_device_colorspace_t;
|
||||
|
@ -41,18 +35,10 @@ typedef struct _xr_device_color {
|
|||
} xr_device_color_t;
|
||||
|
||||
/* Internal conversion of colors to pixels values */
|
||||
extern u_long xrGrayToPixel(RContext * context, float gray);
|
||||
extern u_long xrRGBToPixel(RContext * context, float red,
|
||||
float green, float blue);
|
||||
extern u_long xrHSBToPixel(RContext * context, float h, float s, float b);
|
||||
extern u_long xrCMYKToPixel(RContext * context, float c, float m,
|
||||
float y, float k);
|
||||
extern u_long xrColorToPixel(RContext * context, xr_device_color_t color);
|
||||
|
||||
extern xr_device_color_t xrConvertToGray(xr_device_color_t color);
|
||||
extern xr_device_color_t xrConvertToRGB(xr_device_color_t color);
|
||||
extern xr_device_color_t xrConvertToHSB(xr_device_color_t color);
|
||||
extern xr_device_color_t xrConvertToCMYK(xr_device_color_t color);
|
||||
extern xr_device_color_t xrColorToRGB(xr_device_color_t color);
|
||||
extern xr_device_color_t xrColorToGray(xr_device_color_t color);
|
||||
extern xr_device_color_t xrColorToCMYK(xr_device_color_t color);
|
||||
extern xr_device_color_t xrColorToHSB(xr_device_color_t color);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
|
||||
@implementation GSStreamContext
|
||||
|
||||
- (void) destroyContext;
|
||||
- (void) dealloc
|
||||
{
|
||||
if (gstream)
|
||||
fclose(gstream);
|
||||
[super destroyContext];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- initWithContextInfo: (NSDictionary *)info
|
||||
|
@ -91,73 +91,73 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Color operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentalpha: (float*) a
|
||||
- (void) DPScurrentalpha: (float*)a
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentcmykcolor: (float*) c: (float*) m: (float*) y: (float*) k
|
||||
- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentgray: (float*) gray
|
||||
- (void) DPScurrentgray: (float*)gray
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrenthsbcolor: (float*) h: (float*) s: (float*) b
|
||||
- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentrgbcolor: (float*) r: (float*) g: (float*) b
|
||||
- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPSsetalpha: (float) a
|
||||
- (void) DPSsetalpha: (float)a
|
||||
{
|
||||
fprintf(gstream, "%g setalpha\n", a);
|
||||
}
|
||||
|
||||
- (void) DPSsetcmykcolor: (float) c: (float) m: (float) y: (float) k
|
||||
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g setcmykcolor\n", c, m, y, k);
|
||||
}
|
||||
|
||||
- (void) DPSsetgray: (float) gray
|
||||
- (void) DPSsetgray: (float)gray
|
||||
{
|
||||
fprintf(gstream, "%g setgray\n", gray);
|
||||
}
|
||||
|
||||
- (void) DPSsethsbcolor: (float) h: (float) s: (float) b
|
||||
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b
|
||||
{
|
||||
fprintf(gstream, "%g %g %g sethsbcolor\n", h, s, b);
|
||||
}
|
||||
|
||||
- (void) DPSsetrgbcolor: (float) r: (float) g: (float) b
|
||||
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b
|
||||
{
|
||||
fprintf(gstream, "%g %g %g setrgbcolor\n", r, g, b);
|
||||
}
|
||||
|
||||
|
||||
- (void) GSSetFillColorspace: (NSDictionary *) dict
|
||||
- (void) GSSetFillColorspace: (NSDictionary *)dict
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetStrokeColorspace: (NSDictionary *) dict
|
||||
- (void) GSSetStrokeColorspace: (NSDictionary *)dict
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetFillColor: (float *) values
|
||||
- (void) GSSetFillColor: (float *)values
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetStrokeColor: (float *) values
|
||||
- (void) GSSetStrokeColor: (float *)values
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -166,55 +166,72 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Text operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSashow: (float) x: (float) y: (const char*) s
|
||||
- (void) DPSashow: (float)x : (float)y : (const char*)s
|
||||
{
|
||||
fprintf(gstream, "%g %g %s ashow\n", x, y, s);
|
||||
fprintf(gstream, "%g %g (%s) ashow\n", x, y, s);
|
||||
}
|
||||
|
||||
- (void) DPSawidthshow: (float) cx: (float) cy: (int) c: (float) ax: (float) ay: (const char*) s
|
||||
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s
|
||||
{
|
||||
fprintf(gstream, "%g %g %d %g %g %s awidthshow\n", cx, cy, c, ax, ay, s);
|
||||
fprintf(gstream, "%g %g %d %g %g (%s) awidthshow\n", cx, cy, c, ax, ay, s);
|
||||
}
|
||||
|
||||
- (void) DPScharpath: (const char*) s: (int) b
|
||||
- (void) DPScharpath: (const char*)s : (int)b
|
||||
{
|
||||
fprintf(gstream, "%s %d charpath\n", s, b);
|
||||
fprintf(gstream, "(%s) %d charpath\n", s, b);
|
||||
}
|
||||
|
||||
- (void) DPSshow: (const char*) s
|
||||
- (void) DPSshow: (const char*)s
|
||||
{
|
||||
fprintf(gstream, "%s show\n", s);
|
||||
fprintf(gstream, "(%s) show\n", s);
|
||||
}
|
||||
|
||||
- (void) DPSwidthshow: (float) x: (float) y: (int) c: (const char*) s
|
||||
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
|
||||
{
|
||||
fprintf(gstream, "%g %g %d %s widthshow\n", x, y, c, s);
|
||||
fprintf(gstream, "%g %g %d (%s) widthshow\n", x, y, c, s);
|
||||
}
|
||||
|
||||
- (void) DPSxshow: (const char*) s: (const float*) numarray: (int) size
|
||||
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSxyshow: (const char*) s: (const float*) numarray: (int) size
|
||||
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSyshow: (const char*) s: (const float*) numarray: (int) size
|
||||
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
- (void) GSSetCharacterSpacing: (float) extra
|
||||
- (void) GSSetCharacterSpacing: (float)extra
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetFont: (NSFont*) font
|
||||
- (void) GSSetFont: (NSFont*)font
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
const float *matrix = [font matrix];
|
||||
const float *m;
|
||||
fprintf(gstream, "/%s findfont ", [[font fontName] cString]);
|
||||
|
||||
if ([self GSWViewIsFlipped])
|
||||
{
|
||||
float invmatrix[6];
|
||||
|
||||
memcpy(invmatrix, matrix, sizeof(invmatrix));
|
||||
invmatrix[3] = -invmatrix[3];
|
||||
m = invmatrix;
|
||||
}
|
||||
else
|
||||
m = matrix;
|
||||
|
||||
fprintf(gstream, "[%g %g %g %g %g %g] ",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
fprintf(gstream, " makefont setfont\n");
|
||||
}
|
||||
|
||||
- (void) GSSetFontSize: (float) size
|
||||
- (void) GSSetFontSize: (float)size
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -231,27 +248,27 @@
|
|||
return NSMakePoint(0,0);
|
||||
}
|
||||
|
||||
- (void) GSSetTextCTM: (NSAffineTransform *) ctm
|
||||
- (void) GSSetTextCTM: (NSAffineTransform *)ctm
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetTextDrawingMode: (GSTextDrawingMode) mode
|
||||
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetTextPosition: (NSPoint) loc
|
||||
- (void) GSSetTextPosition: (NSPoint)loc
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSShowText: (const char *) string: (size_t) length
|
||||
- (void) GSShowText: (const char *)string : (size_t)length
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSShowGlyphs: (const NSGlyph *) glyphs: (size_t) length
|
||||
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t)length
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -260,7 +277,7 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentgstate: (int) gst
|
||||
- (void) DPScurrentgstate: (int)gst
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
@ -284,7 +301,7 @@
|
|||
fprintf(gstream, "initgraphics\n");
|
||||
}
|
||||
|
||||
- (void) DPSsetgstate: (int) gst
|
||||
- (void) DPSsetgstate: (int)gst
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -295,22 +312,22 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (void) GSUndefineGState: (int) gst
|
||||
- (void) GSUndefineGState: (int)gst
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSReplaceGState: (int) gst
|
||||
- (void) GSReplaceGState: (int)gst
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSCreateGState: (int) gst
|
||||
- (void) GSCreateGState: (int)gst
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetGState: (int) gst
|
||||
- (void) GSSetGState: (int)gst
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -319,42 +336,42 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentflat: (float*) flatness
|
||||
- (void) DPScurrentflat: (float*)flatness
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinecap: (int*) linecap
|
||||
- (void) DPScurrentlinecap: (int*)linecap
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinejoin: (int*) linejoin
|
||||
- (void) DPScurrentlinejoin: (int*)linejoin
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinewidth: (float*) width
|
||||
- (void) DPScurrentlinewidth: (float*)width
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentmiterlimit: (float*) limit
|
||||
- (void) DPScurrentmiterlimit: (float*)limit
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentpoint: (float*) x: (float*) y
|
||||
- (void) DPScurrentpoint: (float*)x : (float*)y
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentstrokeadjust: (int*) b
|
||||
- (void) DPScurrentstrokeadjust: (int*)b
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPSsetdash: (const float*) pat: (int) size: (float) offset
|
||||
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset
|
||||
{
|
||||
int i;
|
||||
fprintf(gstream, "[");
|
||||
|
@ -363,37 +380,37 @@
|
|||
fprintf(gstream, "] %g setdash\n", offset);
|
||||
}
|
||||
|
||||
- (void) DPSsetflat: (float) flatness
|
||||
- (void) DPSsetflat: (float)flatness
|
||||
{
|
||||
fprintf(gstream, "%g setflat\n", flatness);
|
||||
}
|
||||
|
||||
- (void) DPSsethalftonephase: (float) x: (float) y
|
||||
- (void) DPSsethalftonephase: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g sethalftonephase\n", x, y);
|
||||
}
|
||||
|
||||
- (void) DPSsetlinecap: (int) linecap
|
||||
- (void) DPSsetlinecap: (int)linecap
|
||||
{
|
||||
fprintf(gstream, "%d setlinecap\n", linecap);
|
||||
}
|
||||
|
||||
- (void) DPSsetlinejoin: (int) linejoin
|
||||
- (void) DPSsetlinejoin: (int)linejoin
|
||||
{
|
||||
fprintf(gstream, "%d setlinejoin\n", linejoin);
|
||||
}
|
||||
|
||||
- (void) DPSsetlinewidth: (float) width
|
||||
- (void) DPSsetlinewidth: (float)width
|
||||
{
|
||||
fprintf(gstream, "%g setlinewidth\n", width);
|
||||
}
|
||||
|
||||
- (void) DPSsetmiterlimit: (float) limit
|
||||
- (void) DPSsetmiterlimit: (float)limit
|
||||
{
|
||||
fprintf(gstream, "%g setmiterlimit\n", limit);
|
||||
}
|
||||
|
||||
- (void) DPSsetstrokeadjust: (int) b
|
||||
- (void) DPSsetstrokeadjust: (int)b
|
||||
{
|
||||
fprintf(gstream, "%d setstrokeadjust\n", b);
|
||||
}
|
||||
|
@ -402,7 +419,7 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Matrix operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSconcat: (const float*) m
|
||||
- (void) DPSconcat: (const float*)m
|
||||
{
|
||||
fprintf(gstream, "[%g %g %g %g %g %g] concat\n",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
|
@ -413,17 +430,17 @@
|
|||
fprintf(gstream, "initmatrix\n");
|
||||
}
|
||||
|
||||
- (void) DPSrotate: (float) angle
|
||||
- (void) DPSrotate: (float)angle
|
||||
{
|
||||
fprintf(gstream, "%g rotate\n", angle);
|
||||
}
|
||||
|
||||
- (void) DPSscale: (float) x: (float) y
|
||||
- (void) DPSscale: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g scale\n", x, y);
|
||||
}
|
||||
|
||||
- (void) DPStranslate: (float) x: (float) y
|
||||
- (void) DPStranslate: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g translate\n", x, y);
|
||||
}
|
||||
|
@ -435,12 +452,12 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (void) GSSetCTM: (NSAffineTransform *) ctm
|
||||
- (void) GSSetCTM: (NSAffineTransform *)ctm
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSConcatCTM: (NSAffineTransform *) ctm
|
||||
- (void) GSConcatCTM: (NSAffineTransform *)ctm
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -449,17 +466,17 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Paint operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSarc: (float) x: (float) y: (float) r: (float) angle1: (float) angle2
|
||||
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %g arc\n", x, y, r, angle1, angle2);
|
||||
}
|
||||
|
||||
- (void) DPSarcn: (float) x: (float) y: (float) r: (float) angle1: (float) angle2
|
||||
- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %g arcn\n", x, y, r, angle1, angle2);
|
||||
}
|
||||
|
||||
- (void) DPSarct: (float) x1: (float) y1: (float) x2: (float) y2: (float) r
|
||||
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %g arct\n", x1, y1, x2, y2, r);
|
||||
}
|
||||
|
@ -474,7 +491,8 @@
|
|||
fprintf(gstream, "closepath\n");
|
||||
}
|
||||
|
||||
- (void) DPScurveto: (float) x1: (float) y1: (float) x2: (float) y2: (float) x3: (float) y3
|
||||
- (void)DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
|
||||
: (float)x3 : (float)y3
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %g %g curveto\n", x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
@ -504,12 +522,12 @@
|
|||
fprintf(gstream, "initclip\n");
|
||||
}
|
||||
|
||||
- (void) DPSlineto: (float) x: (float) y
|
||||
- (void) DPSlineto: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g lineto\n", x, y);
|
||||
}
|
||||
|
||||
- (void) DPSmoveto: (float) x: (float) y
|
||||
- (void) DPSmoveto: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g moveto\n", x, y);
|
||||
}
|
||||
|
@ -519,26 +537,27 @@
|
|||
fprintf(gstream, "newpath\n");
|
||||
}
|
||||
|
||||
- (void) DPSpathbbox: (float*) llx: (float*) lly: (float*) urx: (float*) ury
|
||||
- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSrcurveto: (float) x1: (float) y1: (float) x2: (float) y2: (float) x3: (float) y3
|
||||
- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
|
||||
: (float)x3 : (float)y3
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %g %g rcurveto\n", x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
- (void) DPSrectclip: (float) x: (float) y: (float) w: (float) h
|
||||
- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g rectclip\n", x, y, w, h);
|
||||
}
|
||||
|
||||
- (void) DPSrectfill: (float) x: (float) y: (float) w: (float) h
|
||||
- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g rectfill\n", x, y, w, h);
|
||||
}
|
||||
|
||||
- (void) DPSrectstroke: (float) x: (float) y: (float) w: (float) h
|
||||
- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g rectstroke\n", x, y, w, h);
|
||||
}
|
||||
|
@ -548,12 +567,12 @@
|
|||
fprintf(gstream, "reversepath\n");
|
||||
}
|
||||
|
||||
- (void) DPSrlineto: (float) x: (float) y
|
||||
- (void) DPSrlineto: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g rlineto\n", x, y);
|
||||
}
|
||||
|
||||
- (void) DPSrmoveto: (float) x: (float) y
|
||||
- (void) DPSrmoveto: (float)x : (float)y
|
||||
{
|
||||
fprintf(gstream, "%g %g rmoveto\n", x, y);
|
||||
}
|
||||
|
@ -564,17 +583,17 @@
|
|||
}
|
||||
|
||||
|
||||
- (void) GSSendBezierPath: (NSBezierPath *) path
|
||||
- (void) GSSendBezierPath: (NSBezierPath *)path
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSRectClipList: (const NSRect *) rects: (int) count
|
||||
- (void) GSRectClipList: (const NSRect *)rects: (int)count
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSRectFillList: (const NSRect *) rects: (int) count
|
||||
- (void) GSRectFillList: (const NSRect *)rects: (int)count
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -583,45 +602,51 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Window system ops */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentgcdrawable: (void**) gc: (void**) draw: (int*) x: (int*) y
|
||||
- (void) DPScurrentgcdrawable: (void**)gc : (void**)draw : (int*)x : (int*)y
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPScurrentoffset: (int*) x: (int*) y
|
||||
- (void) DPScurrentoffset: (int*)x : (int*)y
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
||||
}
|
||||
|
||||
- (void) DPSsetgcdrawable: (void*) gc: (void*) draw: (int) x: (int) y
|
||||
- (void) DPSsetgcdrawable: (void*)gc : (void*)draw : (int)x : (int)y
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: setting drawable from stream context");
|
||||
}
|
||||
|
||||
- (void) DPSsetoffset: (short int) x: (short int) y
|
||||
- (void) DPSsetoffset: (short int)x : (short int)y
|
||||
{
|
||||
NSLog(@"DPSinvalidcontext: setting drawable from stream context");
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* Graphics Extensions Ops */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
- (void) DPScomposite: (float) x: (float) y: (float) w: (float) h: (int) gstateNum: (float) dx: (float) dy: (int) op
|
||||
- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h
|
||||
: (int)gstateNum : (float)dx : (float)dy : (int)op
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %d %g %g %d composite\n", x, y, w, h, gstateNum, dx, dy, op);
|
||||
fprintf(gstream, "%g %g %g %g %d %g %g %d composite\n", x, y, w, h,
|
||||
gstateNum, dx, dy, op);
|
||||
}
|
||||
|
||||
- (void) DPScompositerect: (float) x: (float) y: (float) w: (float) h: (int) op
|
||||
- (void) DPScompositerect: (float)x : (float)y : (float)w : (float)h : (int)op
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %d compositerect\n", x, y, w, h, op);
|
||||
}
|
||||
|
||||
- (void) DPSdissolve: (float) x: (float) y: (float) w: (float) h: (int) gstateNum: (float) dx: (float) dy: (float) delta
|
||||
- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h
|
||||
: (int)gstateNum : (float)dx : (float)dy : (float)delta
|
||||
{
|
||||
fprintf(gstream, "%g %g %g %g %d %g %g %g dissolve\n", x, y, w, h, gstateNum, dx, dy, delta);
|
||||
fprintf(gstream, "%g %g %g %g %d %g %g %g dissolve\n", x, y, w, h,
|
||||
gstateNum, dx, dy, delta);
|
||||
}
|
||||
|
||||
|
||||
- (void) GSDrawImage: (NSRect) rect: (void *) imageref
|
||||
- (void) GSDrawImage: (NSRect)rect : (void *)imageref
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
@ -630,7 +655,7 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Client functions */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSPrintf: (char *)fmt : (va_list)args
|
||||
- (void) DPSPrintf: (char *)fmt : (va_list)args
|
||||
{
|
||||
vfprintf(gstream, fmt, args);
|
||||
}
|
||||
|
@ -660,11 +685,11 @@ writeHex(FILE *gstream, const unsigned char *data, int count)
|
|||
|
||||
@implementation GSStreamContext (Graphics)
|
||||
|
||||
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
|
||||
: (int) bitsPerSample : (int) samplesPerPixel
|
||||
: (int) bitsPerPixel : (int) bytesPerRow : (BOOL) isPlanar
|
||||
: (BOOL) hasAlpha : (NSString *) colorSpaceName
|
||||
: (const unsigned char *const [5]) data
|
||||
- (void) NSDrawBitmap: (NSRect)rect : (int)pixelsWide : (int)pixelsHigh
|
||||
: (int)bitsPerSample : (int)samplesPerPixel
|
||||
: (int)bitsPerPixel : (int)bytesPerRow : (BOOL)isPlanar
|
||||
: (BOOL)hasAlpha : (NSString *)colorSpaceName
|
||||
: (const unsigned char *const [5])data
|
||||
{
|
||||
int bytes;
|
||||
NSSize scale;
|
||||
|
|
|
@ -2070,17 +2070,18 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
||||
|
||||
if (ret != GrabSuccess)
|
||||
NSDebugLLog(@"XGTrace", @"Failed to grab pointer\n");
|
||||
NSDebugLLog(@"XGTrace", @"Failed to grab pointer %d\n", win);
|
||||
else
|
||||
{
|
||||
grab_window = window;
|
||||
NSDebugLLog(@"XGTrace", @"Grabbed pointer\n");
|
||||
NSDebugLLog(@"XGTrace", @"Grabbed pointer %d\n", win);
|
||||
}
|
||||
return (ret == GrabSuccess) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) releasemouse
|
||||
{
|
||||
NSDebugLLog(@"XGTrace", @"Released pointer\n");
|
||||
XUngrabPointer(XDPY, CurrentTime);
|
||||
grab_window = NULL;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include "xlib/XGContext.h"
|
||||
#include "xlib/xrtools.h"
|
||||
#include "xlib/XGPrivate.h"
|
||||
#include "x11/XGServerWindow.h"
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
|
|
@ -91,7 +91,17 @@
|
|||
|
||||
- (id) initWithContextInfo: (NSDictionary *)info
|
||||
{
|
||||
[super initWithContextInfo: info];
|
||||
NSString *contextType;
|
||||
contextType = [info objectForKey:
|
||||
NSGraphicsContextRepresentationFormatAttributeName];
|
||||
|
||||
self = [super initWithContextInfo: info];
|
||||
if (contextType)
|
||||
{
|
||||
/* Most likely this is a PS or PDF context, so just return what
|
||||
super gave us */
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Create a default gstate */
|
||||
gstate = [[XGGState allocWithZone: [self zone]] initWithDrawContext: self];
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <AppKit/NSBezierPath.h>
|
||||
#include <AppKit/NSFont.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
|
||||
#include "xlib/XGGeometry.h"
|
||||
#include "xlib/XGContext.h"
|
||||
#include "xlib/XGGState.h"
|
||||
|
@ -50,6 +51,19 @@ static BOOL shouldDrawAlpha = YES;
|
|||
|
||||
#define AINDEX 5
|
||||
|
||||
u_long
|
||||
xrRGBToPixel(RContext* context, xr_device_color_t color)
|
||||
{
|
||||
XColor cc;
|
||||
RColor rcolor;
|
||||
rcolor.red = 255. * color.field[0];
|
||||
rcolor.green = 255. * color.field[1];
|
||||
rcolor.blue = 255. * color.field[2];
|
||||
rcolor.alpha = 0;
|
||||
RGetClosestXColor(context, &rcolor, &cc);
|
||||
return cc.pixel;
|
||||
}
|
||||
|
||||
@interface XGGState (Private)
|
||||
- (void) _alphaBuffer: (gswindow_device_t *)dest_win;
|
||||
- (void) _paintPath: (ctxt_object_t) drawType;
|
||||
|
@ -224,9 +238,10 @@ static Region emptyRegion;
|
|||
{
|
||||
float alpha = color.field[AINDEX];
|
||||
color = acolor;
|
||||
color.field[AINDEX] = alpha;
|
||||
gcv.foreground = xrColorToPixel((RContext *)context, color);
|
||||
acolor = xrColorToRGB(acolor);
|
||||
gcv.foreground = xrRGBToPixel((RContext *)context, acolor);
|
||||
[self setGCValues: gcv withMask: GCForeground];
|
||||
color.field[AINDEX] = alpha;
|
||||
}
|
||||
|
||||
- (void) setFont: (NSFont*)newFont
|
||||
|
@ -1174,8 +1189,7 @@ static Region emptyRegion;
|
|||
- (void)DPScurrentcmykcolor: (float *)c : (float *)m : (float *)y : (float *)k
|
||||
{
|
||||
xr_device_color_t new = color;
|
||||
if (new.space != cmyk_colorspace)
|
||||
new = xrConvertToCMYK(new);
|
||||
new = xrColorToCMYK(new);
|
||||
*c = new.field[0];
|
||||
*m = new.field[1];
|
||||
*y = new.field[2];
|
||||
|
@ -1195,21 +1209,21 @@ static Region emptyRegion;
|
|||
- (void)DPScurrentgray: (float *)gray
|
||||
{
|
||||
xr_device_color_t gcolor;
|
||||
gcolor = xrConvertToGray(color);
|
||||
gcolor = xrColorToGray(color);
|
||||
*gray = gcolor.field[0];
|
||||
}
|
||||
|
||||
- (void)DPScurrenthsbcolor: (float *)h : (float *)s : (float *)b
|
||||
{
|
||||
xr_device_color_t gcolor;
|
||||
gcolor = xrConvertToHSB(color);
|
||||
gcolor = xrColorToHSB(color);
|
||||
*h = gcolor.field[0]; *s = gcolor.field[1]; *b = gcolor.field[2];
|
||||
}
|
||||
|
||||
- (void)DPScurrentrgbcolor: (float *)r : (float *)g : (float *)b
|
||||
{
|
||||
xr_device_color_t gcolor;
|
||||
gcolor = xrConvertToRGB(color);
|
||||
gcolor = xrColorToRGB(color);
|
||||
*r = gcolor.field[0]; *g = gcolor.field[1]; *b = gcolor.field[2];
|
||||
}
|
||||
|
||||
|
|
|
@ -26,46 +26,41 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include "xlib/xrtools.h"
|
||||
|
||||
/* Internal conversion of colors to pixels values */
|
||||
u_long
|
||||
xrGrayToPixel(RContext* context, float gray)
|
||||
xr_device_color_t
|
||||
xrMakeColor(xr_device_colorspace_t space, float a, float b, float c, float d)
|
||||
{
|
||||
XColor cc;
|
||||
RColor rcolor;
|
||||
rcolor.red = 255. * gray;
|
||||
rcolor.green = 255. * gray;
|
||||
rcolor.blue = 255. * gray;
|
||||
rcolor.alpha = 0;
|
||||
RGetClosestXColor(context, &rcolor, &cc);
|
||||
return cc.pixel;
|
||||
xr_device_color_t color;
|
||||
color.space = space;
|
||||
color.field[0] = a;
|
||||
color.field[1] = b;
|
||||
color.field[2] = c;
|
||||
color.field[3] = d;
|
||||
return color;
|
||||
}
|
||||
|
||||
u_long
|
||||
xrRGBToPixel(RContext* context, float red, float green, float blue)
|
||||
xr_device_color_t
|
||||
xrGrayToRGB(xr_device_color_t color)
|
||||
{
|
||||
XColor cc;
|
||||
RColor rcolor;
|
||||
rcolor.red = 255. * red;
|
||||
rcolor.green = 255. * green;
|
||||
rcolor.blue = 255. * blue;
|
||||
rcolor.alpha = 0;
|
||||
RGetClosestXColor(context, &rcolor, &cc);
|
||||
return cc.pixel;
|
||||
return xrMakeColor(rgb_colorspace, color.field[0], color.field[0],
|
||||
color.field[0], 0);
|
||||
}
|
||||
|
||||
u_long
|
||||
xrHSBToPixel(RContext* context, float h, float s, float v)
|
||||
xr_device_color_t
|
||||
xrHSBToRGB(xr_device_color_t color)
|
||||
{
|
||||
int i;
|
||||
float h, s, v;
|
||||
float f, p, q, t;
|
||||
float red, green, blue;
|
||||
|
||||
h = color.field[0];
|
||||
s = color.field[1];
|
||||
v = color.field[2];
|
||||
|
||||
if (s == 0)
|
||||
return xrRGBToPixel(context, v, v, v);
|
||||
return xrMakeColor(rgb_colorspace, v, v, v, 0);
|
||||
|
||||
h = h * 6;
|
||||
i = (int)h;
|
||||
|
@ -107,15 +102,22 @@ xrHSBToPixel(RContext* context, float h, float s, float v)
|
|||
blue = q;
|
||||
break;
|
||||
}
|
||||
return xrRGBToPixel(context, red, green, blue);
|
||||
return xrMakeColor(rgb_colorspace, red, green, blue, 0);
|
||||
}
|
||||
|
||||
/* Not implemented. FIXME */
|
||||
u_long
|
||||
xrCMYKToPixel(RContext* context, float c, float m, float y, float k)
|
||||
/* FIXME */
|
||||
xr_device_color_t
|
||||
xrCMYKToRGB(xr_device_color_t color)
|
||||
{
|
||||
float c, m, y, k;
|
||||
float red, green, blue;
|
||||
double white = 1 - k;
|
||||
double white;
|
||||
|
||||
c = color.field[0];
|
||||
m = color.field[1];
|
||||
y = color.field[2];
|
||||
k = color.field[3];
|
||||
white = 1 - k;
|
||||
|
||||
if (k == 0)
|
||||
{
|
||||
|
@ -135,38 +137,36 @@ xrCMYKToPixel(RContext* context, float c, float m, float y, float k)
|
|||
green = (m > white ? 0 : white - m);
|
||||
blue = (y > white ? 0 : white - y);
|
||||
}
|
||||
return xrRGBToPixel(context, red, green, blue);
|
||||
return xrMakeColor(rgb_colorspace, red, green, blue, 0);
|
||||
}
|
||||
|
||||
u_long
|
||||
xrColorToPixel(RContext* context, xr_device_color_t color)
|
||||
xr_device_color_t
|
||||
xrColorToRGB(xr_device_color_t color)
|
||||
{
|
||||
u_long pix;
|
||||
xr_device_color_t new;
|
||||
|
||||
switch(color.space)
|
||||
{
|
||||
case gray_colorspace:
|
||||
pix = xrGrayToPixel(context, color.field[0]);
|
||||
new = xrGrayToRGB(color);
|
||||
break;
|
||||
case rgb_colorspace:
|
||||
pix = xrRGBToPixel(context, color.field[0],
|
||||
color.field[1], color.field[2]);
|
||||
new = color;
|
||||
break;
|
||||
case hsb_colorspace:
|
||||
pix = xrHSBToPixel(context, color.field[0],
|
||||
color.field[1], color.field[2]);
|
||||
case hsb_colorspace:
|
||||
new = xrHSBToRGB(color);
|
||||
break;
|
||||
case cmyk_colorspace:
|
||||
pix = xrCMYKToPixel(context, color.field[0], color.field[1],
|
||||
color.field[2], color.field[3]);
|
||||
new = xrCMYKToRGB(color);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return pix;
|
||||
return new;
|
||||
}
|
||||
|
||||
xr_device_color_t
|
||||
xrConvertToGray(xr_device_color_t color)
|
||||
xrColorToGray(xr_device_color_t color)
|
||||
{
|
||||
xr_device_color_t new;
|
||||
|
||||
|
@ -178,7 +178,7 @@ xrConvertToGray(xr_device_color_t color)
|
|||
break;
|
||||
case hsb_colorspace:
|
||||
case cmyk_colorspace:
|
||||
color = xrConvertToRGB(color);
|
||||
color = xrColorToRGB(color);
|
||||
/* NO BREAK */
|
||||
case rgb_colorspace:
|
||||
new.field[0] =
|
||||
|
@ -190,60 +190,13 @@ xrConvertToGray(xr_device_color_t color)
|
|||
return new;
|
||||
}
|
||||
|
||||
/* FIXME: Not implemented */
|
||||
xr_device_color_t
|
||||
xrConvertToRGB(xr_device_color_t color)
|
||||
xrColorToCMYK(xr_device_color_t color)
|
||||
{
|
||||
xr_device_color_t new;
|
||||
|
||||
new.space = rgb_colorspace;
|
||||
switch(color.space)
|
||||
{
|
||||
case gray_colorspace:
|
||||
new.field[0] = color.field[0];
|
||||
new.field[1] = color.field[0];
|
||||
new.field[2] = color.field[0];
|
||||
break;
|
||||
case rgb_colorspace:
|
||||
new = color;
|
||||
break;
|
||||
case hsb_colorspace:
|
||||
case cmyk_colorspace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
xr_device_color_t
|
||||
xrConvertToHSB(xr_device_color_t color)
|
||||
{
|
||||
xr_device_color_t new;
|
||||
|
||||
new.space = hsb_colorspace;
|
||||
switch(color.space)
|
||||
{
|
||||
case gray_colorspace:
|
||||
break;
|
||||
case rgb_colorspace:
|
||||
break;
|
||||
case hsb_colorspace:
|
||||
new = color;
|
||||
break;
|
||||
case cmyk_colorspace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
xr_device_color_t
|
||||
xrConvertToCMYK(xr_device_color_t color)
|
||||
{
|
||||
xr_device_color_t new;
|
||||
|
||||
new.space = gray_colorspace;
|
||||
new.space = cmyk_colorspace;
|
||||
switch(color.space)
|
||||
{
|
||||
case gray_colorspace:
|
||||
|
@ -260,3 +213,27 @@ xrConvertToCMYK(xr_device_color_t color)
|
|||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
/* FIXME: Not implemented */
|
||||
xr_device_color_t
|
||||
xrColorToHSB(xr_device_color_t color)
|
||||
{
|
||||
xr_device_color_t new;
|
||||
|
||||
new.space = hsb_colorspace;
|
||||
switch(color.space)
|
||||
{
|
||||
case gray_colorspace:
|
||||
break;
|
||||
case rgb_colorspace:
|
||||
break;
|
||||
case hsb_colorspace:
|
||||
new = color;
|
||||
break;
|
||||
case cmyk_colorspace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -2154,7 +2154,7 @@ if test "${enable_xim+set}" = set; then
|
|||
enableval="$enable_xim"
|
||||
:
|
||||
else
|
||||
enable_xim=no
|
||||
enable_xim=yes
|
||||
fi
|
||||
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
|
|
|
@ -174,7 +174,7 @@ AC_SUBST(DPS_DEFINE)
|
|||
#--------------------------------------------------------------------
|
||||
AC_ARG_ENABLE(xim,
|
||||
[ --enable-xim Enable XIM support],,
|
||||
enable_xim=no)
|
||||
enable_xim=yes)
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
AC_DEFINE(USE_XIM)
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue