亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cptexturepalette.java

?? this is best wamp jkbkgnkldjkb jkfbjdksgkjl bjkgsbkjfdb gjdsblkj gbfkjsd
?? JAVA
字號:
/*
	ChibiPaint
    Copyright (c) 2006-2008 Marc Schefer

    This file is part of ChibiPaint.

    ChibiPaint is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ChibiPaint is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ChibiPaint. If not, see <http://www.gnu.org/licenses/>.

 */

package chibipaint.gui;

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;

import javax.swing.*;

import chibipaint.*;
import chibipaint.engine.*;

public class CPTexturePalette extends CPPalette {

	Vector<CPGreyBmp> textures = new Vector();
	CPGreyBmp selectedTexture, processedTexture;
	
	CPOptionsPanel optionsPanel;
	boolean mirror=false, inverse=false;
	float brightness=0f, contrast=0f;

	public CPTexturePalette(CPController controller) {
		super(controller);
		title = "Textures";

		makeProceduralTextures();
		loadTextures("textures32.png", 32, 32, 2);

		setLayout(new BorderLayout());

		// options panel

		optionsPanel = new CPOptionsPanel();

		add(optionsPanel, BorderLayout.WEST);

		// texture panel

		CPScrollableFlowPanel texturesPanel = new CPScrollableFlowPanel();

		JButton button = new CPTextureButton();
		button.setAction(new CPTextureButtonAction(null));
		texturesPanel.add(button);

		for (CPGreyBmp texture : textures) {
			button = new CPTextureButton();
			button.setAction(new CPTextureButtonAction(texture));
			texturesPanel.add(button);
		}

		add(texturesPanel.wrapInScrollPane(), BorderLayout.CENTER);
	}

	void makeProceduralTextures() {
		CPGreyBmp texture = new CPGreyBmp(2, 2);
		texture.data[0] = (byte) 255;
		texture.data[3] = (byte) 255;
		textures.add(texture);

		textures.add(makeDotTexture(2));
		textures.add(makeDotTexture(3));
		textures.add(makeDotTexture(4));
		textures.add(makeDotTexture(6));
		textures.add(makeDotTexture(8));

		textures.add(makeVertLinesTexture(1, 2));
		textures.add(makeVertLinesTexture(2, 4));

		textures.add(makeHorizLinesTexture(1, 2));
		textures.add(makeHorizLinesTexture(2, 4));

		textures.add(makeCheckerBoardTexture(2));
		textures.add(makeCheckerBoardTexture(4));
		textures.add(makeCheckerBoardTexture(8));
		textures.add(makeCheckerBoardTexture(16));
	}

	void loadTextures(String textureFilename, int width, int height, int nb) {
		Image img = controller.loadImage(textureFilename);

		// block until image is loaded
		MediaTracker tracker = new MediaTracker(this);
		tracker.addImage(img, 0);
		try {
			tracker.waitForAll();
		} catch (Exception ignored) {
		}

		int[] data = new int[width * height];

		for (int i = 0; i < nb; i++) {
			PixelGrabber grabber = new PixelGrabber(img, 0, i * height, width, height, data, 0, width);
			try {
				grabber.grabPixels();
			} catch (InterruptedException e) {
			}

			CPGreyBmp texture = new CPGreyBmp(width, height);
			for (int j = 0; j < width * height; j++) {
				texture.data[j] = (byte) (data[j] & 0xff);
			}

			textures.add(texture);
		}
	}

	CPGreyBmp makeDotTexture(int size) {
		CPGreyBmp texture = new CPGreyBmp(size, size);
		for (int i = 1; i < size * size; i++) {
			texture.data[i] = (byte) 255;
		}
		return texture;
	}

	CPGreyBmp makeCheckerBoardTexture(int size) {
		int textureSize = 2*size;
		CPGreyBmp texture = new CPGreyBmp(textureSize, textureSize);
		for (int i = 0; i < textureSize; i++) {
			for (int j = 0; j < textureSize; j++) {
				texture.data[i + j * textureSize] = (((i / size) + (j / size)) % 2 == 0) ? (byte) 0 : (byte) 255;
			}
		}
		return texture;
	}

	CPGreyBmp makeVertLinesTexture(int lineSize, int size) {
		CPGreyBmp texture = new CPGreyBmp(size, size);
		for (int i = 0; i < size * size; i++) {
			if (i % size >= lineSize) {
				texture.data[i] = (byte) 255;
			}
		}
		return texture;
	}

