merge the formfield patch from ooo-build
[ooovba.git] / basebmp / test / tools.cxx
blob9357af0ab9557674112bdc9ea2db28e04c47a9b6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tools.cxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // autogenerated file with codegen.pl
33 #include <basegfx/vector/b2isize.hxx>
34 #include <basegfx/point/b2ipoint.hxx>
36 #include <basebmp/color.hxx>
37 #include <basebmp/bitmapdevice.hxx>
39 using namespace ::basebmp;
41 int countPixel( const BitmapDeviceSharedPtr& rDevice,
42 Color checkColor )
44 int count(0);
45 const basegfx::B2ISize& rSize( rDevice->getSize() );
46 for( sal_Int32 y=0; y<rSize.getY(); ++y )
47 for( sal_Int32 x=0; x<rSize.getX(); ++x )
48 if( rDevice->getPixel( basegfx::B2IPoint(x,y) ) == checkColor )
49 ++count;
51 return count;