1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 /* 23 * ImageComparison.java 24 * 25 * Created on 23. September 2003, 17:40 26 */ 27 28 package integration.forms; 29 30 /** 31 * 32 * @author fs93730 33 */ 34 public final class ImageComparison implements com.sun.star.awt.XImageConsumer 35 { 36 37 private byte[] m_referenceBytes; 38 private int m_referencePosition; 39 private java.io.FileOutputStream m_stream; 40 private Object m_notifyDone; 41 imagesEqual( )42 public boolean imagesEqual( ) 43 { 44 return m_referencePosition == m_referenceBytes.length; 45 } 46 47 /** Creates a new instance of ImageComparison */ ImageComparison( byte[] referenceBytes, Object toNotify )48 public ImageComparison( byte[] referenceBytes, Object toNotify ) 49 { 50 m_referenceBytes = referenceBytes; 51 m_referencePosition = 0; 52 m_notifyDone = toNotify; 53 } 54 complete(int param, com.sun.star.awt.XImageProducer xImageProducer)55 public void complete(int param, com.sun.star.awt.XImageProducer xImageProducer) 56 { 57 synchronized( m_notifyDone ) 58 { 59 m_notifyDone.notify(); 60 } 61 } 62 init(int param, int param1)63 public void init(int param, int param1) 64 { 65 } 66 setColorModel(short param, int[] values, int param2, int param3, int param4, int param5)67 public void setColorModel(short param, int[] values, int param2, int param3, int param4, int param5) 68 { 69 } 70 setPixelsByBytes(int param, int param1, int param2, int param3, byte[] values, int param5, int param6)71 public void setPixelsByBytes(int param, int param1, int param2, int param3, byte[] values, int param5, int param6) 72 { 73 if ( m_referencePosition == -1 ) 74 // already failed 75 return; 76 77 int i = 0; 78 while ( ( m_referencePosition < m_referenceBytes.length ) && ( i < values.length ) ) 79 { 80 if ( m_referenceBytes[ m_referencePosition ] != values[ i ] ) 81 { 82 m_referencePosition = -1; 83 break; 84 } 85 ++i; 86 ++m_referencePosition; 87 } 88 } 89 setPixelsByLongs(int param, int param1, int param2, int param3, int[] values, int param5, int param6)90 public void setPixelsByLongs(int param, int param1, int param2, int param3, int[] values, int param5, int param6) 91 { 92 } 93 94 } 95