	CPGreyBmp makeHorizLinesTexture(int lineSize, int size) {
		CPGreyBmp texture = new CPGreyBmp(size, size);
		for (int i = 0; i < size * size; i++) {
			if (i / size >= lineSize) {
				texture.data[i] = (byte) 255;
			}
		}
		return texture;
	}
	
	void selectTexture(CPGreyBmp texture) {
		selectedTexture = texture;
		processTexture();
	}
	
	void processTexture() {
		if (selectedTexture != null) {
			processedTexture = new CPGreyBmp(selectedTexture);
			
			if (mirror) {
				processedTexture.mirrorHorizontally();
			}

			CPLookUpTable lut = new CPLookUpTable(brightness, contrast);
			
			if (inverse) {
				lut.inverse();
			}
			
			processedTexture.applyLUT(lut);
		}
		else {
			processedTexture = null;
		}
		
		controller.getArtwork().brushManager.setTexture(processedTexture);
		if (optionsPanel != null) {
			optionsPanel.repaint();
		}
	}
	
	Image createTextureImage(CPGreyBmp texture, int width, int height) {
		int[] buffer = new int[width * height];
		for (int i = 0; i < width * height; i++) {
			buffer[i] = texture.data[texture.getWidth() * (i / width % texture.getHeight()) + (i % width % texture.getWidth())];
			buffer[i] = 0xff << 24 | (buffer[i] & 0xff) << 16 | (buffer[i] & 0xff) << 8	| (buffer[i] & 0xff);
		}
		return createImage(new MemoryImageSource(width, height, buffer, 0, width));
	}
	
	class CPTextureButton extends JButton {

		private static final int width = 32;
		private static final int height = 32;

		public CPTextureButton() {
			super("Test");
		}

		protected void paintComponent(Graphics g) {
			Graphics2D g2d = (Graphics2D) g.create();

			if (getAction() instanceof CPTextureButtonAction) {
				CPGreyBmp texture = ((CPTextureButtonAction) getAction()).texture;

				if (texture != null) {
					g2d.drawImage(createTextureImage(texture, width, height), 0, 0, null);
				} else {
					g2d.setColor(Color.white);
					g2d.fill(new Rectangle(width, height));
				}
			}
		}

		public Dimension getPreferredSize() {
			return new Dimension(width, height);
		}

		public Dimension getMaximumSize() {
			return getPreferredSize();
		}

		public Dimension getMinimumSize() {
			return getPreferredSize();
		}
	}

	class CPTextureButtonAction extends AbstractAction {
		CPGreyBmp texture;

		public CPTextureButtonAction(CPGreyBmp texture) {
			this.texture = texture;
		}

		public void actionPerformed(ActionEvent e) {
			selectTexture(texture);
		}
	}
	
	class CPOptionsPanel extends JPanel {
		final static int width = 120;
		final static int height = 200;
		final static int previewSize = 64;

		private JCheckBox cbInverse;
		private JCheckBox cbMirror;
		private CPSlider slBrightness;
		private CPSlider slContrast;
		
