[Pixelle-commit] SF.net SVN: pixelle: [104] trunk/pixelle/src/com/mebigfatguy/pixelle/eval/ Pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-28 22:27:33
|
Revision: 104
http://pixelle.svn.sourceforge.net/pixelle/?rev=104&view=rev
Author: dbrosius
Date: 2008-06-28 15:27:39 -0700 (Sat, 28 Jun 2008)
Log Message:
-----------
rename to 4ByteABGR
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java (from rev 97, trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java 2008-06-28 22:27:39 UTC (rev 104)
@@ -0,0 +1,81 @@
+/*
+ * pixelle - Graphics algorithmic editor
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.pixelle.eval;
+
+import com.mebigfatguy.pixelle.OutOfBoundsOption;
+import com.mebigfatguy.pixelle.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEval3ByteABGR extends PixelleEval {
+
+ public PixelleEval3ByteABGR(PixelleImage srcImage, OutOfBoundsOption option) {
+ super(srcImage, option);
+ }
+
+ @Override
+ public double getTransparencyValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 4 + x * 4);
+ }
+
+ @Override
+ public double getBlueValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 4 + x * 4 + 1);
+ }
+
+ @Override
+ public double getGreenValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 4 + x * 4 + 2);
+ }
+
+ @Override
+ public double getRedValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 4 + x * 4 + 3);
+ }
+
+ public void setValue(int x, int y, char pixelSpec, double value) {
+
+ if (value < 0.0)
+ value = 0.0;
+ else if (value > 255.0)
+ value = 255.0;
+
+ switch (pixelSpec) {
+ case 't':
+ buffer.setElem(y * width * 4 + x * 4, (int)(value + 0.49));
+ break;
+
+ case 'b':
+ buffer.setElem(y * width * 4 + x * 4 + 1, (int)(value + 0.49));
+ break;
+
+ case 'g':
+ buffer.setElem(y * width * 4 + x * 4 + 2, (int)(value + 0.49));
+ break;
+
+ case 'r':
+ buffer.setElem(y * width * 4 + x * 4 + 3, (int)(value + 0.49));
+ break;
+
+ case 's':
+ setSelectionValue(x, y, value);
+ break;
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|