xref: /aoo42x/main/basebmp/test/tools.cxx (revision 69de5a4c)
1*69de5a4cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*69de5a4cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*69de5a4cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*69de5a4cSAndrew Rist  * distributed with this work for additional information
6*69de5a4cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*69de5a4cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*69de5a4cSAndrew Rist  * "License"); you may not use this file except in compliance
9*69de5a4cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*69de5a4cSAndrew Rist  *
11*69de5a4cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*69de5a4cSAndrew Rist  *
13*69de5a4cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*69de5a4cSAndrew Rist  * software distributed under the License is distributed on an
15*69de5a4cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*69de5a4cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*69de5a4cSAndrew Rist  * specific language governing permissions and limitations
18*69de5a4cSAndrew Rist  * under the License.
19*69de5a4cSAndrew Rist  *
20*69de5a4cSAndrew Rist  *************************************************************/
21*69de5a4cSAndrew Rist 
22*69de5a4cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // autogenerated file with codegen.pl
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <basegfx/vector/b2isize.hxx>
27cdf0e10cSrcweir #include <basegfx/point/b2ipoint.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <basebmp/color.hxx>
30cdf0e10cSrcweir #include <basebmp/bitmapdevice.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir using namespace ::basebmp;
33cdf0e10cSrcweir 
countPixel(const BitmapDeviceSharedPtr & rDevice,Color checkColor)34cdf0e10cSrcweir int countPixel( const BitmapDeviceSharedPtr& rDevice,
35cdf0e10cSrcweir                 Color                        checkColor )
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     int count(0);
38cdf0e10cSrcweir     const basegfx::B2ISize& rSize( rDevice->getSize() );
39cdf0e10cSrcweir     for( sal_Int32 y=0; y<rSize.getY(); ++y )
40cdf0e10cSrcweir         for( sal_Int32 x=0; x<rSize.getX(); ++x )
41cdf0e10cSrcweir             if( rDevice->getPixel( basegfx::B2IPoint(x,y) ) == checkColor )
42cdf0e10cSrcweir                 ++count;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     return count;
45cdf0e10cSrcweir }
46