		public CPOptionsPanel() {
			
			Box vb = Box.createVerticalBox();
			vb.setBorder(BorderFactory.createEmptyBorder(80, 5, 5, 5));
			
			cbInverse = new JCheckBox("Inverse");
			cbInverse.setAlignmentX(Component.LEFT_ALIGNMENT);
			cbInverse.addActionListener( new AbstractAction() {
				public void actionPerformed(ActionEvent e) {
					inverse = ((JCheckBox) e.getSource()).isSelected();
					processTexture();
				}
			});
			vb.add(cbInverse);
			
			cbMirror = new JCheckBox("Mirror");
			cbMirror.setAlignmentX(Component.LEFT_ALIGNMENT);
			cbMirror.addActionListener( new AbstractAction() {
				public void actionPerformed(ActionEvent e) {
					mirror = ((JCheckBox) e.getSource()).isSelected();
					processTexture();
				}
			});
			vb.add(cbMirror);

			slBrightness = new CPSlider(200) {
				public void onValueChange() {
					brightness = (value - 100) / 100f;
					title = "Brightness: " + (value - 100) + "%";
					processTexture();
				}
			};
			slBrightness.centerMode = true;
			slBrightness.setPreferredSize(new Dimension(100, 16));
			slBrightness.setValue(100);

			Box b = Box.createHorizontalBox();
			b.add(slBrightness);
			b.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
			vb.add(b);
			

			slContrast = new CPSlider(200) {
				public void onValueChange() {
					contrast = (value - 100) / 100f;
					title = "Contrast: " + (value - 100) + "%";
					processTexture();
				}
			};
			slContrast.centerMode = true;
			slContrast.setPreferredSize(new Dimension(20, 16));
			slContrast.setValue(100);

			b = Box.createHorizontalBox();
			b.add(slContrast);
			b.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
			vb.add(b);
			
			JButton resetButton = new JButton("reset");
			resetButton.setPreferredSize(new Dimension(40, 16));
			resetButton.addActionListener(new AbstractAction() {
				public void actionPerformed(ActionEvent e) {
					if (cbInverse.isSelected()) {
						cbInverse.doClick();
					}
					if (cbMirror.isSelected()) {
						cbMirror.doClick();
					}
					slBrightness.setValue(100);
					slContrast.setValue(100);
				}
			});
			vb.add(resetButton);

			add(vb);
		}

		public Dimension getPreferredSize() {
			return new Dimension(width, height);
		}

