/* ciitestpcl5printmodel.c */
/* Michael Plass, October 29, 1993 1:48 pm PDT */

/* ---------------------------------
Date: 27-Oct-93 16:35:34 PDT
Subject: would you like a test case for testing CII←MakeSampledBlack and CII←MaskBitmap?
Message-ID: Originator: "Shiva Golbahar:ESCP10:Xerox", UniqueString: "27-Oct-93 16:35:34 PDT"
To: Plass:PARC
Reply-To: Shiva Golbahar
From: Shiva Golbahar:ESCP10:Xerox

Received: by jahan.cp10.es.xerox.com (4.1/SMI-4.1) id AA03016; Wed, 27 Oct 93 16:35:33 PDT

Michael,

I used the following to test the 4 PCL5 print models.  Thought you might like to add it to your test cases in /printing10.1/CII.

Shiva...
--------------------------------- */

#include "cii.h"
#include "cii←matrix.h"
#define NULL ((void*)0)
#define NIL ((void*)0)

unsigned char patternBits[] = {
    0x00, 0x00, 0x00, 0x7F,
    0x00, 0x00, 0x00, 0x7F,
    0x00, 0x00, 0x00, 0x7F,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00
    };
    
unsigned char sourceBits[] = {
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x07, 0xF0,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00	
  };
  
extern void
run←pcl5printmodel(CII←Handle h)
{

  float m[6];
  float save[6];
  CII←RectangleRep rect1 = {0.0, 0.0, 150.0, 150.0};
  CII←RectangleRep rect2 = {150.0, 150.0, 150.0, 150.0};
  
  CII←RasterRep pattern = {
    0, 0,
    7, 7,
    1,
    32,
    (long *)patternBits,
    32-7,
    (void*)0
    };
    
  CII←RasterRep source = {
    0, 0,
    15, 15,
    1,
    32,
    (long *)sourceBits,
    32-15,
    (void*)0
    };
  CII←Boolean clear;
  CII←Color color;
  CII←Color white;
  float delta = 34.0;
  float pixel[1];
  
  CII←ColorOperator co = NULL;
  CII←SampleRange sampleRange;
  
  sampleRange.sWhite = 1.0;
  sampleRange.sBlack = 0.0;
  pixel[0] = 1.0;
  CII←MakeGrayColorOperator(h, &sampleRange, 0, NULL, &co);
  CII←MakeColor(h, co, 1, pixel, &white);
  
  CII←GetMatrix(h, m);
  CII←GetMatrix(h, save);
  CIU←ApplyPreTranslate(300.0, 300.0, m);
  CII←SetMatrix(h, m);
  CII←MaskRectangle(h, &rect1);
  CII←MaskRectangle(h, &rect2);
  CIU←ApplyPreTranslate(10.0*delta, 0.0, m);
  CII←SetMatrix(h, m);
  CII←MaskRectangle(h, &rect1);
  CII←MaskRectangle(h, &rect2);
  CIU←ApplyPreTranslate(0.0, 10.0*delta, m);
  CII←SetMatrix(h, m);
  CII←MaskRectangle(h, &rect1);
  CII←MaskRectangle(h, &rect2);
  CIU←ApplyPreTranslate(-10.0*delta, 0.0, m);
  CII←SetMatrix(h, m);
  CII←MaskRectangle(h, &rect1);
  CII←MaskRectangle(h, &rect2);
  CIU←ApplyPreTranslate(0.0, -10.0*delta, m);
  
  
  CIU←ApplyPreScale(10.0, m);
  CII←SetMatrix(h, m);
  /* InkMix = opaque; MaskMix = transparent       (lower left) */
  clear = 0;
  CII←MakeSampledBlack(h, &pattern, save, clear, &color);
  CII←SetColor(h, color);
  CIU←ApplyPreTranslate(7.5, 7.5, m);
  CII←SetMatrix(h, m); 
  CII←MaskBitmap(h, &source, NIL);
  
  /* InkMix = transparent; MaskMix = transparent (lower right) */
  clear = 1;
  CII←MakeSampledBlack(h, &pattern, save, clear, &color);
  CII←SetColor(h, color);
  CIU←ApplyPreTranslate(delta, 0.0, m);
  CII←SetMatrix(h, m); 
  CII←MaskBitmap(h, &source, NIL);
  
  /* InkMix = opaque; MaskMix = opaque           (upper right) */
  clear = 0;
  CII←MakeSampledBlack(h, &pattern, save, clear, &color);
  CII←SetColor(h, color);
  CIU←ApplyPreTranslate(0.0, delta, m);
  CII←SetMatrix(h, m); 
  CII←MaskBitmap(h, &source, white);
  
  /* InkMix = transparent; MaskMix = opaque      (upper left) */
  clear = 1;
  CII←MakeSampledBlack(h, &pattern, save, clear, &color);
  CII←SetColor(h, color);
  CIU←ApplyPreTranslate(-delta, 0.0, m);
  CII←SetMatrix(h, m); 
  CII←MaskBitmap(h, &source, white);
  
}

CII←RES
XR←run←ciitestpcl5printmodel()
{
  CII←Handle dev = (CII←Handle)CII←TestDevice();
  float t[6];
  CII←GetInitialMatrix(dev, t);
  CIU←ApplyPreTranslate(-280.0, -200.0, t);
  CII←SetMatrix(dev, t);
  run←pcl5printmodel(dev);
  return CII←Destroy(dev);
}