本文整理汇总了C#中Image.getHeight方法的典型用法代码示例。如果您正苦于以下问题:C# Image.getHeight方法的具体用法?C# Image.getHeight怎么用?C# Image.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: process
//@Override
public Image process(Image imageIn)
{
int r, g, b;
int[] array = new int[256];
int[] numArray = new int[imageIn.getHeight() * imageIn.getWidth()];
int contrast = (int)(this.ContrastIntensity * 255f);
int pos = 0;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
int index = (r * 0x1b36 + g * 0x5b8c + b * 0x93e) >> 15;
array[index]++;
numArray[pos] = index;
pos++;
}
}
for (int i = 1; i < 0x100; i++)
{
array[i] += array[i - 1];
}
for (int i = 0; i < 0x100; i++)
{
array[i] = (array[i] << 8) / imageIn.getHeight() * imageIn.getWidth();
array[i] = ((contrast * array[i]) >> 8) + (((0xff - contrast) * i) >> 8);
}
pos = 0;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
if (numArray[pos] != 0)
{
int num = array[numArray[pos]];
r = (r * num) / numArray[pos];
g = (g * num) / numArray[pos];
b = (b * num) / numArray[pos];
r = (r > 0xff) ? ((byte)0xff) : ((r < 0) ? ((byte)0) : ((byte)r));
g = (g > 0xff) ? ((byte)0xff) : ((g < 0) ? ((byte)0) : ((byte)g));
b = (b > 0xff) ? ((byte)0xff) : ((b < 0) ? ((byte)0) : ((byte)b));
}
imageIn.setPixelColor(x, y, r, g, b);
pos++;
}
}
return imageIn;
}
示例2: process
public Image process(Image imageIn)
{
int r, g, b, a;
for (int x = 0; x < (imageIn.getWidth() - 1); x++)
{
for (int y = 0; y < (imageIn.getHeight() - 1); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
int nMod = 0;
if (_direct) // horizontal direction
nMod = y % _width;
else if (_direct == false) // vertical direction
nMod = x % _width;
double fDelta = 255.0 * (_opacity / 100.0) / (_width - 1.0);
a = Function.FClamp0255(nMod * fDelta);
int colorR = _color & 0xFF0000 >> 16;
int colorG = _color & 0x00FF00 >> 8;
int colorB = _color & 0x0000FF;
if (_color == 0xFF)
{
imageIn.setPixelColor(x, y, colorR, colorG, colorB);
continue;
}
if (a == 0)
continue;
int t = 0xFF - a;
imageIn.setPixelColor(x, y, (colorR * a + r * t) / 0xFF, (colorG * a + g * t) / 0xFF, (colorB * a + b * t) / 0xFF);
}
}
return imageIn;
}
示例3: process
public Image process(Image imageIn)
{
int height = imageIn.getHeight();
int width = imageIn.getWidth();
int color, color2;
if (IsHorizontal)
{
for (int y = 0; y < height; y++)
{
for (int x = 0; x < (width / 2); x++)
{
color = imageIn.getPixelColor(x, y);
color2 = imageIn.getPixelColor(width - 1 - x, y);
imageIn.setPixelColor(width - 1 - x, y, color);
imageIn.setPixelColor(x, y, color2);
}
}
}
else
{
for (int x = 0; x < width; x++)
{
for (int y = 0; y < (height / 2); y++)
{
color = imageIn.getPixelColor(x, y);
color2 = imageIn.getPixelColor(x, height - 1 - y);
imageIn.setPixelColor(x, height - 1 - y, color);
imageIn.setPixelColor(x, y, color2);
}
}
}
return imageIn;
}
示例4: process
public Image process(Image imageIn)
{
int height = imageIn.getHeight();
int width = imageIn.getWidth();
Image clone = imageIn.clone();
imageIn.clearImage(0xffffff);
//拉普拉斯模板
int[] Laplacian = new int[] { -1, -1, -1, -1, 8 + _step, -1, -1, -1, -1 };
for (int x = 1; x < width - 1; x++)
{
for (int y = 1; y < height - 1; y++)
{
int r = 0, g = 0, b = 0;
int Index = 0;
for (int col = -1; col <= 1; col++)
{
for (int row = -1; row <= 1; row++)
{
int rr = clone.getRComponent(x + row, y + col);
int gg = clone.getGComponent(x + row, y + col);
int bb = clone.getBComponent(x + row, y + col);
r += rr * Laplacian[Index];
g += gg * Laplacian[Index];
b += bb * Laplacian[Index];
Index++;
}
}
imageIn.setPixelColor(x - 1, y - 1, Image.SAFECOLOR(r), Image.SAFECOLOR(g), Image.SAFECOLOR(b));
}
}
return imageIn;
}
示例5: process
public Image process(Image imageIn)
{
int mix1 = (int)(Mixture * 255f);
int mix2 = 255 - mix1;
int r, g, b, r1, g1, b1;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
int xx = x % pattern.getWidth();
int yy = y % pattern.getHeight();
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
r1 = Image.SAFECOLOR(r + pattern.getRComponent(xx, yy));
g1 = Image.SAFECOLOR(g + pattern.getGComponent(xx, yy));
b1 = Image.SAFECOLOR(b + pattern.getBComponent(xx, yy));
r = (r * mix2) + (r1 * mix1);
g = (g * mix2) + (g1 * mix1);
b = (b * mix2) + (b1 * mix1);
imageIn.setPixelColor(x, y, r >> 8, g >> 8, b >> 8);
}
}
return imageIn;
}
示例6: process
//@Override
public Image process(Image imageIn)
{
int width = imageIn.getWidth();
int height = imageIn.getHeight();
Image clone = imageIn.clone();
int r = 0, g = 0, b = 0;
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
int k = NoiseFilter.getRandomInt(1, 123456);
//像素块大小
int dx = x + k % 19;
int dy = y + k % 19;
if (dx >= width)
{
dx = width - 1;
}
if (dy >= height)
{
dy = height - 1;
}
r = clone.getRComponent(dx, dy);
g = clone.getGComponent(dx, dy);
b = clone.getBComponent(dx, dy);
imageIn.setPixelColor(x, y, r, g, b);
}
}
return imageIn;
}
示例7: drawTone
private void drawTone(int a_x, int a_y, Image imageIn)
{
int l_grayIntensity;
int l_x;
int l_y;
for (int x = 0; x < DOT_AREA * DOT_AREA; x++)
{
l_x = x % DOT_AREA;
l_y = x / DOT_AREA;
if (a_x + l_x < imageIn.getWidth() && a_y + l_y < imageIn.getHeight())
{
l_grayIntensity = 255 - (imageIn.getRComponent(a_x + l_x, a_y + l_y));
if (l_grayIntensity > arrDither[x])
{
imageIn.setPixelColor(a_x + l_x, a_y + l_y, 0, 0, 0);
}
else
{
imageIn.setPixelColor(a_x + l_x, a_y + l_y, 255, 255, 255);
}
}
}
}
示例8: process
public Image process(Image imageIn)
{
int r, g, b;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
int d = 0;
if (((y - 1) % _size == 0) && (x % _size > 0) && ((x + 1) % _size > 0))
d = -_depth; // top
else if (((y + 2) % _size == 0) && (x % _size > 0) && ((x + 1) % _size > 0))
d = _depth; // bottom
else if (((x - 1) % _size == 0) && (y % _size > 0) && ((y + 1) % _size) > 0)
d = _depth; // left
else if (((x + 2) % _size == 0) && (y % _size > 0) && ((y + 1) % _size) > 0)
d = -_depth; // right
imageIn.setPixelColor(x, y, Image.SAFECOLOR(r + d), Image.SAFECOLOR(g + d), Image.SAFECOLOR(b + d));
}
}
return imageIn;
}
示例9: process
//@Override
public Image process(Image imageIn)
{
float saturation = this.SaturationFactor + 1f;
float negosaturation = 1f - saturation;
int r, g, b, a;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
float nego1 = negosaturation * 0.2126f;
float ngeo2 = nego1 + saturation;
float ngeo3 = negosaturation * 0.7152f;
float nego4 = ngeo3 + saturation;
float nego5 = negosaturation * 0.0722f;
float nego6 = nego5 + saturation;
float nego7 = ((r * ngeo2) + (g * ngeo3)) + (b * nego5);
float nego8 = ((r * nego1) + (g * nego4)) + (b * nego5);
float nego9 = ((r * nego1) + (g * ngeo3)) + (b * nego6);
r = (nego7 > 255f) ? ((byte)255f) : ((nego7 < 0f) ? ((byte)0f) : ((byte)nego7));
g = (nego8 > 255f) ? ((byte)255f) : ((nego8 < 0f) ? ((byte)0f) : ((byte)nego8));
b = (nego9 > 255f) ? ((byte)255f) : ((nego9 < 0f) ? ((byte)0f) : ((byte)nego9));
imageIn.setPixelColor(x, y, r, g, b);
}
}
return imageIn;
}
示例10: process
//@Override
public Image process(Image imageIn)
{
int r, g, b, a = 20;
int width = imageIn.getWidth();
int height = imageIn.getHeight();
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
int cr;
if ((x < _size) && (y < height - x) && (y >= x))
cr = Image.rgb(255, 255, 65); // left
else if ((y < _size) && (x < width - y) && (x >= y))
cr = Image.rgb(255, 255, 120); // top
else if ((x > width - _size) && (y >= width - x) && (y < height + x - width))
cr = Image.rgb(0, 0, 65); // right
else if (y > height - _size)
cr = Image.rgb(0, 0, 120); // bottom
else
continue;
int colorR = cr & 0xFF0000 >> 16;
int colorG = cr & 0x00FF00 >> 8;
int colorB = cr & 0x0000FF;
int t = 0xFF - a;
imageIn.setPixelColor(x, y, (colorR * a + r * t) / 0xFF, (colorG * a + g * t) / 0xFF, (colorB * a + b * t) / 0xFF);
}
}
return imageIn;
}
示例11: ProcessColor
private Image ProcessColor(int k00, int k01, int k02, int k20, int k21, int k22, Image imageIn, int thresholdSq)
{
int width = imageIn.getWidth();
int height = imageIn.getHeight();
int r, g, b;
Image clone = imageIn.clone();
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
int color1 = GetPixelColor(clone, x - 1, y - 1, width, height);
int color2 = GetPixelColor(clone, x, y - 1, width, height);
int color3 = GetPixelColor(clone, x + 1, y - 1, width, height);
int color4 = GetPixelColor(clone, x - 1, y, width, height);
int color5 = GetPixelColor(clone, x + 1, y, width, height);
int color6 = GetPixelColor(clone, x - 1, y + 1, width, height);
int color7 = GetPixelColor(clone, x, y + 1, width, height);
int color8 = GetPixelColor(clone, x + 1, y + 1, width, height);
int color1RGB = (0x00FF0000 & color1) >> 16;
int color3RGB = (0x00FF0000 & color3) >> 16;
int color6RGB = (0x00FF0000 & color6) >> 16;
int color8RGB = (0x00FF0000 & color8) >> 16;
int colorSum1 = (color1RGB * k00 + color3RGB * k02 + ((0x00FF0000 & color2) >> 16) * k01 + color6RGB * k20 + ((0x00FF0000 & color7) >> 16) * k21 + color8RGB * k22) >> 8;
int colorSum2 = (color1RGB * k00 + color3RGB * k20 + ((0x00FF0000 & color4) >> 16) * k01 + color6RGB * k02 + ((0x00FF0000 & color5) >> 16) * k21 + color8RGB * k22) >> 8;
r = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
if (this.DoInversion)
{
r = 255 - r;
}
color1RGB = (0x0000FF00 & color1) >> 8;
color3RGB = (0x0000FF00 & color3) >> 8;
color6RGB = (0x0000FF00 & color6) >> 8;
color8RGB = (0x0000FF00 & color8) >> 8;
colorSum1 = (color1RGB * k00 + color3RGB * k02 + ((0x0000FF00 & color2) >> 8) * k01 + color6RGB * k20 + ((0x0000FF00 & color7) >> 8) * k21 + color8RGB * k22) >> 8;
colorSum2 = (color1RGB * k00 + color3RGB * k20 + ((0x0000FF00 & color4) >> 8) * k01 + color6RGB * k02 + ((0x0000FF00 & color5) >> 8) * k21 + color8RGB * k22) >> 8;
g = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
if (this.DoInversion)
{
g = 255 - g;
}
color1RGB = 0x000000FF & color1;
color3RGB = 0x000000FF & color3;
color6RGB = 0x000000FF & color6;
color8RGB = 0x000000FF & color8;
colorSum1 = (color1RGB * k00 + color3RGB * k02 + (0x000000FF & color2) * k01 + color6RGB * k20 + (0x000000FF & color7) * k21 + color8RGB * k22) >> 8;
colorSum2 = (color1RGB * k00 + color3RGB * k20 + (0x000000FF & color4) * k01 + color6RGB * k02 + (0x000000FF & color5) * k21 + color8RGB * k22) >> 8;
b = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
if (DoInversion)
{
b = 255 - b;
}
imageIn.setPixelColor(x, y, r, g, b);
}
}
return imageIn;
}
示例12: process
//@Override
public Image process(Image imageIn)
{
int r, g, b;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y += 3)
{
r = 0;
g = 0;
b = 0;
for (int w = 0; w < 3; w++)
{
if (y + w < imageIn.getHeight())
{
r += (imageIn.getRComponent(x, y + w)) / 2;
g += (imageIn.getGComponent(x, y + w)) / 2;
b += (imageIn.getBComponent(x, y + w)) / 2;
}
}
r = getValidInterval(r);
g = getValidInterval(g);
b = getValidInterval(b);
for (int w = 0; w < 3; w++)
{
if (y + w < imageIn.getHeight())
{
if (w == 0)
{
imageIn.setPixelColor(x, y + w, r, 0, 0);
}
else if (w == 1)
{
imageIn.setPixelColor(x, y + w, 0, g, 0);
}
else if (w == 2)
{
imageIn.setPixelColor(x, y + w, 0, 0, b);
}
}
}
}
}
return imageIn;
}
示例13: process
//@Override
public Image process(Image imageIn)
{
int r, g, b;
// Convert to integer factors
int bfi = (int)(BrightnessFactor * 255);
float cf = 1f + ContrastFactor;
cf *= cf;
int cfi = (int)(cf * 32768) + 1;
for (int x = 0; x < imageIn.getWidth(); x++)
{
for (int y = 0; y < imageIn.getHeight(); y++)
{
r = imageIn.getRComponent(x, y);
g = imageIn.getGComponent(x, y);
b = imageIn.getBComponent(x, y);
// Modify brightness (addition)
if (bfi != 0)
{
// Add brightness
int ri = r + bfi;
int gi = g + bfi;
int bi = b + bfi;
// Clamp to byte boundaries
r = (byte)(ri > 255 ? 255 : (ri < 0 ? 0 : ri));
g = (byte)(gi > 255 ? 255 : (gi < 0 ? 0 : gi));
b = (byte)(bi > 255 ? 255 : (bi < 0 ? 0 : bi));
}
// Modifiy contrast (multiplication)
if (cfi != 32769)
{
// Transform to range [-128, 127]
int ri = r - 128;
int gi = g - 128;
int bi = b - 128;
// Multiply contrast factor
ri = (ri * cfi) >> 15;
gi = (gi * cfi) >> 15;
bi = (bi * cfi) >> 15;
// Transform back to range [0, 255]
ri = ri + 128;
gi = gi + 128;
bi = bi + 128;
// Clamp to byte boundaries
r = (byte)(ri > 255 ? 255 : (ri < 0 ? 0 : ri));
g = (byte)(gi > 255 ? 255 : (gi < 0 ? 0 : gi));
b = (byte)(bi > 255 ? 255 : (bi < 0 ? 0 : bi));
}
imageIn.setPixelColor(x, y, r, g, b);
}
}
return imageIn;
}
示例14: process
//@Override
public Image process(Image imageIn)
{
for (int x = 0; x < imageIn.getWidth(); x += DOT_AREA)
{
for (int y = 0; y < imageIn.getHeight(); y += DOT_AREA)
{
drawTone(x, y, imageIn);
}
}
return imageIn;
}
示例15: fillRect
/**
* Method to extrapolate out
*
* @param imageIn
* @param a_x
* @param a_y
* @param squareSize
* @param a_rgb
*/
private void fillRect(Image imageIn, int a_x, int a_y, int squareSize, int a_rgb)
{
for (int x = a_x; x < a_x + squareSize; x++)
{
for (int y = a_y; y < a_y + squareSize; y++)
{
if (x < imageIn.getWidth() && y < imageIn.getHeight())
{
imageIn.setPixelColor(x, y, a_rgb);
}
}
}
}