//--------------------------------------------------------------------// // M e t h o d // // p a t t e r n D e f i n e D p i 6 0 0 // //--------------------------------------------------------------------// // // // Define 600 dots-per-inch user-defined patterns to match the // // pre-defined patterns. // // The format 20 pattern header defines X & Y resolutions, which we // // are setting to 600 dots-per-inch. // // // //--------------------------------------------------------------------// private static void patternDefineDpi600(BinaryWriter prnWriter, Int32 baseID) { const UInt16 dpi = 600; Byte[] hddrFmt_20 = { 0x14, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x10, 0x02, 0x58, 0x02, 0x58 }; for (Int32 i = 0; i < _patternsCt; i++) { hddrFmt_20[4] = (Byte)((_patternHeights[i] & 0xff00) >> 8); hddrFmt_20[5] = (Byte)(_patternHeights[i] & 0x00ff); hddrFmt_20[6] = (Byte)((_patternWidths[i] & 0xff00) >> 8); hddrFmt_20[7] = (Byte)(_patternWidths[i] & 0x00ff); hddrFmt_20[8] = (Byte)((dpi & 0xff00) >> 8); hddrFmt_20[9] = (Byte)(dpi & 0x00ff); hddrFmt_20[10] = (Byte)((dpi & 0xff00) >> 8); hddrFmt_20[11] = (Byte)(dpi & 0x00ff); PCLWriter.patternDefine( prnWriter, (Int16)(baseID + _patternIds[i]), hddrFmt_20, PCLPatternDefs.getBytes( PCLPatternDefs.eType.CrossHatch, i)); } }
//--------------------------------------------------------------------// // M e t h o d // // p a t t e r n D e f i n e D p i 6 0 0 // //--------------------------------------------------------------------// // // // Define 600 dots-per-inch user-defined patterns to match the // // pre-defined patterns. // // // //--------------------------------------------------------------------// private static void patternDefineDpi600(BinaryWriter prnWriter, Int32 baseID) { const UInt16 dpi = 600; for (Int32 i = 0; i < _patternsCt; i++) { UInt16 patWidth = _patternWidths[i]; UInt16 patHeight = _patternHeights[i]; UInt16 destWidth = (UInt16)((patWidth * _unitsPerInch) / dpi); UInt16 destHeight = (UInt16)((patHeight * _unitsPerInch) / dpi); PCLXLWriter.patternDefine( prnWriter, false, (Int16)(baseID + _patternIds[i]), patWidth, patHeight, destWidth, destHeight, PCLXLAttrEnums.eVal.eIndexedPixel, PCLXLAttrEnums.eVal.e1Bit, PCLXLAttrEnums.eVal.eTempPattern, PCLXLAttrEnums.eVal.eNoCompression, PCLPatternDefs.getBytes( PCLPatternDefs.eType.CrossHatch, i)); } }
//--------------------------------------------------------------------// // M e t h o d // // p a t t e r n D e f i n e D p i 3 0 0 // //--------------------------------------------------------------------// // // // Define default user-defined patterns to match the pre-defined // // patterns. // // The format 0 pattern header does not define a resolution, so (we // // assume) that the pattern will use the default 300 dots-per-inch. // // // //--------------------------------------------------------------------// private static void patternDefineDpi300(BinaryWriter prnWriter, Int32 baseID) { Byte[] hddrFmt_0 = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x10 }; for (Int32 i = 0; i < _patternsCt; i++) { hddrFmt_0[4] = (Byte)((_patternHeights[i] & 0xff00) >> 8); hddrFmt_0[5] = (Byte)(_patternHeights[i] & 0x00ff); hddrFmt_0[6] = (Byte)((_patternWidths[i] & 0xff00) >> 8); hddrFmt_0[7] = (Byte)(_patternWidths[i] & 0x00ff); PCLWriter.patternDefine( prnWriter, (Int16)(baseID + _patternIds[i]), hddrFmt_0, PCLPatternDefs.getBytes( PCLPatternDefs.eType.CrossHatch, i)); } }
//--------------------------------------------------------------------// // M e t h o d // // g e t P a t t e r n D a t a // //--------------------------------------------------------------------// // // // Retrieve information about the available cross-hatch patterns. // // // //--------------------------------------------------------------------// private static void getPatternData() { _patternsCt = PCLPatternDefs.getCount( PCLPatternDefs.eType.CrossHatch); _patternIds = new UInt16[_patternsCt]; _patternHeights = new UInt16[_patternsCt]; _patternWidths = new UInt16[_patternsCt]; _patternDescs = new String[_patternsCt]; for (Int32 i = 0; i < _patternsCt; i++) { _patternIds[i] = PCLPatternDefs.getId( PCLPatternDefs.eType.CrossHatch, i); _patternHeights[i] = PCLPatternDefs.getHeight( PCLPatternDefs.eType.CrossHatch, i); _patternWidths[i] = PCLPatternDefs.getWidth( PCLPatternDefs.eType.CrossHatch, i); _patternDescs[i] = PCLPatternDefs.getDesc( PCLPatternDefs.eType.CrossHatch, i); } }