xref: /trunk/main/basebmp/test/tools.cxx (revision 69de5a4c)
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 
24 // autogenerated file with codegen.pl
25 
26 #include <basegfx/vector/b2isize.hxx>
27 #include <basegfx/point/b2ipoint.hxx>
28 
29 #include <basebmp/color.hxx>
30 #include <basebmp/bitmapdevice.hxx>
31 
32 using namespace ::basebmp;
33 
countPixel(const BitmapDeviceSharedPtr & rDevice,Color checkColor)34 int countPixel( const BitmapDeviceSharedPtr& rDevice,
35                 Color                        checkColor )
36 {
37     int count(0);
38     const basegfx::B2ISize& rSize( rDevice->getSize() );
39     for( sal_Int32 y=0; y<rSize.getY(); ++y )
40         for( sal_Int32 x=0; x<rSize.getX(); ++x )
41             if( rDevice->getPixel( basegfx::B2IPoint(x,y) ) == checkColor )
42                 ++count;
43 
44     return count;
45 }
46