diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2016-10-07 15:07:17 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2016-10-10 09:47:39 +0100 |
commit | ff59e2a9f86a4476aa67b5e768811fe43b0b4f0c (patch) | |
tree | 51babe39aaf612088b3bf1f515107dec71d5e033 | |
parent | 6c0d6e66d219006acfa3201963a0a7123dce3cc9 (diff) | |
download | ghostpdl-ff59e2a9f86a4476aa67b5e768811fe43b0b4f0c.tar.gz |
Remove the macos device
-rw-r--r-- | devices/gdevmac.c | 780 | ||||
-rw-r--r-- | devices/gdevmac.h | 164 | ||||
-rw-r--r-- | devices/gdevmacpictop.h | 674 | ||||
-rw-r--r-- | devices/gdevmacttf.h | 58 | ||||
-rw-r--r-- | doc/Develop.htm | 8 | ||||
-rwxr-xr-x | toolbin/tests/check_comments.py | 2 | ||||
-rw-r--r-- | windows/ghostscript.vcproj | 16 | ||||
-rw-r--r-- | windows/ghostscript_rt.vcxproj | 4 |
8 files changed, 0 insertions, 1706 deletions
diff --git a/devices/gdevmac.c b/devices/gdevmac.c deleted file mode 100644 index 7056ca844..000000000 --- a/devices/gdevmac.c +++ /dev/null @@ -1,780 +0,0 @@ -/* Copyright (C) 2001-2012 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, - CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* MacOS bitmap output device. This code is superceeded by - the newer gsapi_* interface and the DISPLAY device. Please - use that instead. See doc/API.htm for more information */ - -#include "gdevmac.h" -#include "gsparam.h" -#include "gsdll.h" - -/* The device descriptor */ - -gx_device_procs gs_mac_procs = { - mac_open, /* open_device */ - mac_get_initial_matrix, /* get_initial_matrix */ - mac_sync_output, /* sync_output */ - mac_output_page, /* output_page */ - mac_close, /* close_device */ - gx_default_rgb_map_rgb_color, /* map_rgb_color */ - gx_default_rgb_map_color_rgb, /* map_color_rgb */ - mac_fill_rectangle, /* fill_rectangle */ - NULL, /* tile_rectangle */ - mac_copy_mono, /* copy_mono */ - NULL,// mac_copy_color, /* copy_color */ - mac_draw_line, /* draw_line */ - NULL, /* get_bits */ - mac_get_params, /* get_params */ - mac_put_params, /* put_params */ - NULL, /* map_cmyk_color */ - NULL, /* get_xfont_procs */ - NULL, /* get_xfont_device */ - NULL, /* map_rgb_alpha_color */ - gx_page_device_get_page_device, /* get_page_device */ - gx_default_get_alpha_bits, /* get_alpha_bits */ - mac_copy_alpha, /* copy_alpha */ - NULL, /* get_band */ - NULL, /* copy_rop */ - NULL, /* fill_path */ - NULL, /* stroke_path */ - NULL, /* fill_mask */ - NULL, /* fill_trapezoid */ - NULL, /* fill_parallelogram */ - NULL, /* fill_triangle */ - NULL, /* draw_thin_line */ - NULL, /* begin_image */ - NULL, /* image_data */ - NULL, /* end_image */ - NULL //mac_strip_tile_rectangle /* strip_tile_rectangle */ -}; - -/* The instance is public. */ - -gx_device_macos gs_macos_device = { - std_device_color_body(gx_device_macos, - &gs_mac_procs, - DEV_MAC_NAME, - DEFAULT_DEV_WIDTH, /* x and y extent (nominal) */ - DEFAULT_DEV_HEIGHT, - DEFAULT_DEV_DPI, /* x and y density (nominal) */ - DEFAULT_DEV_DPI, - /*dci_color(*/8, 255, 256/*)*/), - { 0 }, /* std_procs */ - "", /* Output Filename */ - NULL, /* Output File */ - NULL, /* PicHandle to "draw" into */ - NULL, /* PicPtr */ - false, /* outputPage */ - -1, /* lastFontFace */ - -1, /* lastFontSize */ - -1, /* lastFontID */ - 0 /* numUsedFonts */ -}; - -static int -mac_open(register gx_device *dev) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - static short picHeader[42] = { 0x0000, // picture size - 0x0000, 0x0000, 0x0318, 0x0264, // bounding rect at 72dpi - 0x0011, 0x02ff, 0x0c00, 0xfffe, 0x0000, // version/header opcodes - 0x0048, 0x0000, // best x resolution - 0x0048, 0x0000, // best y resolution - 0x0000, 0x0000, 0x0318, 0x0264, // optimal src rect at 72dpi - 0x0000, // reserved - - 0x0000, 0x001e, // DefHilite - 0x0008, 0x0048, // PenMode - 0x001a, 0x0000, 0x0000, 0x0000, // RGBFgCol = Black - 0x001b, 0xFFFF, 0xFFFF, 0xFFFF, // RGBBkCol = White - - 0x0001, 0x000A, // set clipping - 0x0000, 0x0000, 0x0318, 0x0264, // clipping rect - 0x0032, 0x0000, 0x0000, 0x0318, 0x0264 // erase rect - }; - - mac_set_colordepth(dev, mdev->color_info.depth); - - mdev->numUsedFonts = 0; - mdev->lastFontFace = -1; - mdev->lastFontSize = -1; - mdev->lastFontID = -1; - - mdev->pic = (PicHandle) NewHandle(500000); - if (mdev->pic == 0) // error, not enough memory - return_error(gs_error_VMerror); - - HLockHi((Handle) mdev->pic); // move handle high and lock it - - mdev->currPicPos = (short*) *mdev->pic; - memcpy(mdev->currPicPos, picHeader, 42*2); - mdev->currPicPos += 42; - - // enter correct dimensions and resolutions - ((short*)(*mdev->pic))[ 3] = mdev->MediaSize[1]; - ((short*)(*mdev->pic))[ 4] = mdev->MediaSize[0]; - - ((short*)(*mdev->pic))[16] = ((short*)(*mdev->pic))[35] = ((short*)(*mdev->pic))[40] = mdev->height; - ((short*)(*mdev->pic))[17] = ((short*)(*mdev->pic))[36] = ((short*)(*mdev->pic))[41] = mdev->width; - - ((short*)(*mdev->pic))[10] = (((long) X2Fix( mdev->x_pixels_per_inch )) & 0xFFFF0000) >> 16; - ((short*)(*mdev->pic))[11] = ((long) X2Fix( mdev->x_pixels_per_inch )) & 0x0000FFFF; - ((short*)(*mdev->pic))[12] = (((long) X2Fix( mdev->y_pixels_per_inch )) & 0xFFFF0000) >> 16; - ((short*)(*mdev->pic))[13] = ((long) X2Fix( mdev->y_pixels_per_inch )) & 0x0000FFFF; - - // finish picture, but dont increment pointer, we want to go on drawing - *mdev->currPicPos = 0x00ff; - - // notify the caller that a new device was opened - if (pgsdll_callback) - (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 1); - - return 0; -} - -static void -mac_get_initial_matrix(register gx_device *dev, register gs_matrix *pmat) -{ - pmat->xx = dev->x_pixels_per_inch / 72.0; - pmat->xy = 0; - pmat->yx = 0; - pmat->yy = dev->y_pixels_per_inch / -72.0; - pmat->tx = 0; - pmat->ty = dev->height; -} - -/* Make the output appear on the screen. */ -int -mac_sync_output(gx_device * dev) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - // finish picture, but dont increment pointer, we want to go on drawing - *mdev->currPicPos = 0x00ff; - - // tell the caller to sync - if (pgsdll_callback) - (*pgsdll_callback) (GSDLL_SYNC, (char *)mdev, 0); - - return (0); -} - -int -mac_output_page(gx_device * dev, int copies, int flush) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - int code = 0; - - mdev->outputPage = true; - - if (strcmp(mdev->outputFileName, "")) { - // save file - code = mac_save_pict(dev); - } - - // tell the caller that the page is done - if (pgsdll_callback) - (*pgsdll_callback) (GSDLL_PAGE, (char *)mdev, 0); - - gx_finish_output_page(dev, copies, flush); - - return code; -} - -static int -mac_save_pict(gx_device * dev) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - int code = 0; - int i; - - if (mdev->outputFile == NULL) { - code = gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile)); - if (code < 0) return code; - } - - for (i=0; i<512; i++) fputc(0, mdev->outputFile); - fwrite(*(mdev->pic), sizeof(char), ((long) mdev->currPicPos - (long) *mdev->pic + 2), mdev->outputFile); - - gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile); - mdev->outputFile = NULL; - - return code; -} - -/* Close the device. */ -static int -mac_close(register gx_device *dev) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - long len; - - HUnlock((Handle) mdev->pic); // no more changes in the pict -> unlock handle - if (strcmp(mdev->outputFileName, "")) { - DisposeHandle((Handle) mdev->pic); - gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile); - mdev->outputFile = 0; - } else { - len = (long)mdev->currPicPos - (long)*mdev->pic; - SetHandleSize((Handle) mdev->pic, len + 10); // +10 just for the case - } - - // notify the caller that the device was closed - // it has to dispose the PICT handle when it is ready! - if (pgsdll_callback) - (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 0); - - return 0; -} - -/* Fill a rectangle with a color. */ -static int -mac_fill_rectangle(register gx_device *dev, - int x, int y, int w, int h, - gx_color_index color) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - /* ignore a fullpage rect directly after an output_page, this would clear the pict */ - if (mdev->outputPage && - (x == 0) && (y == 0) && (w == mdev->width) && (h == mdev->height)) { - return 0; - } - - CheckMem(1024, 100*1024); - ResetPage(); - - GSSetFgCol(dev, mdev->currPicPos, color); - PICT_fillRect(mdev->currPicPos, x, y, w, h); - - PICT_OpEndPicGoOn(mdev->currPicPos); - - return 0; -} - -/* Draw a line */ -static int -mac_draw_line (register gx_device *dev, - int x0, int y0, - int x1, int y1, - gx_color_index color) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - CheckMem(1024, 100*1024); - ResetPage(); - - GSSetFgCol(dev, mdev->currPicPos, color); - PICT_Line(mdev->currPicPos, x0, y0, x1, y1); - - PICT_OpEndPicGoOn(mdev->currPicPos); - - return 0; -} - -/* Copy a monochrome bitmap. */ -static int -mac_copy_mono (register gx_device *dev, - const unsigned char *base, int data_x, int raster, gx_bitmap_id id, - int x, int y, int w, int h, - gx_color_index color_0, gx_color_index color_1) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - int byteCount = raster * h; - short copyMode; - - // this case doesn't change the picture -> return without wasting time - if (color_0 == gx_no_color_index && color_1 == gx_no_color_index) - return 0; - - fit_copy(dev, base, data_x, raster, id, x, y, w, h); - - CheckMem(10*1024 + byteCount*10, 100*1024 + byteCount*10); - ResetPage(); - - if (color_0 == gx_no_color_index) - copyMode = srcOr; - else if (color_1 == gx_no_color_index) - copyMode = notSrcBic; // this mode is untested ! (no file found which is using it) - else - copyMode = srcCopy; - - copyMode += ditherCopy; - - GSSetBkCol(dev, mdev->currPicPos, color_0); - GSSetFgCol(dev, mdev->currPicPos, color_1); - - PICTWriteOpcode(mdev->currPicPos, 0x0098); - PICTWriteInt(mdev->currPicPos, raster); - PICTWriteRect(mdev->currPicPos, 0, 0, raster*8, h); - PICTWriteRect(mdev->currPicPos, data_x, 0, w, h); - PICTWriteRect(mdev->currPicPos, x, y, w, h); - PICTWriteInt(mdev->currPicPos, copyMode); - PICTWriteDataPackBits(mdev->currPicPos, base, raster, h); - - PICT_OpEndPicGoOn(mdev->currPicPos); - - return 0; -} - -/* Fill a region with a color and apply a per-pixel alpha-value */ -/* alpha value is simulated by changed the value to white. Full transparency means white color */ -/* that's why this will only work on a fully white background!!!! */ -static int -mac_copy_alpha(gx_device *dev, const unsigned char *base, int data_x, - int raster, gx_bitmap_id id, int x, int y, int w, int h, - gx_color_index color, int depth) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - ColorSpec *colorTable; - short copyMode, shade, maxShade = (1 << depth) - 1, byteCount = raster * h; - gx_color_value rgb[3]; - colorHSV colHSV; - colorRGB colRGB; - float saturation, value; - - fit_copy(dev, base, data_x, raster, id, x, y, w, h); - - CheckMem( byteCount*4 + 200*1024, byteCount*4 + 500*1024 ); - ResetPage(); - - colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (maxShade+1)); - if (colorTable == NULL) - return_error(gs_error_VMerror); - - (*dev_proc(dev, map_color_rgb))(dev, color, rgb); - colRGB.red = rgb[0]; - colRGB.green = rgb[1]; - colRGB.blue = rgb[2]; - mac_convert_rgb_hsv(&colRGB, &colHSV); - saturation = colHSV.s; - value = colHSV.v; - - for (shade=0; shade <= maxShade; shade++) { - colorTable[shade].value = maxShade - shade; - - colHSV.s = saturation * (1.0 - (float)shade/(float)maxShade); - colHSV.v = value + ((1.0 - value) * (float)shade/(float)maxShade); - - mac_convert_hsv_rgb(&colHSV, &colRGB); - colorTable[shade].rgb.red = colRGB.red; - colorTable[shade].rgb.green = colRGB.green; - colorTable[shade].rgb.blue = colRGB.blue; - } - copyMode = srcCopy + ditherCopy; - - GSSetStdCol(mdev->currPicPos); - - if (raster < 8) { - PICTWriteOpcode(mdev->currPicPos, 0x0090); - } else { - PICTWriteOpcode(mdev->currPicPos, 0x0098); - } - PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/depth, h, raster, 0, 0, - X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), depth); - PICTWriteColorTable(mdev->currPicPos, 0, maxShade+1, colorTable); - PICTWriteRect(mdev->currPicPos, data_x, 0, w, h); - PICTWriteRect(mdev->currPicPos, x, y, w, h); - PICTWriteInt(mdev->currPicPos, copyMode); - PICTWriteDataPackBits(mdev->currPicPos, base, raster, h); - - PICT_OpEndPicGoOn(mdev->currPicPos); - - free(colorTable); - - return 0; -} - -void -mac_convert_rgb_hsv(colorRGB *inRGB, colorHSV *HSV) -{ -#define NORMALIZE_RGB(col) ((float)col/(float)0xFFFF) - - float min = 1.0, temp; - float r = NORMALIZE_RGB(inRGB->red), - g = NORMALIZE_RGB(inRGB->green), - b = NORMALIZE_RGB(inRGB->blue); - - HSV->h = 0; - - HSV->v = r; - if (g > HSV->v) HSV->v = g; - if (b > HSV->v) HSV->v = b; - - min = r; - if (g < min) min = g; - if (b < min) min = b; - - temp = HSV->v - min; - - if (HSV->v > 0) - HSV->s = temp / HSV->v; - else - HSV->s = 0; - - if (HSV->s > 0) { - float rd = (HSV->v - r) / temp, - gd = (HSV->v - g) / temp, - bd = (HSV->v - b) / temp; - - if (HSV->v == r) { - if (min == g) HSV->h = 5 + bd; - else HSV->h = 1 - gd; - } else if (HSV->v == g) { - if (min == b) HSV->h = 1 + rd; - else HSV->h = 3 - bd; - } else { - if (min == r) HSV->h = 3 + gd; - else HSV->h = 5 - rd; - } - - if (HSV->h < 6) HSV->h *= 60; - else HSV->h = 0; - } -} - -void -mac_convert_hsv_rgb(colorHSV *inHSV, colorRGB *RGB) -{ - if (inHSV->s == 0) { - RGB->red = RGB->green = RGB->blue = inHSV->v * 0xFFFF; - } else { - float h = inHSV->h / 60; - int i = trunc(h); - float fract = h - i; - unsigned short t1 = (inHSV->v * (1 - inHSV->s)) * 0xFFFF, - t2 = (inHSV->v * (1 - inHSV->s * fract)) * 0xFFFF, - t3 = (inHSV->v * (1 - inHSV->s * (1 - fract))) * 0xFFFF, - v = inHSV->v * 0xFFFF; - - switch(i) { - case 0: RGB->red = v; - RGB->green = t3; - RGB->blue = t1; - break; - - case 1: RGB->red = t2; - RGB->green = v; - RGB->blue = t1; - break; - - case 2: RGB->red = t1; - RGB->green = v; - RGB->blue = t3; - break; - - case 3: RGB->red = t1; - RGB->green = t2; - RGB->blue = v; - break; - - case 4: RGB->red = t3; - RGB->green = t1; - RGB->blue = v; - break; - - case 5: RGB->red = v; - RGB->green = t1; - RGB->blue = t2; - break; - } - } -} - -// set color info and procedures according to pixeldepth -static int -mac_set_colordepth(gx_device *dev, int depth) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - gx_device_color_info * ci = &mdev->color_info; - - if (depth != 1 && depth != 4 && depth != 7 && depth != 8 && depth != 24) - return_error(gs_error_rangecheck); - - mdev->color_info.depth = depth; - switch (depth) - { - case 1: // Black/White - ci->num_components = 1; - ci->max_gray = 1; ci->max_color = 0; - ci->dither_grays = 2; ci->dither_colors = 0; - set_dev_proc(dev, map_rgb_color, gx_default_b_w_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_b_w_map_color_rgb); - break; - - case 4: // 4Bit-Gray - ci->num_components = 1; - ci->max_gray = 15; ci->max_color = 0; - ci->dither_grays = 16; ci->dither_colors = 0; - set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb); - break; - - case 7: // 8Bit-Gray - ci->depth = 7; - ci->num_components = 1; - ci->max_gray = 255; ci->max_color = 0; - ci->dither_grays = 256; ci->dither_colors = 0; - set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb); - break; - - case 8: // 8Bit-Color - ci->num_components = 3; - ci->max_gray = 15; ci->max_color = 5; - ci->dither_grays = 16; ci->dither_colors = 6; - set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb); - break; - -/* case 16: // 16Bit-Color - ci->num_components = 3; - ci->max_gray = 255; ci->max_color = 65535; - ci->dither_grays = 256; ci->dither_colors = 65536; - set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb); - break; -*/ - case 24: // 24Bit-Color - ci->num_components = 3; - ci->max_gray = 255; ci->max_color = 16777215; - ci->dither_grays = 256; ci->dither_colors = 16777216; - set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color); - set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb); - break; - } - - return 0; -} - -static int -mac_put_params(gx_device *dev, gs_param_list *plist) -{ - gx_device_macos *mdev = (gx_device_macos *)dev; - - int isOpen = mdev->is_open; - int code; - int depth; - gs_param_string outputFile; - - // Get the BitsPerPixel Parameter - code = param_read_int(plist, "BitsPerPixel", &depth); - if (!code) { - code = mac_set_colordepth(dev, depth); - if (code) - param_return_error(plist, "BitsPerPixel", gs_error_rangecheck); - } - - // Get OutputFile - code = param_read_string(plist, "OutputFile", &outputFile); - if (code < 0) { - param_signal_error(plist, "OutputFile", code); - return code; - } else if (code == 0) { - - if (dev->LockSafetyParams && - bytes_compare(outputFile.data, outputFile.size, - (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) { - param_signal_error(plist, "OutputFile", gs_error_invalidaccess); - return_error(gs_error_invalidaccess); - } - if (outputFile.size > (gp_file_name_sizeof - 1)) { - param_signal_error(plist, "OutputFile", gs_error_limitcheck); - return_error(gs_error_limitcheck); - } - - /* If filename changed, close file. */ - if (outputFile.data != 0 && - bytes_compare(outputFile.data, outputFile.size, - (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) { - /* Close the file if it's open. */ - if (mdev->outputFile != NULL) { - gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile); - memcpy(mdev->outputFileName, outputFile.data, outputFile.size); - mdev->outputFileName[outputFile.size] = 0; - gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile)); - } else { - memcpy(mdev->outputFileName, outputFile.data, outputFile.size); - mdev->outputFileName[outputFile.size] = 0; - } - } - } - - // Get the Default Parameters - mdev->is_open = 0; - code = gx_default_put_params( dev, plist ); - mdev->is_open = isOpen; - - return code; -} - -static int -mac_get_params(gx_device *dev, gs_param_list *plist) -{ - gx_device_macos *mdev = (gx_device_macos *)dev; - - int code; - gs_param_string outputFile; - - code = gx_default_get_params(dev, plist); - if (code < 0) - return code; - - // color depth - code = param_write_int(plist, "BitsPerPixel", &(mdev->color_info.depth)); - - // output file name - outputFile.data = (const byte *) mdev->outputFileName; - outputFile.size = strlen(mdev->outputFileName); - outputFile.persistent = false; - code = param_write_string(plist, "OutputFile", &outputFile); - - return code; -} - -/* let the caller get the device PictHandle, he has to draw it to screen */ -int GSDLLAPI -gsdll_get_pict(unsigned char *dev, PicHandle *thePict) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - *thePict = mdev->pic; - - return 0; -} - -/*************************************************************************************/ -/*************************************************************************************/ -/** Experimental functions! **/ -/*************************************************************************************/ -/*************************************************************************************/ - -#if 0 -/* NOT FUNCTIONAL !!! */ -/* Copy a color bitmap. */ -static int -mac_copy_color (register gx_device *dev, - const unsigned char *base, int data_x, int raster, gx_bitmap_id id, - int x, int y, int w, int h) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - int byteCount = raster * h, color; - gx_color_value rgb[3]; - - fit_copy(dev, base, data_x, raster, id, x, y, w, h); - - CheckMem(10*1024 + byteCount*4, 100*1024 + byteCount*4); - ResetPage(); - - GSSetStdCol(mdev->currPicPos); // Sets FgCol to Black and BkCol to White - - if (mdev->color_info.depth == 24) { - PICTWriteOpcode(mdev->currPicPos, 0x009A); - PICTWriteLong(mdev->currPicPos, 0x000000FF); - PICTWritePixMap(mdev->currPicPos, 0, 0, raster/4, h, raster, 2, 0, - X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), 32); - PICTWriteRect(mdev->currPicPos, data_x, 0, w, h); - PICTWriteRect(mdev->currPicPos, x, y, w, h); - PICTWriteInt(mdev->currPicPos, srcCopy); - -/* memcpy(mdev->currPicPos, base, byteCount); - (char*)(mdev->currPicPos) += byteCount;*/ - - { - short i; - byteCount = 0; - - for (i=0; i<raster/4*h; i++) { - // PICTWriteByte(mdev->currPicPos, 0x00); - PICTWriteByte(mdev->currPicPos, 0x00); - PICTWriteByte(mdev->currPicPos, 0x00); - PICTWriteByte(mdev->currPicPos, 0x00); - byteCount += 3; - } - } - - if (byteCount % 2) - PICTWriteFillByte(mdev->currPicPos); - - } else if (mdev->color_info.depth <= 8) { - ColorSpec *colorTable; - - colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (1 << mdev->color_info.depth)); - for (color=0; color < (1 << mdev->color_info.depth); color++) { - (*dev_proc(dev, map_color_rgb))(dev, color, rgb); - colorTable[color].value = color; - colorTable[color].rgb.red = rgb[0]; - colorTable[color].rgb.green = rgb[1]; - colorTable[color].rgb.blue = rgb[2]; - } - - PICTWriteOpcode(mdev->currPicPos, 0x0098); - PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/mdev->color_info.depth, h, raster, 1, 0, - X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), - mdev->color_info.depth); - PICTWriteColorTable(mdev->currPicPos, 0, (1 << mdev->color_info.depth), colorTable); - PICTWriteRect(mdev->currPicPos, data_x, 0, w, h); - PICTWriteRect(mdev->currPicPos, x, y, w, h); - PICTWriteInt(mdev->currPicPos, srcCopy); - - PICTWriteDataPackBits(mdev->currPicPos, base, raster, h); - - free(colorTable); - } else { - gx_default_copy_color( dev, base, data_x, raster, id, x, y, w, h ); - } - - PICT_OpEndPicGoOn(mdev->currPicPos); - - return 0; -} -#endif - -#if 0 -/* tile a rectangle with a bitmap or pixmap */ -static int -mac_strip_tile_rectangle(register gx_device *dev, const gx_strip_bitmap *tile, - int x, int y, int w, int h, - gx_color_index color_0, gx_color_index color_1, - int phase_x, int phase_y) -{ - gx_device_macos * mdev = (gx_device_macos *)dev; - - int byteCount = tile->raster * tile->size.y; -/* - // tile is a pixmap - if (color_0 == gx_no_color_index && color_1 == gx_no_color_index) - return 0;// gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y); - - if (color_0 != gx_no_color_index && color_1 != gx_no_color_index) { - // monochrome tiles - if (phase_x != 0 ||Ęphase_y != 0 || tile->shift != 0 || - tile->strip_height != 0 ||Ętile->strip_shift != 0) { - return gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y); - } - - } else { - return 0;//gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y); - } -*/ -} -#endif diff --git a/devices/gdevmac.h b/devices/gdevmac.h deleted file mode 100644 index 7b49729d3..000000000 --- a/devices/gdevmac.h +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright (C) 2001-2012 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, - CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - - -#ifndef gdevmac_INCLUDED -# define gdevmac_INCLUDED - -#include <stdlib.h> -#include "math_.h" -#include "string_.h" - -#include "gdevmacpictop.h" - -#include <Fonts.h> -#include <FixMath.h> -#include <Resources.h> - -#include "gx.h" -#include "gxdevice.h" -#include "gp.h" -#include "gp_mac.h" -#include "gsdll.h" - -#include "gsutil.h" -#include "gxxfont.h" -#include "gsstruct.h" -#include "gserrors.h" - -/* Default device settings */ - -#define DEFAULT_PAGE_SIZE_H 8.5 -#define DEFAULT_PAGE_SIZE_V 11.0 -#define DEFAULT_DEV_DPI 72.0 -#define DEFAULT_PAGE_DPI 72.0 - -#define DEFAULT_DEV_WIDTH (DEFAULT_PAGE_SIZE_H * DEFAULT_DEV_DPI) -#define DEFAULT_DEV_HEIGHT (DEFAULT_PAGE_SIZE_V * DEFAULT_DEV_DPI) -#define DEFAULT_PAGE_WIDTH (DEFAULT_PAGE_SIZE_H * DEFAULT_PAGE_DPI) -#define DEFAULT_PAGE_HEIGHT (DEFAULT_PAGE_SIZE_V * DEFAULT_PAGE_DPI) - -/* Define the Macintosh device */ - -typedef struct gx_device_macos_s -{ - gx_device_common; - char outputFileName[gp_file_name_sizeof]; - FILE *outputFile; - PicHandle pic; - short *currPicPos; - bool outputPage; - FMFontStyle lastFontFace; - FMFontSize lastFontSize; - FMFontFamily lastFontID; - int numUsedFonts; - FMFontFamily usedFontIDs[256]; -} gx_device_macos; - -#define DEV_MAC_NAME "macos" - -/* Device Procedures */ - -dev_proc_open_device(mac_open); -dev_proc_get_initial_matrix(mac_get_initial_matrix); -dev_proc_sync_output(mac_sync_output); -dev_proc_output_page(mac_output_page); -dev_proc_get_params(mac_get_params); -dev_proc_put_params(mac_put_params); -dev_proc_close_device(mac_close); -dev_proc_fill_rectangle(mac_fill_rectangle); -dev_proc_strip_tile_rectangle(mac_strip_tile_rectangle); -dev_proc_copy_mono(mac_copy_mono); -dev_proc_copy_color(mac_copy_color); -dev_proc_draw_line(mac_draw_line); -dev_proc_copy_alpha(mac_copy_alpha); - -/* Define a MacOS xfont. */ - -typedef struct mac_xfont_s mac_xfont; -struct mac_xfont_s { - gx_xfont_common common; - gx_device *dev; - Str255 fontName; - FMFontFamily fontID; - FMFontStyle fontFace; - FMFontSize fontSize; - int fontEncoding; - FMetricRec fontMetrics; -}; - -/* Memory handling macros */ - -#define CheckMem(a,b) \ - { \ - long offset = (long) mdev->currPicPos - (long) *mdev->pic; \ - long len = GetHandleSize((Handle) mdev->pic); \ - if (len - offset < a) { \ - HUnlock((Handle) mdev->pic); \ - SetHandleSize((Handle) mdev->pic, len + b); \ - if (MemError() != noErr) return_error(gs_error_VMerror); \ - HLockHi((Handle) mdev->pic); \ - mdev->currPicPos = (short*) ((long) *mdev->pic + offset); \ - } \ - } - -#define ResetPage() \ - { \ - if (mdev->outputPage) { \ - mdev->outputPage = false; \ - mdev->currPicPos = (short*) *mdev->pic; \ - mdev->currPicPos += 42; /* header len */ \ - mdev->lastFontID = mdev->lastFontSize = mdev->lastFontFace = -1; \ - mdev->numUsedFonts = 0; \ - } \ - } - -/* Other datatypes */ - -typedef struct { - unsigned short red; - unsigned short green; - unsigned short blue; -} colorRGB; - -typedef struct { - float h; - float s; - float v; -} colorHSV; - -/* Helper function definitions */ - -static int mac_save_pict(gx_device * dev); -static void mac_convert_rgb_hsv(colorRGB *inRGB, colorHSV *HSV); -static void mac_convert_hsv_rgb(colorHSV *inHSV, colorRGB *RGB); - -static void mac_find_font_family(ConstStringPtr fname, int len, - FMFontFamily *fontFamilyID, FMFontStyle *fontFace); -static int mac_get_font_encoding(mac_xfont *macxf); -static void mac_get_font_resource(mac_xfont *macxf, ResType *resType, short *resID); - -static int mac_set_colordepth(gx_device *dev, int depth); - -/* additional DLL function definition */ - -#pragma export on - -int GSDLLAPI gsdll_get_pict(unsigned char *, PicHandle *); -typedef int (GSDLLAPI * PFN_gsdll_get_pict) (unsigned char *, PicHandle *); - -#pragma export off - -#endif /* gdevmac_INCLUDED */ diff --git a/devices/gdevmacpictop.h b/devices/gdevmacpictop.h deleted file mode 100644 index bfe61b7a2..000000000 --- a/devices/gdevmacpictop.h +++ /dev/null @@ -1,674 +0,0 @@ -/* Copyright (C) 2001-2012 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, - CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* Helpers for working with Classic MacOS Quickdraw pictures */ -/* (obsoleted by the DISPLAY device) */ - -#ifndef gdevmacpictop_INCLUDED -# define gdevmacpictop_INCLUDED - -#include <QDOffscreen.h> - -/************************/ -/* PICT data structures */ -/************************/ - -/* write raw data to PICT file */ -#define PICTWriteByte(ptr, data) *((unsigned char*) (ptr))++ = data; -#define PICTWriteInt(ptr, data) *((short*) (ptr))++ = data; -#define PICTWriteLong(ptr, data) *((long*) (ptr))++ = data; - -#define PICTWriteFillByte(ptr) PICTWriteByte(ptr, 0); - -/* write a PICT opcode */ -#define PICTWriteOpcode(ptr, op) PICTWriteInt(ptr, op); - -/*****************************/ -/* QuickDraw data structures */ -/*****************************/ - -/* write a Point structure */ -#define PICTWritePoint(ptr, h, v) \ - { \ - PICTWriteInt(ptr, v); /* vertical coordinate */ \ - PICTWriteInt(ptr, h); /* horizontal coordinate */ \ - } - -/* write a Rect structure */ -#define PICTWriteRect(ptr, x, y, w, h) \ - { \ - PICTWritePoint(ptr, x, y); /* upper-left corner */ \ - PICTWritePoint(ptr, x+w, y+h); /* lower-right corner */ \ - } - -/* write a rectangular Region structure */ -#define PICTWriteRegionRectangular(ptr, x, y, w, h) \ - { \ - PICTWriteInt(ptr, 10); /* rgnSize */ \ - PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \ - } - -/* write a non-rectangular Region structure */ -#define PICTWriteRegion(ptr, x, y, b, h, size, dataptr) \ - { \ - PICTWriteInt(ptr, 10+size); /* rgnSize */ \ - PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \ - memcpy(ptr, dataptr, size); /* additional data */ \ - ((char*)(ptr)) += size; \ - } - -/* write a pattern */ -#define PICTWritePattern(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \ - { \ - PICTWriteByte(ptr, byte1); /* pattern */ \ - PICTWriteByte(ptr, byte2); /* pattern */ \ - PICTWriteByte(ptr, byte3); /* pattern */ \ - PICTWriteByte(ptr, byte4); /* pattern */ \ - PICTWriteByte(ptr, byte5); /* pattern */ \ - PICTWriteByte(ptr, byte6); /* pattern */ \ - PICTWriteByte(ptr, byte7); /* pattern */ \ - PICTWriteByte(ptr, byte8); /* pattern */ \ - } - -/* write a RGBColor structure */ -#define PICTWriteRGBColor(ptr, r, g, b) \ - { \ - PICTWriteInt(ptr, r); /* red */ \ - PICTWriteInt(ptr, g); /* green */ \ - PICTWriteInt(ptr, b); /* blue */ \ - } - -/* write a ColorSpec structure */ -#define PICTWriteColorSpec(ptr, value, r, g, b) \ - { \ - PICTWriteInt(ptr, value); /* value */ \ - PICTWriteRGBColor(ptr, r, g, b); /* color */ \ - } - -/* write a ColorTable structure */ -#define PICTWriteColorTable(ptr, seed, numEntries, cspecarr) \ - { \ - int i; \ - PICTWriteLong(ptr, seed); /* ctSeed */ \ - PICTWriteInt(ptr, 0); /* ctFlags */ \ - PICTWriteInt(ptr, numEntries-1); /* ctSize */ \ - for (i=0; i<numEntries; i++) /* ctTable */ \ - PICTWriteColorSpec(ptr, cspecarr[i].value, \ - cspecarr[i].rgb.red, \ - cspecarr[i].rgb.green, \ - cspecarr[i].rgb.blue); \ - } - -/* write a PixMap structure */ -#define PICTWritePixMap(ptr, x, y, w, h, rowBytes, \ - packType, packSize, \ - hRes, vRes, pixelSize) \ - { \ - PICTWriteInt(ptr, 0x8000+rowBytes); /* rowBytes */ \ - PICTWriteRect(ptr, x, y, w, h); /* bounds */ \ - PICTWriteInt(ptr, 0); /* pmVersion */ \ - PICTWriteInt(ptr, packType); /* packType */ \ - PICTWriteLong(ptr, (packType ? packSize : 0)); /* packSize */ \ - PICTWriteLong(ptr, hRes); /* hRes */ \ - PICTWriteLong(ptr, vRes); /* vRes */ \ - if (pixelSize < 16) { /* indexed */ \ - PICTWriteInt(ptr, 0); /* pixelType */ \ - PICTWriteInt(ptr, pixelSize); /* pixelSize */ \ - PICTWriteInt(ptr, 1); /* cmpCount */ \ - PICTWriteInt(ptr, pixelSize); /* cmpSize */ \ - } else { /* direct */ \ - PICTWriteInt(ptr, RGBDirect); /* pixelType */ \ - PICTWriteInt(ptr, pixelSize); /* pixelSize */ \ - PICTWriteInt(ptr, 3); /* cmpCount */ \ - PICTWriteInt(ptr, (pixelSize==16 ? 5 : 8)); /* cmpSize */ \ - } \ - PICTWriteLong(ptr, 0); /* planeBytes */ \ - PICTWriteLong(ptr, 0); /* pmTable */ \ - PICTWriteLong(ptr, 0); /* pmReserved */ \ - } - -/* write PackBits data */ -#define PICTWriteDataPackBits(ptr, base, rowBytes, lines) \ - { \ - short byteCount; \ - if (raster < 8) { /* data uncompressed */ \ - byteCount = rowBytes * lines; \ - memcpy(ptr, base, byteCount); /* bitmap data */ \ - (char*)(ptr) += byteCount; \ - } else { /* raster >= 8 use PackBits compression */ \ - Ptr destBufBegin = (Ptr) malloc(raster + (raster+126)/127), destBuf, \ - srcBuf = (Ptr) base; \ - short i, len; \ - \ - byteCount = 0; \ - for (i=0; i<lines; i++) { \ - destBuf = destBufBegin; \ - PackBits(&srcBuf, &destBuf, rowBytes); \ - len = destBuf - destBufBegin; \ - if (rowBytes > 250) { \ - PICTWriteInt(ptr, len); \ - byteCount += 2; \ - } else { \ - PICTWriteByte(ptr, len); \ - byteCount++; \ - } \ - \ - memcpy(ptr, destBufBegin, len); \ - (char*)(ptr) += len; \ - byteCount += len; \ - } \ - free(destBufBegin); \ - } \ - \ - if (byteCount % 2) \ - PICTWriteFillByte(ptr); \ - } - -/* write text */ -#define PICTWriteText(ptr, textptr /* pascal string*/) \ - { \ - memcpy(ptr, textptr, textptr[0]+1); /* copy string */ \ - (char*)(ptr) += textptr[0]+1; \ - } - -/****************/ -/* PICT Opcodes */ -/****************/ - -#define PICT_NOP(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0000); /* NOP opcode */ \ - } - -#define PICT_Clip_Rectangular(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \ - PICTWriteRegionRectangular(ptr, x, y, w, h); /* clipRgn */ \ - } - -#define PICT_Clip(ptr, x, y, w, h, size, dataptr) \ - { \ - PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \ - PICTWriteRegion(ptr, x, y, w, h, size, dataptr); /* clipRgn */ \ - } - -#define PICT_BkPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \ - { \ - PICTWriteOpcode(ptr, 0x0002); /* BkPat opcode */ \ - PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \ - byte5, byte6, byte7, byte8); \ - } - -#define PICT_TxFont(ptr, font) \ - { \ - PICTWriteOpcode(ptr, 0x0003); /* TxFont opcode */ \ - PICTWriteInt(ptr, font); /* Font number */ \ - } - -#define PICT_TxFace(ptr, style) \ - { \ - PICTWriteOpcode(ptr, 0x0004); /* TxFace opcode */ \ - PICTWriteByte(ptr, style); /* Font style */ \ - PICTWriteFillByte(ptr); /* Fill byte */ \ - } - -#define PICT_TxMode(ptr, mode) \ - { \ - PICTWriteOpcode(ptr, 0x0005); /* TxMode opcode */ \ - PICTWriteInt(ptr, mode); /* Source mode */ \ - } - -#define PICT_PnSize(ptr, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0006); /* PnSize opcode */ \ - PICTWritePoint(w, h); /* Pen size */ \ - } - -#define PICT_PnMode(ptr, mode) \ - { \ - PICTWriteOpcode(ptr, 0x0007); /* PnMode opcode */ \ - PICTWriteInt(ptr, mode); /* Pen mode */ \ - } - -#define PICT_PnPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \ - { \ - PICTWriteOpcode(ptr, 0x0009); /* PnPat opcode */ \ - PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \ - byte5, byte6, byte7, byte8); \ - } - -#define PICT_FillPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \ - { \ - PICTWriteOpcode(ptr, 0x000A); /* FillPat opcode */ \ - PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \ - byte5, byte6, byte7, byte8); \ - } - -#define PICT_OvSize(ptr, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x000B); /* OvSize opcode */ \ - PICTWritePoint(w, h); /* Oval size */ \ - } - -#define PICT_Origin(ptr, dh, dv) \ - { \ - PICTWriteOpcode(ptr, 0x000C); /* Origin opcode */ \ - PICTWriteInt(ptr, dh); /* dh */ \ - PICTWriteInt(ptr, dv); /* dv */ \ - } - -#define PICT_TxSize(ptr, size) \ - { \ - PICTWriteOpcode(ptr, 0x000D); /* TxSize opcode */ \ - PICTWriteInt(ptr, size); /* Text Size */ \ - } - -#define PICT_FgColor(ptr, color) \ - { \ - PICTWriteOpcode(ptr, 0x000E); /* FgColor opcode */ \ - PICTWriteLong(ptr, color); /* Foreground color */ \ - } - -#define PICT_BkColor(ptr, color) \ - { \ - PICTWriteOpcode(ptr, 0x000F); /* BkColor opcode */ \ - PICTWriteLong(ptr, color); /* Background color */ \ - } - -#define PICT_TxRatio(ptr, num, denom) \ - { \ - PICTWriteOpcode(ptr, 0x0010); /* TxRatio opcode */ \ - PICTWritePoint(ptr, num); /* Numerator (Point) */ \ - PICTWritePoint(ptr, denom); /* Denominator (Point) */ \ - } - -#define PICT_VersionOp(ptr, version) \ - { \ - PICTWriteOpcode(ptr, 0x0011); /* VersionOp opcode */ \ - PICTWriteByte(ptr, version); /* Version */ \ - PICTWriteFillByte(ptr); /* Fill byte */ \ - } - -#define PICT_RGBFgCol(ptr, r, g, b) \ - { \ - PICTWriteOpcode(ptr, 0x001A); /* RGBFgCol opcode */ \ - PICTWriteRGBColor(ptr, r, g, b); /* Foreground color */ \ - } - -#define PICT_RGBBkCol(ptr, r, g, b) \ - { \ - PICTWriteOpcode(ptr, 0x001B); /* RGBBkCol opcode */ \ - PICTWriteRGBColor(ptr, r, g, b); /* Background color */ \ - } - -#define PICT_HiliteMode(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x001C); /* HiliteMode opcode */ \ - } - -#define PICT_HiliteColor(ptr, r, g, b) \ - { \ - PICTWriteOpcode(ptr, 0x001D); /* HiliteColor opcode */ \ - PICTWriteRGBColor(ptr, r, g, b); /* Highlight color */ \ - } - -#define PICT_DefHilite(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x001E); /* DefHilite opcode */ \ - } - -#define PICT_OpColor(ptr, r, g, b) \ - { \ - PICTWriteOpcode(ptr, 0x001F); /* OpColor opcode */ \ - PICTWriteRGBColor(ptr, r, g, b); /* Opcolor */ \ - } - -#define PICT_Line(ptr, x0, y0, x1, y1) \ - { \ - PICTWriteOpcode(ptr, 0x0020); /* Line opcode */ \ - PICTWritePoint(ptr, x0, y0); /* pnLoc */ \ - PICTWritePoint(ptr, x1, y1); /* newPt */ \ - } - -#define PICT_LineFrom(ptr, x, y) \ - { \ - PICTWriteOpcode(ptr, 0x0021); /* LineFrom opcode */ \ - PICTWritePoint(ptr, x, y); /* newPt */ \ - } - -#define PICT_ShortLine(ptr, x, y, dh, dv) \ - { \ - PICTWriteOpcode(ptr, 0x0022); /* ShortLine opcode */ \ - PICTWritePoint(ptr, x, y); /* pnLoc */ \ - PICTWriteByte(ptr, dh); /* dh */ \ - PICTWriteByte(ptr, dv); /* dv */ \ - } - -#define PICT_ShortLineFrom(ptr, dh, dv) \ - { \ - PICTWriteOpcode(ptr, 0x0023); /* ShortLineFrom opcode */ \ - PICTWriteByte(ptr, dh); /* dh */ \ - PICTWriteByte(ptr, dv); /* dv */ \ - } - -#define PICT_LongText(ptr, x, y, textptr /* pascal string */) \ - { \ - PICTWriteOpcode(ptr, 0x0028); /* LongText opcode */ \ - PICTWritePoint(ptr, x, y); /* Point */ \ - PICTWriteText(ptr, textptr); /* text */ \ - if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \ - } - -#define PICT_DHText(ptr, dh, textptr /* pascal string */) \ - { \ - PICTWriteOpcode(ptr, 0x0029); /* DHText opcode */ \ - PICTWriteByte(ptr, dh); /* dh */ \ - PICTWriteText(ptr, textptr); /* text */ \ - if (textptr[0] % 2) PICTWriteFillByte(ptr); \ - } - -#define PICT_DVText(ptr, dv, textptr /* pascal string */) \ - { \ - PICTWriteOpcode(ptr, 0x002A); /* DVText opcode */ \ - PICTWriteByte(ptr, dv); /* dv */ \ - PICTWriteText(ptr, textptr); /* text */ \ - if (textptr[0] % 2) PICTWriteFillByte(ptr); \ - } - -#define PICT_DHDVText(ptr, dh, dv, textptr /* pascal string */) \ - { \ - PICTWriteOpcode(ptr, 0x002B); /* DHDVText opcode */ \ - PICTWriteByte(ptr, dh); /* dh */ \ - PICTWriteByte(ptr, dv); /* dv */ \ - PICTWriteText(ptr, textptr); /* text */ \ - if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \ - } - -#define PICT_fontName(ptr, id, nameptr /* pascal string */) \ - { \ - PICTWriteOpcode(ptr, 0x002C); /* fontName opcode */ \ - PICTWriteInt(ptr, nameptr[0]+1+2); /* data length */ \ - PICTWriteInt(ptr, id); /* font id */ \ - PICTWriteText(ptr, nameptr); /* text */ \ - if ((nameptr[0]+1) % 2) PICTWriteFillByte(ptr); \ - } - -#define PICT_frameRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0030); /* frameRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_paintRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0031); /* paintRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_eraseRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0032); /* eraseRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_invertRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0033); /* invertRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_fillRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0034); /* fillRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_frameSameRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0038); /* frameSameRect opcode */ \ - } - -#define PICT_paintSameRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0039); /* paintSameRect opcode */ \ - } - -#define PICT_eraseSameRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x003A); /* eraseSameRect opcode */ \ - } - -#define PICT_invertSameRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x003B); /* invertSameRect opcode */ \ - } - -#define PICT_fillSameRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x003C); /* fillSameRect opcode */ \ - } - -#define PICT_frameRRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0040); /* frameRRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_paintRRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0041); /* paintRRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_eraseRRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0042); /* eraseRRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_invertRRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0043); /* invertRRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_fillRRect(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0044); /* fillRRect opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_frameSameRRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0048); /* frameSameRRect opcode */ \ - } - -#define PICT_paintSameRRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0049); /* paintSameRRect opcode */ \ - } - -#define PICT_eraseSameRRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x004A); /* eraseSameRRect opcode */ \ - } - -#define PICT_invertSameRRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x004B); /* invertSameRRect opcode */\ - } - -#define PICT_fillSameRRect(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x004C); /* fillSameRRect opcode */ \ - } - -#define PICT_frameOval(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0050); /* frameOval opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_paintOval(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0051); /* paintOval opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_eraseOval(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0052); /* eraseOval opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_invertOval(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0053); /* invertOval opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_fillOval(ptr, x, y, w, h) \ - { \ - PICTWriteOpcode(ptr, 0x0054); /* fillOval opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - } - -#define PICT_frameSameOval(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0058); /* frameSameOval opcode */ \ - } - -#define PICT_paintSameOval(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x0059); /* paintSameOval opcode */ \ - } - -#define PICT_eraseSameOval(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x005A); /* eraseSameOval opcode */ \ - } - -#define PICT_invertSameOval(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x005B); /* invertSameOval opcode */ \ - } - -#define PICT_fillSameOval(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x005C); /* fillSameOval opcode */ \ - } - -#define PICT_frameArc(ptr, x, y, w, h, startAngle, arcAngle) \ - { \ - PICTWriteOpcode(ptr, 0x0060); /* frameArc opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - PICTWriteInt(ptr, startAngle); /* startAngle */ \ - PICTWriteInt(ptr, arcAngle); /* arcAngle */ \ - } - -#define PICT_paintArc(ptr, x, y, w, h, startAngle, arcAngle) \ - { \ - PICTWriteOpcode(ptr, 0x0061); /* paintArc opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - PICTWriteInt(ptr, startAngle); /* startAngle */ \ - PICTWriteInt(ptr, arcAngle); /* arcAngle */ \ - } - -#define PICT_eraseArc(ptr, x, y, w, h, startAngle, arcAngle) \ - { \ - PICTWriteOpcode(ptr, 0x0062); /* eraseArc opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - PICTWriteInt(ptr, startAngle); /* startAngle */ \ - PICTWriteInt(ptr, arcAngle); /* arcAngle */ \ - } - -#define PICT_invertArc(ptr, x, y, w, h, startAngle, arcAngle) \ - { \ - PICTWriteOpcode(ptr, 0x0063); /* invertArc opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - PICTWriteInt(ptr, startAngle); /* startAngle */ \ - PICTWriteInt(ptr, arcAngle); /* arcAngle */ \ - } - -#define PICT_fillArc(ptr, x, y, w, h, startAngle, arcAngle) \ - { \ - PICTWriteOpcode(ptr, 0x0064); /* fillArc opcode */ \ - PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \ - PICTWriteInt(ptr, startAngle); /* startAngle */ \ - PICTWriteInt(ptr, arcAngle); /* arcAngle */ \ - } - -/* use only with rowBytes < 8 !! */ -#define PICT_BitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, dataPtr) \ - { \ - PICTWriteOpcode(ptr, 0x0090); /* BitsRect opcode */ \ - PICTWriteInt(ptr, rowBytes); /* rowBytes */ \ - PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \ - PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \ - PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \ - PICTWriteInt(ptr, mode); /* mode */ \ - memcpy(ptr, dataPtr, h0*rowBytes); /* BitMap data */ \ - } - -#define PICT_PackBitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, \ - dataPtr, size) \ - { \ - PICTWriteOpcode(ptr, 0x0098); /* PackBitsRect opcode */ \ - PICTWriteInt(ptr, rowBytes); /* rowBytes */ \ - PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \ - PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \ - PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \ - PICTWriteInt(ptr, mode); /* mode */ \ - memcpy(ptr, dataPtr, size); /* BitMap data */ \ - } - -#define PICT_OpEndPic(ptr) \ - { \ - PICTWriteOpcode(ptr, 0x00FF); /* OpEndPic opcode */ \ - } - -/* same as PICT_OpEndPic, but doesn't move pointer */ -#define PICT_OpEndPicGoOn(ptr) \ - { \ - *(ptr) = 0x00FF; /* OpEndPic opcode */ \ - } - -/******************************/ -/* ghostscript to PICT macros */ -/******************************/ - -/* set forground color to black and background color to white */ -#define GSSetStdCol(ptr) \ - { \ - PICT_RGBFgCol(ptr, 0x0000, 0x0000, 0x0000); /* black */ \ - PICT_RGBBkCol(ptr, 0xFFFF, 0xFFFF, 0xFFFF); /* white */ \ - } - -#define GSSetFgCol(dev, ptr, col) \ - { \ - gx_color_value rgb[3]; \ - (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \ - PICT_RGBFgCol(ptr, rgb[0], rgb[1], rgb[2]); \ - } - -#define GSSetBkCol(dev, ptr, col) \ - { \ - gx_color_value rgb[3]; \ - (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \ - PICT_RGBBkCol(ptr, rgb[0], rgb[1], rgb[2]); \ - } - -#endif /* gdevmacpictop_INCLUDED */ diff --git a/devices/gdevmacttf.h b/devices/gdevmacttf.h deleted file mode 100644 index 703a5a615..000000000 --- a/devices/gdevmacttf.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2001-2012 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, - CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - -/* Datatypes for simpler access to data structures in TrueType fonts */ - -#ifndef gdevmacttf_INCLUDED -# define gdevmacttf_INCLUDED - -/* Font Directory Component */ - -typedef struct { - UInt32 tagName; - UInt32 checkSum; - UInt32 offset; - UInt32 length; -} TTFontDirComponent; - -/* Font Directory */ - -typedef struct { - UInt32 version; - UInt16 numTables; - UInt16 searchRange; - UInt16 entrySelector; - UInt16 rangeShift; - TTFontDirComponent components[1]; /* an array of numTables components */ -} TTFontDir; - -/* Tag definitions */ -#define TTF_FONT_NAMING_TABLE 'name' - -/* Font Naming Table */ - -typedef struct { - UInt16 formatSelector; - UInt16 numNames; - UInt16 stringAreaOffset; - UInt16 platformID; - UInt16 platformSpecificID; - UInt16 languageID; - UInt16 nameID; - UInt16 length; - UInt16 offset; -} TTFontNamingTable; - -#endif /* gdevmacttf_INCLUDED */ diff --git a/doc/Develop.htm b/doc/Develop.htm index 8a20acc16..0079f6cbc 100644 --- a/doc/Develop.htm +++ b/doc/Develop.htm @@ -4538,14 +4538,6 @@ Unix files: <dt> Macintosh files: <dd> -<a href="../devices/gdevmac.c">devices/gdevmac.c</a>, -<a href="../devices/gdevmac.h">devices/gdevmac.h</a>, -<a href="../devices/gdevmacpictop.h">devices/gdevmacpictop.h</a>, -<a href="../devices/gdevmacttf.h">devices/gdevmacttf.h</a>, -<a href="../base/gp_mac.c">base/gp_mac.c</a>, -<a href="../base/gp_mac.h">base/gp_mac.h</a>, -<a href="../base/gp_macio.c">base/gp_macio.c</a>, -<a href="../base/gp_macpoll.c">base/gp_macpoll.c</a>, <a href="../base/gsiomacres.c">base/gsiomacres.c</a>, <a href="../base/macgenmcpxml.sh">base/macgenmcpxml.sh</a>, <a href="../base/macsystypes.h">base/macsystypes.h</a>, diff --git a/toolbin/tests/check_comments.py b/toolbin/tests/check_comments.py index 738591dfe..00d5e002b 100755 --- a/toolbin/tests/check_comments.py +++ b/toolbin/tests/check_comments.py @@ -100,8 +100,6 @@ checkDirs = [ 'dwuninst.h', 'gdevhpij.c', 'dmmain.c', - 'gdevmac.c', - 'gdevmacxf.c', 'gdevwdib.c', 'gp_mac.c', 'gp_macio.c', diff --git a/windows/ghostscript.vcproj b/windows/ghostscript.vcproj index 68bd8ae56..eddf22377 100644 --- a/windows/ghostscript.vcproj +++ b/windows/ghostscript.vcproj @@ -5822,10 +5822,6 @@ > </File> <File - RelativePath="..\devices\gdevmac.c" - > - </File> - <File RelativePath="..\devices\gdevmeds.c" > </File> @@ -6294,18 +6290,6 @@ > </File> <File - RelativePath="..\devices\gdevmac.h" - > - </File> - <File - RelativePath="..\devices\gdevmacpictop.h" - > - </File> - <File - RelativePath="..\devices\gdevmacttf.h" - > - </File> - <File RelativePath="..\devices\gdevmeds.h" > </File> diff --git a/windows/ghostscript_rt.vcxproj b/windows/ghostscript_rt.vcxproj index 268345c40..1bc6cc974 100644 --- a/windows/ghostscript_rt.vcxproj +++ b/windows/ghostscript_rt.vcxproj @@ -1430,7 +1430,6 @@ <ClCompile Include="..\devices\gdevlbp8.c" /> <ClCompile Include="..\devices\gdevlp8k.c" /> <ClCompile Include="..\devices\gdevlxm.c" /> - <ClCompile Include="..\devices\gdevmac.c" /> <ClCompile Include="..\devices\gdevmeds.c" /> <ClCompile Include="..\devices\gdevmgr.c" /> <ClCompile Include="..\devices\gdevmiff.c" /> @@ -2197,9 +2196,6 @@ <ClInclude Include="..\devices\gdevdsp.h" /> <ClInclude Include="..\devices\gdevdsp2.h" /> <ClInclude Include="..\devices\gdevfax.h" /> - <ClInclude Include="..\devices\gdevmac.h" /> - <ClInclude Include="..\devices\gdevmacpictop.h" /> - <ClInclude Include="..\devices\gdevmacttf.h" /> <ClInclude Include="..\devices\gdevmeds.h" /> <ClInclude Include="..\devices\gdevmgr.h" /> <ClInclude Include="..\devices\gdevmswn.h" /> |