All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pepstock.charba.client.colors.tiles.CrossDash Maven / Gradle / Ivy

There is a newer version: 6.5-gwt
Show newest version
/**
    Copyright 2017 Andrea "Stock" Stocchero

    Licensed 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

	    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.
*/
package org.pepstock.charba.client.colors.tiles;

import org.pepstock.charba.client.dom.elements.Context2dItem;

/**
 * CROSSDASH drawer to design a cross - dash into tile.
* It designs a cross and a dash into the following tile sections (A and B):
*
* *
 * +---------+---------+
 * |         |         |
 * |    A    |         |
 * |         |         |
 * +---------+---------+
 * |         |         |
 * |         |    B    |
 * |         |         |
 * +---------+---------+
 * 
* * @author Andrea "Stock" Stocchero * */ final class CrossDash extends ShapeDrawer { // cross instance private final Cross cross = new Cross(); // dash instance private final Dash dash = new Dash(); /* * (non-Javadoc) * * @see org.pepstock.charba.client.colors.tiles.ShapeDrawer#drawTile(org.pepstock.charba.client.dom.Context2dItem, java.lang.String, java.lang.String, int) */ @Override protected void drawTile(Context2dItem context, String backgroundColor, String shapeColor, int size) { // calculates half dimension final double halfSize = size / 2D; // apply the stroke properties applyStrokeProperties(context, shapeColor, size); // designs the shape (CROSS) into A section cross.drawCross(context, size, 0D, 0D); // designs the shape (DASH) into B section dash.drawDash(context, size, halfSize, halfSize); // draws the current path with the current stroke style context.stroke(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy