2004-04-09 09:05:39 -04:00
|
|
|
/* ====================================================================
|
2006-12-22 14:18:16 -05:00
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
2004-04-09 09:05:39 -04:00
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==================================================================== */
|
2009-05-19 15:21:12 -04:00
|
|
|
|
2004-04-09 07:45:38 -04:00
|
|
|
package org.apache.poi.ddf;
|
|
|
|
|
2012-05-02 10:00:46 -04:00
|
|
|
import org.apache.poi.util.HexDump;
|
|
|
|
|
2004-04-09 07:45:38 -04:00
|
|
|
/**
|
|
|
|
* A color property.
|
|
|
|
*/
|
|
|
|
public class EscherRGBProperty
|
|
|
|
extends EscherSimpleProperty
|
|
|
|
{
|
|
|
|
|
|
|
|
public EscherRGBProperty( short propertyNumber, int rgbColor )
|
|
|
|
{
|
2005-05-01 07:26:18 -04:00
|
|
|
super( propertyNumber, rgbColor );
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
/**
|
|
|
|
* @return the rgb color as int value
|
|
|
|
*/
|
2004-04-09 07:45:38 -04:00
|
|
|
public int getRgbColor()
|
|
|
|
{
|
2016-12-04 18:49:49 -05:00
|
|
|
return getPropertyValue();
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
/**
|
|
|
|
* @return the red part
|
|
|
|
*/
|
2004-04-09 07:45:38 -04:00
|
|
|
public byte getRed()
|
|
|
|
{
|
2016-12-04 18:49:49 -05:00
|
|
|
return (byte) ( getRgbColor() & 0xFF );
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
/**
|
|
|
|
* @return the green part
|
|
|
|
*/
|
2004-04-09 07:45:38 -04:00
|
|
|
public byte getGreen()
|
|
|
|
{
|
2016-12-04 18:49:49 -05:00
|
|
|
return (byte) ( (getRgbColor() >> 8) & 0xFF );
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
/**
|
|
|
|
* @return the blue part
|
|
|
|
*/
|
2004-04-09 07:45:38 -04:00
|
|
|
public byte getBlue()
|
|
|
|
{
|
2016-12-04 18:49:49 -05:00
|
|
|
return (byte) ( (getRgbColor() >> 16) & 0xFF );
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
@Override
|
2012-05-02 10:00:46 -04:00
|
|
|
public String toXml(String tab){
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId()))
|
|
|
|
.append("\" name=\"").append(getName()).append("\" blipId=\"")
|
2016-12-04 18:49:49 -05:00
|
|
|
.append(isBlipId()).append("\" value=\"0x").append(HexDump.toHex(getRgbColor())).append("\"/>\n");
|
2012-05-02 10:00:46 -04:00
|
|
|
return builder.toString();
|
|
|
|
}
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|