Java tutorial
/* * Copyright (C) 2014 team-cachebox.de * * Licensed under the : GNU General Public License (GPL); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.gnu.org/licenses/gpl.html * * 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 CB_UI_Base.graphics; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap.Format; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; /** * @author Longri */ public class SolidTextureRegion extends TextureRegion { public SolidTextureRegion(Color color, float width, float height) { Pixmap pix = new Pixmap(2, 2, Format.RGB565); pix.setColor(color); pix.fill(); Texture tex = new Texture(pix); pix.dispose(); this.setRegion(tex); setRegion(0, 0, width, height); } }