		protected void paintComponent(Graphics g) {
			super.paintComponent(g);

			Graphics2D g2d = (Graphics2D) g.create();
			
			int previewX = (width - previewSize) / 2;
			int previewY = 10;
			
			g2d.draw(new Rectangle(previewX-3, previewY-3, previewSize+5, previewSize+5));
			if (processedTexture != null) {
				g2d.drawImage(createTextureImage(processedTexture, previewSize, previewSize), previewX, previewY, null);
			} else {
				g2d.setColor(Color.white);
				g2d.fill(new Rectangle(previewX, previewY, previewSize, previewSize));
			}
			
		}

	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天av天天翘天天综合网色鬼国产| 精品国产一区二区三区不卡| 国产亚洲成av人在线观看导航| 一区二区三区电影在线播| 国产一区二区三区黄视频| 欧美色成人综合| 一区二区三区成人| www.一区二区| 成人欧美一区二区三区白人| 国产在线精品视频| 日韩一级黄色片| 亚洲成年人网站在线观看| 91精品1区2区| 亚洲一区二区三区不卡国产欧美 | 91丝袜美女网| 亚洲欧洲中文日韩久久av乱码| 黑人巨大精品欧美一区| 日韩欧美国产成人一区二区| 午夜国产精品一区| 欧美一区二区三区四区五区| 天堂av在线一区| 欧美一区二区三区在线电影| 亚洲国产一二三| 欧美人狂配大交3d怪物一区| 日韩激情中文字幕| 欧美电影免费观看完整版| 久久se这里有精品| 久久精品视频在线免费观看 | 日韩手机在线导航| 黄网站免费久久| 国产日韩欧美精品一区| 91免费看视频| 亚洲国产日韩综合久久精品| 欧美一二三四区在线| 紧缚奴在线一区二区三区| 国产精品污污网站在线观看| 色综合 综合色| 天天综合色天天| 久久精品一区二区三区四区| 风间由美一区二区三区在线观看| 国产精品精品国产色婷婷| 欧美系列一区二区| 国产乱色国产精品免费视频| 亚洲欧洲综合另类| 欧美一区二区三区在线观看| 北岛玲一区二区三区四区| 天天av天天翘天天综合网| 久久女同精品一区二区| 欧美色偷偷大香| 99国产精品久久久久| 蜜桃av噜噜一区二区三区小说| 国产精品水嫩水嫩| 日韩欧美一二三四区| 91亚洲精品一区二区乱码| 韩国女主播成人在线| 亚洲综合av网| 亚洲丝袜制服诱惑| 欧美激情一区在线观看| 91精品国产综合久久小美女| 91黄色免费观看| 成人久久久精品乱码一区二区三区| 蜜芽一区二区三区| 午夜成人免费视频| 亚洲图片一区二区| 亚洲视频免费在线| 中文字幕中文乱码欧美一区二区 | 欧美日韩一本到| 91美女在线观看| 99久免费精品视频在线观看 | 久久婷婷色综合| 精品美女一区二区| 精品久久久网站| 久久视频一区二区| 日韩欧美电影在线| 欧美一区二区三区色| 欧美性猛交xxxx黑人交| 色国产综合视频| 在线亚洲一区观看| 91久久精品一区二区| 欧美天堂一区二区三区| 欧美日韩免费不卡视频一区二区三区| 在线日韩国产精品| 色偷偷成人一区二区三区91| 色中色一区二区| 欧美在线观看18| 777午夜精品免费视频| 欧美mv日韩mv亚洲| 精品国产自在久精品国产| 国产欧美日韩激情| 中文字幕一区二区三中文字幕| 伊人性伊人情综合网| 五月天亚洲精品| 国产精品一卡二卡| 色综合久久久久| 日韩视频国产视频| 日本一区二区综合亚洲| 一区二区三区欧美视频| 青青草原综合久久大伊人精品 | 国产99久久久精品| 91高清在线观看| 欧美不卡一区二区三区| 中文字幕精品在线不卡| 亚洲18女电影在线观看| 极品少妇xxxx精品少妇偷拍| 99久久婷婷国产综合精品电影| 欧美专区在线观看一区| 久久久久久免费网| 午夜欧美2019年伦理| 国产成人在线免费| 欧美视频你懂的| ●精品国产综合乱码久久久久| 日本中文字幕一区二区有限公司| 丰满亚洲少妇av| 精品剧情在线观看| 午夜欧美视频在线观看| 91在线视频官网| 国产亚洲成年网址在线观看| 肉色丝袜一区二区| 一本大道av一区二区在线播放| 久久在线免费观看| 爽好多水快深点欧美视频| 成人一级视频在线观看| 日韩三级免费观看| 婷婷综合在线观看| 欧美在线|欧美| 亚洲综合免费观看高清完整版在线| 粉嫩欧美一区二区三区高清影视| 精品国产人成亚洲区| 日韩高清不卡在线| 3d动漫精品啪啪一区二区竹菊 | 91香蕉国产在线观看软件| 国产曰批免费观看久久久| 欧美日韩一级二级| 亚洲国产精品激情在线观看| 国产成人高清视频| 久久综合色天天久久综合图片| 精品系列免费在线观看| 久久亚洲综合色一区二区三区| 黄色成人免费在线| 国产欧美综合在线| 成人国产一区二区三区精品| 国产精品久久综合| 一本一道综合狠狠老| 亚洲综合色视频| 日韩一区二区三免费高清| 蜜臀va亚洲va欧美va天堂| 欧美一级欧美三级| 国产成人午夜99999| 国产精品电影一区二区三区| 色狠狠色狠狠综合| 日本麻豆一区二区三区视频| 精品国产sm最大网站免费看| 成人黄色在线看| 一区二区三区免费看视频| 91精品国产入口| 国产一区二区三区在线观看精品| 国产蜜臀av在线一区二区三区| 色综合久久中文字幕综合网| 欧美aaaaaa午夜精品| 国产色产综合产在线视频| 欧美日韩视频一区二区| 精品一区二区三区香蕉蜜桃| 亚洲欧美经典视频| 欧美一级在线视频| 99精品视频一区二区| 免费看日韩精品| 亚洲一区二区成人在线观看| 久久午夜老司机| 欧美一卡2卡三卡4卡5免费| 99久久久无码国产精品| 老汉av免费一区二区三区| 亚洲欧美另类在线| 国产亚洲一本大道中文在线| 欧美精品 国产精品| 91福利区一区二区三区| 狠狠色狠狠色合久久伊人| 首页国产欧美久久| 亚洲欧美日韩一区二区| 久久综合九色综合97婷婷女人 | 亚洲高清一区二区三区| 国产精品亲子伦对白| 久久久国产一区二区三区四区小说| 欧美日韩国产综合一区二区 | 99久久伊人网影院| 国产麻豆精品久久一二三| 久久精品国产网站| 亚洲国产sm捆绑调教视频| 亚洲精品亚洲人成人网| 亚洲视频免费在线观看| 亚洲女人的天堂| 最新欧美精品一区二区三区| 国产欧美精品一区二区色综合朱莉| 精品av综合导航| 久久精品夜夜夜夜久久| 国产亚洲人成网站| 中文字幕精品—区二区四季| 日本一区二区三区国色天香| 国产精品日韩成人| 1000部国产精品成人观看| 最新不卡av在线|