repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
enioka/jqm
jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java
JdbcClient.getStringPredicate
private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms) { if (filterValues != null && !filterValues.isEmpty()) { String res = ""; for (String filterValue : filterValues) { if (filterValue == null) { continue; } if (!filterValue.isEmpty()) { prms.add(filterValue); if (filterValue.contains("%")) { res += String.format("(%s LIKE ?) OR ", fieldName); } else { res += String.format("(%s = ?) OR ", fieldName); } } else { res += String.format("(%s IS NULL OR %s = '') OR ", fieldName, fieldName); } } if (!res.isEmpty()) { res = "AND (" + res.substring(0, res.length() - 4) + ") "; return res; } } return ""; }
java
private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms) { if (filterValues != null && !filterValues.isEmpty()) { String res = ""; for (String filterValue : filterValues) { if (filterValue == null) { continue; } if (!filterValue.isEmpty()) { prms.add(filterValue); if (filterValue.contains("%")) { res += String.format("(%s LIKE ?) OR ", fieldName); } else { res += String.format("(%s = ?) OR ", fieldName); } } else { res += String.format("(%s IS NULL OR %s = '') OR ", fieldName, fieldName); } } if (!res.isEmpty()) { res = "AND (" + res.substring(0, res.length() - 4) + ") "; return res; } } return ""; }
[ "private", "String", "getStringPredicate", "(", "String", "fieldName", ",", "List", "<", "String", ">", "filterValues", ",", "List", "<", "Object", ">", "prms", ")", "{", "if", "(", "filterValues", "!=", "null", "&&", "!", "filterValues", ".", "isEmpty", "...
GetJob helper - String predicates are all created the same way, so this factors some code.
[ "GetJob", "helper", "-", "String", "predicates", "are", "all", "created", "the", "same", "way", "so", "this", "factors", "some", "code", "." ]
391733b8e291404b97c714c3727a241c4a861f98
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java#L1099-L1134
train
enioka/jqm
jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java
DbAdapter.prepare
public void prepare(Properties p, Connection cnx) { this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", ""); queries.putAll(DbImplBase.queries); for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet()) { queries.put(entry.getKey(), this.adaptSql(entry.getValue())); } }
java
public void prepare(Properties p, Connection cnx) { this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", ""); queries.putAll(DbImplBase.queries); for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet()) { queries.put(entry.getKey(), this.adaptSql(entry.getValue())); } }
[ "public", "void", "prepare", "(", "Properties", "p", ",", "Connection", "cnx", ")", "{", "this", ".", "tablePrefix", "=", "p", ".", "getProperty", "(", "\"com.enioka.jqm.jdbc.tablePrefix\"", ",", "\"\"", ")", ";", "queries", ".", "putAll", "(", "DbImplBase", ...
Called after creating the first connection. The adapter should create its caches and do all initialization it requires. Most importantly, the SQL query cache should be created. @param cnx an open ready to use connection to the database.
[ "Called", "after", "creating", "the", "first", "connection", ".", "The", "adapter", "should", "create", "its", "caches", "and", "do", "all", "initialization", "it", "requires", ".", "Most", "importantly", "the", "SQL", "query", "cache", "should", "be", "create...
391733b8e291404b97c714c3727a241c4a861f98
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java#L94-L102
train
Angads25/android-filepicker
filepicker/src/main/java/com/github/angads25/filepicker/utils/ExtensionFilter.java
ExtensionFilter.accept
@Override public boolean accept(File file) { //All directories are added in the least that can be read by the Application if (file.isDirectory()&&file.canRead()) { return true; } else if(properties.selection_type==DialogConfigs.DIR_SELECT) { /* True for files, If the selection type is Directory type, ie. * Only directory has to be selected from the list, then all files are * ignored. */ return false; } else { /* Check whether name of the file ends with the extension. Added if it * does. */ String name = file.getName().toLowerCase(Locale.getDefault()); for (String ext : validExtensions) { if (name.endsWith(ext)) { return true; } } } return false; }
java
@Override public boolean accept(File file) { //All directories are added in the least that can be read by the Application if (file.isDirectory()&&file.canRead()) { return true; } else if(properties.selection_type==DialogConfigs.DIR_SELECT) { /* True for files, If the selection type is Directory type, ie. * Only directory has to be selected from the list, then all files are * ignored. */ return false; } else { /* Check whether name of the file ends with the extension. Added if it * does. */ String name = file.getName().toLowerCase(Locale.getDefault()); for (String ext : validExtensions) { if (name.endsWith(ext)) { return true; } } } return false; }
[ "@", "Override", "public", "boolean", "accept", "(", "File", "file", ")", "{", "//All directories are added in the least that can be read by the Application", "if", "(", "file", ".", "isDirectory", "(", ")", "&&", "file", ".", "canRead", "(", ")", ")", "{", "retur...
Function to filter files based on defined rules.
[ "Function", "to", "filter", "files", "based", "on", "defined", "rules", "." ]
46fd8825e6d88c69462078a0300d905739a803ea
https://github.com/Angads25/android-filepicker/blob/46fd8825e6d88c69462078a0300d905739a803ea/filepicker/src/main/java/com/github/angads25/filepicker/utils/ExtensionFilter.java#L49-L74
train
omadahealth/SwipyRefreshLayout
lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java
SwipyRefreshLayout.setSize
public void setSize(int size) { if (size != MaterialProgressDrawable.LARGE && size != MaterialProgressDrawable.DEFAULT) { return; } final DisplayMetrics metrics = getResources().getDisplayMetrics(); if (size == MaterialProgressDrawable.LARGE) { mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER_LARGE * metrics.density); } else { mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density); } // force the bounds of the progress circle inside the circle view to // update by setting it to null before updating its size and then // re-setting it mCircleView.setImageDrawable(null); mProgress.updateSizes(size); mCircleView.setImageDrawable(mProgress); }
java
public void setSize(int size) { if (size != MaterialProgressDrawable.LARGE && size != MaterialProgressDrawable.DEFAULT) { return; } final DisplayMetrics metrics = getResources().getDisplayMetrics(); if (size == MaterialProgressDrawable.LARGE) { mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER_LARGE * metrics.density); } else { mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density); } // force the bounds of the progress circle inside the circle view to // update by setting it to null before updating its size and then // re-setting it mCircleView.setImageDrawable(null); mProgress.updateSizes(size); mCircleView.setImageDrawable(mProgress); }
[ "public", "void", "setSize", "(", "int", "size", ")", "{", "if", "(", "size", "!=", "MaterialProgressDrawable", ".", "LARGE", "&&", "size", "!=", "MaterialProgressDrawable", ".", "DEFAULT", ")", "{", "return", ";", "}", "final", "DisplayMetrics", "metrics", ...
One of DEFAULT, or LARGE.
[ "One", "of", "DEFAULT", "or", "LARGE", "." ]
890e92d7f2779dce85d3358093135d6b3be58986
https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L246-L262
train
omadahealth/SwipyRefreshLayout
lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java
SwipyRefreshLayout.setRefreshing
public void setRefreshing(boolean refreshing) { if (refreshing && mRefreshing != refreshing) { // scale and show mRefreshing = refreshing; int endTarget = 0; if (!mUsingCustomStart) { switch (mDirection) { case BOTTOM: endTarget = getMeasuredHeight() - (int) (mSpinnerFinalOffset); break; case TOP: default: endTarget = (int) (mSpinnerFinalOffset - Math.abs(mOriginalOffsetTop)); break; } } else { endTarget = (int) mSpinnerFinalOffset; } setTargetOffsetTopAndBottom(endTarget - mCurrentTargetOffsetTop, true /* requires update */); mNotify = false; startScaleUpAnimation(mRefreshListener); } else { setRefreshing(refreshing, false /* notify */); } }
java
public void setRefreshing(boolean refreshing) { if (refreshing && mRefreshing != refreshing) { // scale and show mRefreshing = refreshing; int endTarget = 0; if (!mUsingCustomStart) { switch (mDirection) { case BOTTOM: endTarget = getMeasuredHeight() - (int) (mSpinnerFinalOffset); break; case TOP: default: endTarget = (int) (mSpinnerFinalOffset - Math.abs(mOriginalOffsetTop)); break; } } else { endTarget = (int) mSpinnerFinalOffset; } setTargetOffsetTopAndBottom(endTarget - mCurrentTargetOffsetTop, true /* requires update */); mNotify = false; startScaleUpAnimation(mRefreshListener); } else { setRefreshing(refreshing, false /* notify */); } }
[ "public", "void", "setRefreshing", "(", "boolean", "refreshing", ")", "{", "if", "(", "refreshing", "&&", "mRefreshing", "!=", "refreshing", ")", "{", "// scale and show", "mRefreshing", "=", "refreshing", ";", "int", "endTarget", "=", "0", ";", "if", "(", "...
Notify the widget that refresh state has changed. Do not call this when refresh is triggered by a swipe gesture. @param refreshing Whether or not the view should show refresh progress.
[ "Notify", "the", "widget", "that", "refresh", "state", "has", "changed", ".", "Do", "not", "call", "this", "when", "refresh", "is", "triggered", "by", "a", "swipe", "gesture", "." ]
890e92d7f2779dce85d3358093135d6b3be58986
https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L361-L386
train
omadahealth/SwipyRefreshLayout
lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java
SwipyRefreshLayout.setAnimationProgress
private void setAnimationProgress(float progress) { if (isAlphaUsedForScale()) { setColorViewAlpha((int) (progress * MAX_ALPHA)); } else { ViewCompat.setScaleX(mCircleView, progress); ViewCompat.setScaleY(mCircleView, progress); } }
java
private void setAnimationProgress(float progress) { if (isAlphaUsedForScale()) { setColorViewAlpha((int) (progress * MAX_ALPHA)); } else { ViewCompat.setScaleX(mCircleView, progress); ViewCompat.setScaleY(mCircleView, progress); } }
[ "private", "void", "setAnimationProgress", "(", "float", "progress", ")", "{", "if", "(", "isAlphaUsedForScale", "(", ")", ")", "{", "setColorViewAlpha", "(", "(", "int", ")", "(", "progress", "*", "MAX_ALPHA", ")", ")", ";", "}", "else", "{", "ViewCompat"...
Pre API 11, this does an alpha animation. @param progress
[ "Pre", "API", "11", "this", "does", "an", "alpha", "animation", "." ]
890e92d7f2779dce85d3358093135d6b3be58986
https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L415-L422
train
omadahealth/SwipyRefreshLayout
lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java
SwipyRefreshLayout.setProgressBackgroundColor
public void setProgressBackgroundColor(int colorRes) { mCircleView.setBackgroundColor(colorRes); mProgress.setBackgroundColor(getResources().getColor(colorRes)); }
java
public void setProgressBackgroundColor(int colorRes) { mCircleView.setBackgroundColor(colorRes); mProgress.setBackgroundColor(getResources().getColor(colorRes)); }
[ "public", "void", "setProgressBackgroundColor", "(", "int", "colorRes", ")", "{", "mCircleView", ".", "setBackgroundColor", "(", "colorRes", ")", ";", "mProgress", ".", "setBackgroundColor", "(", "getResources", "(", ")", ".", "getColor", "(", "colorRes", ")", "...
Set the background color of the progress spinner disc. @param colorRes Resource id of the color.
[ "Set", "the", "background", "color", "of", "the", "progress", "spinner", "disc", "." ]
890e92d7f2779dce85d3358093135d6b3be58986
https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L485-L488
train
omadahealth/SwipyRefreshLayout
lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java
SwipyRefreshLayout.setRawDirection
private void setRawDirection(SwipyRefreshLayoutDirection direction) { if (mDirection == direction) { return; } mDirection = direction; switch (mDirection) { case BOTTOM: mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight(); break; case TOP: default: mCurrentTargetOffsetTop = mOriginalOffsetTop = -mCircleView.getMeasuredHeight(); break; } }
java
private void setRawDirection(SwipyRefreshLayoutDirection direction) { if (mDirection == direction) { return; } mDirection = direction; switch (mDirection) { case BOTTOM: mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight(); break; case TOP: default: mCurrentTargetOffsetTop = mOriginalOffsetTop = -mCircleView.getMeasuredHeight(); break; } }
[ "private", "void", "setRawDirection", "(", "SwipyRefreshLayoutDirection", "direction", ")", "{", "if", "(", "mDirection", "==", "direction", ")", "{", "return", ";", "}", "mDirection", "=", "direction", ";", "switch", "(", "mDirection", ")", "{", "case", "BOTT...
only TOP or Bottom
[ "only", "TOP", "or", "Bottom" ]
890e92d7f2779dce85d3358093135d6b3be58986
https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L1136-L1151
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java
PixelTools.uniform
public static boolean uniform(Color color, Pixel[] pixels) { return Arrays.stream(pixels).allMatch(p -> p.toInt() == color.toRGB().toInt()); }
java
public static boolean uniform(Color color, Pixel[] pixels) { return Arrays.stream(pixels).allMatch(p -> p.toInt() == color.toRGB().toInt()); }
[ "public", "static", "boolean", "uniform", "(", "Color", "color", ",", "Pixel", "[", "]", "pixels", ")", "{", "return", "Arrays", ".", "stream", "(", "pixels", ")", ".", "allMatch", "(", "p", "->", "p", ".", "toInt", "(", ")", "==", "color", ".", "t...
Returns true if all pixels in the array have the same color
[ "Returns", "true", "if", "all", "pixels", "in", "the", "array", "have", "the", "same", "color" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java#L74-L76
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java
PixelTools.scale
public static int scale(Double factor, int pixel) { return rgb( (int) Math.round(factor * red(pixel)), (int) Math.round(factor * green(pixel)), (int) Math.round(factor * blue(pixel)) ); }
java
public static int scale(Double factor, int pixel) { return rgb( (int) Math.round(factor * red(pixel)), (int) Math.round(factor * green(pixel)), (int) Math.round(factor * blue(pixel)) ); }
[ "public", "static", "int", "scale", "(", "Double", "factor", ",", "int", "pixel", ")", "{", "return", "rgb", "(", "(", "int", ")", "Math", ".", "round", "(", "factor", "*", "red", "(", "pixel", ")", ")", ",", "(", "int", ")", "Math", ".", "round"...
Scales the brightness of a pixel.
[ "Scales", "the", "brightness", "of", "a", "pixel", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java#L81-L87
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinAttributes.java
MarvinAttributes.set
public void set(String name, Object value) { hashAttributes.put(name, value); if (plugin != null) { plugin.invalidate(); } }
java
public void set(String name, Object value) { hashAttributes.put(name, value); if (plugin != null) { plugin.invalidate(); } }
[ "public", "void", "set", "(", "String", "name", ",", "Object", "value", ")", "{", "hashAttributes", ".", "put", "(", "name", ",", "value", ")", ";", "if", "(", "plugin", "!=", "null", ")", "{", "plugin", ".", "invalidate", "(", ")", ";", "}", "}" ]
Set an attribute. @param name attribute name. @param value attribute value.
[ "Set", "an", "attribute", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinAttributes.java#L34-L40
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Spectrum.java
Spectrum.wavelengthToRGB
public static int wavelengthToRGB(float wavelength) { float gamma = 0.80f; float r, g, b, factor; int w = (int)wavelength; if (w < 380) { r = 0.0f; g = 0.0f; b = 0.0f; } else if (w < 440) { r = -(wavelength - 440) / (440 - 380); g = 0.0f; b = 1.0f; } else if (w < 490) { r = 0.0f; g = (wavelength - 440) / (490 - 440); b = 1.0f; } else if (w < 510) { r = 0.0f; g = 1.0f; b = -(wavelength - 510) / (510 - 490); } else if (w < 580) { r = (wavelength - 510) / (580 - 510); g = 1.0f; b = 0.0f; } else if (w < 645) { r = 1.0f; g = -(wavelength - 645) / (645 - 580); b = 0.0f; } else if (w <= 780) { r = 1.0f; g = 0.0f; b = 0.0f; } else { r = 0.0f; g = 0.0f; b = 0.0f; } // Let the intensity fall off near the vision limits if (380 <= w && w <= 419) factor = 0.3f + 0.7f*(wavelength - 380) / (420 - 380); else if (420 <= w && w <= 700) factor = 1.0f; else if (701 <= w && w <= 780) factor = 0.3f + 0.7f*(780 - wavelength) / (780 - 700); else factor = 0.0f; int ir = adjust(r, factor, gamma); int ig = adjust(g, factor, gamma); int ib = adjust(b, factor, gamma); return 0xff000000 | (ir << 16) | (ig << 8) | ib; }
java
public static int wavelengthToRGB(float wavelength) { float gamma = 0.80f; float r, g, b, factor; int w = (int)wavelength; if (w < 380) { r = 0.0f; g = 0.0f; b = 0.0f; } else if (w < 440) { r = -(wavelength - 440) / (440 - 380); g = 0.0f; b = 1.0f; } else if (w < 490) { r = 0.0f; g = (wavelength - 440) / (490 - 440); b = 1.0f; } else if (w < 510) { r = 0.0f; g = 1.0f; b = -(wavelength - 510) / (510 - 490); } else if (w < 580) { r = (wavelength - 510) / (580 - 510); g = 1.0f; b = 0.0f; } else if (w < 645) { r = 1.0f; g = -(wavelength - 645) / (645 - 580); b = 0.0f; } else if (w <= 780) { r = 1.0f; g = 0.0f; b = 0.0f; } else { r = 0.0f; g = 0.0f; b = 0.0f; } // Let the intensity fall off near the vision limits if (380 <= w && w <= 419) factor = 0.3f + 0.7f*(wavelength - 380) / (420 - 380); else if (420 <= w && w <= 700) factor = 1.0f; else if (701 <= w && w <= 780) factor = 0.3f + 0.7f*(780 - wavelength) / (780 - 700); else factor = 0.0f; int ir = adjust(r, factor, gamma); int ig = adjust(g, factor, gamma); int ib = adjust(b, factor, gamma); return 0xff000000 | (ir << 16) | (ig << 8) | ib; }
[ "public", "static", "int", "wavelengthToRGB", "(", "float", "wavelength", ")", "{", "float", "gamma", "=", "0.80f", ";", "float", "r", ",", "g", ",", "b", ",", "factor", ";", "int", "w", "=", "(", "int", ")", "wavelength", ";", "if", "(", "w", "<",...
Convert a wavelength to an RGB value. @param wavelength wavelength in nanometres @return the RGB value
[ "Convert", "a", "wavelength", "to", "an", "RGB", "value", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Spectrum.java#L35-L89
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ConvolveFilter.java
ConvolveFilter.convolveHV
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) { int index = 0; float[] matrix = kernel.getKernelData( null ); int rows = kernel.getHeight(); int cols = kernel.getWidth(); int rows2 = rows/2; int cols2 = cols/2; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { float r = 0, g = 0, b = 0, a = 0; for (int row = -rows2; row <= rows2; row++) { int iy = y+row; int ioffset; if (0 <= iy && iy < height) ioffset = iy*width; else if ( edgeAction == CLAMP_EDGES ) ioffset = y*width; else if ( edgeAction == WRAP_EDGES ) ioffset = ((iy+height) % height) * width; else continue; int moffset = cols*(row+rows2)+cols2; for (int col = -cols2; col <= cols2; col++) { float f = matrix[moffset+col]; if (f != 0) { int ix = x+col; if (!(0 <= ix && ix < width)) { if ( edgeAction == CLAMP_EDGES ) ix = x; else if ( edgeAction == WRAP_EDGES ) ix = (x+width) % width; else continue; } int rgb = inPixels[ioffset+ix]; a += f * ((rgb >> 24) & 0xff); r += f * ((rgb >> 16) & 0xff); g += f * ((rgb >> 8) & 0xff); b += f * (rgb & 0xff); } } } int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff; int ir = PixelUtils.clamp((int)(r+0.5)); int ig = PixelUtils.clamp((int)(g+0.5)); int ib = PixelUtils.clamp((int)(b+0.5)); outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib; } } }
java
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) { int index = 0; float[] matrix = kernel.getKernelData( null ); int rows = kernel.getHeight(); int cols = kernel.getWidth(); int rows2 = rows/2; int cols2 = cols/2; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { float r = 0, g = 0, b = 0, a = 0; for (int row = -rows2; row <= rows2; row++) { int iy = y+row; int ioffset; if (0 <= iy && iy < height) ioffset = iy*width; else if ( edgeAction == CLAMP_EDGES ) ioffset = y*width; else if ( edgeAction == WRAP_EDGES ) ioffset = ((iy+height) % height) * width; else continue; int moffset = cols*(row+rows2)+cols2; for (int col = -cols2; col <= cols2; col++) { float f = matrix[moffset+col]; if (f != 0) { int ix = x+col; if (!(0 <= ix && ix < width)) { if ( edgeAction == CLAMP_EDGES ) ix = x; else if ( edgeAction == WRAP_EDGES ) ix = (x+width) % width; else continue; } int rgb = inPixels[ioffset+ix]; a += f * ((rgb >> 24) & 0xff); r += f * ((rgb >> 16) & 0xff); g += f * ((rgb >> 8) & 0xff); b += f * (rgb & 0xff); } } } int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff; int ir = PixelUtils.clamp((int)(r+0.5)); int ig = PixelUtils.clamp((int)(g+0.5)); int ib = PixelUtils.clamp((int)(b+0.5)); outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib; } } }
[ "public", "static", "void", "convolveHV", "(", "Kernel", "kernel", ",", "int", "[", "]", "inPixels", ",", "int", "[", "]", "outPixels", ",", "int", "width", ",", "int", "height", ",", "boolean", "alpha", ",", "int", "edgeAction", ")", "{", "int", "inde...
Convolve with a 2D kernel. @param kernel the kernel @param inPixels the input pixels @param outPixels the output pixels @param width the width @param height the height @param alpha include alpha channel @param edgeAction what to do at the edges
[ "Convolve", "with", "a", "2D", "kernel", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ConvolveFilter.java#L253-L305
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java
DaisyFilter.initPixelsArray
private void initPixelsArray(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); pixels = new int[width * height]; image.getRGB(0, 0, width, height, pixels, 0, width); }
java
private void initPixelsArray(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); pixels = new int[width * height]; image.getRGB(0, 0, width, height, pixels, 0, width); }
[ "private", "void", "initPixelsArray", "(", "BufferedImage", "image", ")", "{", "int", "width", "=", "image", ".", "getWidth", "(", ")", ";", "int", "height", "=", "image", ".", "getHeight", "(", ")", ";", "pixels", "=", "new", "int", "[", "width", "*",...
takes the pixels from a BufferedImage and stores them in an array
[ "takes", "the", "pixels", "from", "a", "BufferedImage", "and", "stores", "them", "in", "an", "array" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java#L158-L164
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java
DaisyFilter.changeColor
private int[] changeColor() { int[] changedPixels = new int[pixels.length]; double frequenz = 2 * Math.PI / 1020; for (int i = 0; i < pixels.length; i++) { int argb = pixels[i]; int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; int b = argb & 0xff; r = (int) (255 * Math.sin(frequenz * r)); b = (int) (-255 * Math.cos(frequenz * b) + 255); changedPixels[i] = (a << 24) | (r << 16) | (g << 8) | b; } return changedPixels; }
java
private int[] changeColor() { int[] changedPixels = new int[pixels.length]; double frequenz = 2 * Math.PI / 1020; for (int i = 0; i < pixels.length; i++) { int argb = pixels[i]; int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; int b = argb & 0xff; r = (int) (255 * Math.sin(frequenz * r)); b = (int) (-255 * Math.cos(frequenz * b) + 255); changedPixels[i] = (a << 24) | (r << 16) | (g << 8) | b; } return changedPixels; }
[ "private", "int", "[", "]", "changeColor", "(", ")", "{", "int", "[", "]", "changedPixels", "=", "new", "int", "[", "pixels", ".", "length", "]", ";", "double", "frequenz", "=", "2", "*", "Math", ".", "PI", "/", "1020", ";", "for", "(", "int", "i...
changes the color of the image - more red and less blue @return new pixel array
[ "changes", "the", "color", "of", "the", "image", "-", "more", "red", "and", "less", "blue" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java#L171-L189
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/Orientation.java
Orientation.imageOrientationsOf
private static Set<String> imageOrientationsOf(ImageMetadata metadata) { String exifIFD0DirName = new ExifIFD0Directory().getName(); Tag[] tags = Arrays.stream(metadata.getDirectories()) .filter(dir -> dir.getName().equals(exifIFD0DirName)) .findFirst() .map(Directory::getTags) .orElseGet(() -> new Tag[0]); return Arrays.stream(tags) .filter(tag -> tag.getType() == 274) .map(Tag::getRawValue) .collect(Collectors.toSet()); }
java
private static Set<String> imageOrientationsOf(ImageMetadata metadata) { String exifIFD0DirName = new ExifIFD0Directory().getName(); Tag[] tags = Arrays.stream(metadata.getDirectories()) .filter(dir -> dir.getName().equals(exifIFD0DirName)) .findFirst() .map(Directory::getTags) .orElseGet(() -> new Tag[0]); return Arrays.stream(tags) .filter(tag -> tag.getType() == 274) .map(Tag::getRawValue) .collect(Collectors.toSet()); }
[ "private", "static", "Set", "<", "String", ">", "imageOrientationsOf", "(", "ImageMetadata", "metadata", ")", "{", "String", "exifIFD0DirName", "=", "new", "ExifIFD0Directory", "(", ")", ".", "getName", "(", ")", ";", "Tag", "[", "]", "tags", "=", "Arrays", ...
returns the values of the orientation tag
[ "returns", "the", "values", "of", "the", "orientation", "tag" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/Orientation.java#L65-L79
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java
Noise.noise1
public static float noise1(float x) { int bx0, bx1; float rx0, rx1, sx, t, u, v; if (start) { start = false; init(); } t = x + N; bx0 = ((int)t) & BM; bx1 = (bx0+1) & BM; rx0 = t - (int)t; rx1 = rx0 - 1.0f; sx = sCurve(rx0); u = rx0 * g1[p[bx0]]; v = rx1 * g1[p[bx1]]; return 2.3f*lerp(sx, u, v); }
java
public static float noise1(float x) { int bx0, bx1; float rx0, rx1, sx, t, u, v; if (start) { start = false; init(); } t = x + N; bx0 = ((int)t) & BM; bx1 = (bx0+1) & BM; rx0 = t - (int)t; rx1 = rx0 - 1.0f; sx = sCurve(rx0); u = rx0 * g1[p[bx0]]; v = rx1 * g1[p[bx1]]; return 2.3f*lerp(sx, u, v); }
[ "public", "static", "float", "noise1", "(", "float", "x", ")", "{", "int", "bx0", ",", "bx1", ";", "float", "rx0", ",", "rx1", ",", "sx", ",", "t", ",", "u", ",", "v", ";", "if", "(", "start", ")", "{", "start", "=", "false", ";", "init", "("...
Compute 1-dimensional Perlin noise. @param x the x value @return noise value at x in the range -1..1
[ "Compute", "1", "-", "dimensional", "Perlin", "noise", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java#L89-L109
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java
Noise.noise2
public static float noise2(float x, float y) { int bx0, bx1, by0, by1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, q[], sx, sy, a, b, t, u, v; int i, j; if (start) { start = false; init(); } t = x + N; bx0 = ((int)t) & BM; bx1 = (bx0+1) & BM; rx0 = t - (int)t; rx1 = rx0 - 1.0f; t = y + N; by0 = ((int)t) & BM; by1 = (by0+1) & BM; ry0 = t - (int)t; ry1 = ry0 - 1.0f; i = p[bx0]; j = p[bx1]; b00 = p[i + by0]; b10 = p[j + by0]; b01 = p[i + by1]; b11 = p[j + by1]; sx = sCurve(rx0); sy = sCurve(ry0); q = g2[b00]; u = rx0 * q[0] + ry0 * q[1]; q = g2[b10]; v = rx1 * q[0] + ry0 * q[1]; a = lerp(sx, u, v); q = g2[b01]; u = rx0 * q[0] + ry1 * q[1]; q = g2[b11]; v = rx1 * q[0] + ry1 * q[1]; b = lerp(sx, u, v); return 1.5f*lerp(sy, a, b); }
java
public static float noise2(float x, float y) { int bx0, bx1, by0, by1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, q[], sx, sy, a, b, t, u, v; int i, j; if (start) { start = false; init(); } t = x + N; bx0 = ((int)t) & BM; bx1 = (bx0+1) & BM; rx0 = t - (int)t; rx1 = rx0 - 1.0f; t = y + N; by0 = ((int)t) & BM; by1 = (by0+1) & BM; ry0 = t - (int)t; ry1 = ry0 - 1.0f; i = p[bx0]; j = p[bx1]; b00 = p[i + by0]; b10 = p[j + by0]; b01 = p[i + by1]; b11 = p[j + by1]; sx = sCurve(rx0); sy = sCurve(ry0); q = g2[b00]; u = rx0 * q[0] + ry0 * q[1]; q = g2[b10]; v = rx1 * q[0] + ry0 * q[1]; a = lerp(sx, u, v); q = g2[b01]; u = rx0 * q[0] + ry1 * q[1]; q = g2[b11]; v = rx1 * q[0] + ry1 * q[1]; b = lerp(sx, u, v); return 1.5f*lerp(sy, a, b); }
[ "public", "static", "float", "noise2", "(", "float", "x", ",", "float", "y", ")", "{", "int", "bx0", ",", "bx1", ",", "by0", ",", "by1", ",", "b00", ",", "b10", ",", "b01", ",", "b11", ";", "float", "rx0", ",", "rx1", ",", "ry0", ",", "ry1", ...
Compute 2-dimensional Perlin noise. @param x the x coordinate @param y the y coordinate @return noise value at (x,y)
[ "Compute", "2", "-", "dimensional", "Perlin", "noise", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java#L117-L159
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/LinearSubpixelInterpolator.java
LinearSubpixelInterpolator.integerPixelCoordinatesAndWeights
private List<Pair<Integer, Double>> integerPixelCoordinatesAndWeights(double d, int numPixels) { if (d <= 0.5) return Collections.singletonList(new Pair<>(0, 1.0)); else if (d >= numPixels - 0.5) return Collections.singletonList(new Pair<>(numPixels - 1, 1.0)); else { double shifted = d - 0.5; double floor = Math.floor(shifted); double floorWeight = 1 - (shifted - floor); double ceil = Math.ceil(shifted); double ceilWeight = 1 - floorWeight; assert (floorWeight + ceilWeight == 1); return Arrays.asList(new Pair<>((int) floor, floorWeight), new Pair<>((int) ceil, ceilWeight)); } }
java
private List<Pair<Integer, Double>> integerPixelCoordinatesAndWeights(double d, int numPixels) { if (d <= 0.5) return Collections.singletonList(new Pair<>(0, 1.0)); else if (d >= numPixels - 0.5) return Collections.singletonList(new Pair<>(numPixels - 1, 1.0)); else { double shifted = d - 0.5; double floor = Math.floor(shifted); double floorWeight = 1 - (shifted - floor); double ceil = Math.ceil(shifted); double ceilWeight = 1 - floorWeight; assert (floorWeight + ceilWeight == 1); return Arrays.asList(new Pair<>((int) floor, floorWeight), new Pair<>((int) ceil, ceilWeight)); } }
[ "private", "List", "<", "Pair", "<", "Integer", ",", "Double", ">", ">", "integerPixelCoordinatesAndWeights", "(", "double", "d", ",", "int", "numPixels", ")", "{", "if", "(", "d", "<=", "0.5", ")", "return", "Collections", ".", "singletonList", "(", "new"...
Operates on one dimension at a time.
[ "Operates", "on", "one", "dimension", "at", "a", "time", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/LinearSubpixelInterpolator.java#L25-L37
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.createImage
public static BufferedImage createImage(ImageProducer producer) { PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0); try { pg.grabPixels(); } catch (InterruptedException e) { throw new RuntimeException("Image fetch interrupted"); } if ((pg.status() & ImageObserver.ABORT) != 0) throw new RuntimeException("Image fetch aborted"); if ((pg.status() & ImageObserver.ERROR) != 0) throw new RuntimeException("Image fetch error"); BufferedImage p = new BufferedImage(pg.getWidth(), pg.getHeight(), BufferedImage.TYPE_INT_ARGB); p.setRGB(0, 0, pg.getWidth(), pg.getHeight(), (int[])pg.getPixels(), 0, pg.getWidth()); return p; }
java
public static BufferedImage createImage(ImageProducer producer) { PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0); try { pg.grabPixels(); } catch (InterruptedException e) { throw new RuntimeException("Image fetch interrupted"); } if ((pg.status() & ImageObserver.ABORT) != 0) throw new RuntimeException("Image fetch aborted"); if ((pg.status() & ImageObserver.ERROR) != 0) throw new RuntimeException("Image fetch error"); BufferedImage p = new BufferedImage(pg.getWidth(), pg.getHeight(), BufferedImage.TYPE_INT_ARGB); p.setRGB(0, 0, pg.getWidth(), pg.getHeight(), (int[])pg.getPixels(), 0, pg.getWidth()); return p; }
[ "public", "static", "BufferedImage", "createImage", "(", "ImageProducer", "producer", ")", "{", "PixelGrabber", "pg", "=", "new", "PixelGrabber", "(", "producer", ",", "0", ",", "0", ",", "-", "1", ",", "-", "1", ",", "null", ",", "0", ",", "0", ")", ...
Cretae a BufferedImage from an ImageProducer. @param producer the ImageProducer @return a new TYPE_INT_ARGB BufferedImage
[ "Cretae", "a", "BufferedImage", "from", "an", "ImageProducer", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L35-L49
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.convertImageToARGB
public static BufferedImage convertImageToARGB( Image image ) { if ( image instanceof BufferedImage && ((BufferedImage)image).getType() == BufferedImage.TYPE_INT_ARGB ) return (BufferedImage)image; BufferedImage p = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g = p.createGraphics(); g.drawImage( image, 0, 0, null ); g.dispose(); return p; }
java
public static BufferedImage convertImageToARGB( Image image ) { if ( image instanceof BufferedImage && ((BufferedImage)image).getType() == BufferedImage.TYPE_INT_ARGB ) return (BufferedImage)image; BufferedImage p = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g = p.createGraphics(); g.drawImage( image, 0, 0, null ); g.dispose(); return p; }
[ "public", "static", "BufferedImage", "convertImageToARGB", "(", "Image", "image", ")", "{", "if", "(", "image", "instanceof", "BufferedImage", "&&", "(", "(", "BufferedImage", ")", "image", ")", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_INT_A...
Convert an Image into a TYPE_INT_ARGB BufferedImage. If the image is already of this type, the original image is returned unchanged. @param image the image to convert @return the converted image
[ "Convert", "an", "Image", "into", "a", "TYPE_INT_ARGB", "BufferedImage", ".", "If", "the", "image", "is", "already", "of", "this", "type", "the", "original", "image", "is", "returned", "unchanged", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L56-L64
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.cloneImage
public static BufferedImage cloneImage( BufferedImage image ) { BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB ); Graphics2D g = newImage.createGraphics(); g.drawRenderedImage( image, null ); g.dispose(); return newImage; }
java
public static BufferedImage cloneImage( BufferedImage image ) { BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB ); Graphics2D g = newImage.createGraphics(); g.drawRenderedImage( image, null ); g.dispose(); return newImage; }
[ "public", "static", "BufferedImage", "cloneImage", "(", "BufferedImage", "image", ")", "{", "BufferedImage", "newImage", "=", "new", "BufferedImage", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "BufferedImage", ".", ...
Clones a BufferedImage. @param image the image to clone @return the cloned image
[ "Clones", "a", "BufferedImage", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L88-L94
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.paintCheckedBackground
public static void paintCheckedBackground(Component c, Graphics g, int x, int y, int width, int height) { if ( backgroundImage == null ) { backgroundImage = new BufferedImage( 64, 64, BufferedImage.TYPE_INT_ARGB ); Graphics bg = backgroundImage.createGraphics(); for ( int by = 0; by < 64; by += 8 ) { for ( int bx = 0; bx < 64; bx += 8 ) { bg.setColor( ((bx^by) & 8) != 0 ? Color.lightGray : Color.white ); bg.fillRect( bx, by, 8, 8 ); } } bg.dispose(); } if ( backgroundImage != null ) { Shape saveClip = g.getClip(); Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(c.getSize()); r = r.intersection(new Rectangle(x, y, width, height)); g.setClip(r); int w = backgroundImage.getWidth(); int h = backgroundImage.getHeight(); if (w != -1 && h != -1) { int x1 = (r.x / w) * w; int y1 = (r.y / h) * h; int x2 = ((r.x + r.width + w - 1) / w) * w; int y2 = ((r.y + r.height + h - 1) / h) * h; for (y = y1; y < y2; y += h) for (x = x1; x < x2; x += w) g.drawImage(backgroundImage, x, y, c); } g.setClip(saveClip); } }
java
public static void paintCheckedBackground(Component c, Graphics g, int x, int y, int width, int height) { if ( backgroundImage == null ) { backgroundImage = new BufferedImage( 64, 64, BufferedImage.TYPE_INT_ARGB ); Graphics bg = backgroundImage.createGraphics(); for ( int by = 0; by < 64; by += 8 ) { for ( int bx = 0; bx < 64; bx += 8 ) { bg.setColor( ((bx^by) & 8) != 0 ? Color.lightGray : Color.white ); bg.fillRect( bx, by, 8, 8 ); } } bg.dispose(); } if ( backgroundImage != null ) { Shape saveClip = g.getClip(); Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(c.getSize()); r = r.intersection(new Rectangle(x, y, width, height)); g.setClip(r); int w = backgroundImage.getWidth(); int h = backgroundImage.getHeight(); if (w != -1 && h != -1) { int x1 = (r.x / w) * w; int y1 = (r.y / h) * h; int x2 = ((r.x + r.width + w - 1) / w) * w; int y2 = ((r.y + r.height + h - 1) / h) * h; for (y = y1; y < y2; y += h) for (x = x1; x < x2; x += w) g.drawImage(backgroundImage, x, y, c); } g.setClip(saveClip); } }
[ "public", "static", "void", "paintCheckedBackground", "(", "Component", "c", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "if", "(", "backgroundImage", "==", "null", ")", "{", "backgroundIma...
Paint a check pattern, used for a background to indicate image transparency. @param c the component to draw into @param g the Graphics objects @param x the x position @param y the y position @param width the width @param height the height
[ "Paint", "a", "check", "pattern", "used", "for", "a", "background", "to", "indicate", "image", "transparency", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L105-L138
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.getSelectedBounds
public static Rectangle getSelectedBounds(BufferedImage p) { int width = p.getWidth(); int height = p.getHeight(); int maxX = 0, maxY = 0, minX = width, minY = height; boolean anySelected = false; int y1; int [] pixels = null; for (y1 = height-1; y1 >= 0; y1--) { pixels = getRGB( p, 0, y1, width, 1, pixels ); for (int x = 0; x < minX; x++) { if ((pixels[x] & 0xff000000) != 0) { minX = x; maxY = y1; anySelected = true; break; } } for (int x = width-1; x >= maxX; x--) { if ((pixels[x] & 0xff000000) != 0) { maxX = x; maxY = y1; anySelected = true; break; } } if ( anySelected ) break; } pixels = null; for (int y = 0; y < y1; y++) { pixels = getRGB( p, 0, y, width, 1, pixels ); for (int x = 0; x < minX; x++) { if ((pixels[x] & 0xff000000) != 0) { minX = x; if ( y < minY ) minY = y; anySelected = true; break; } } for (int x = width-1; x >= maxX; x--) { if ((pixels[x] & 0xff000000) != 0) { maxX = x; if ( y < minY ) minY = y; anySelected = true; break; } } } if ( anySelected ) return new Rectangle( minX, minY, maxX-minX+1, maxY-minY+1 ); return null; }
java
public static Rectangle getSelectedBounds(BufferedImage p) { int width = p.getWidth(); int height = p.getHeight(); int maxX = 0, maxY = 0, minX = width, minY = height; boolean anySelected = false; int y1; int [] pixels = null; for (y1 = height-1; y1 >= 0; y1--) { pixels = getRGB( p, 0, y1, width, 1, pixels ); for (int x = 0; x < minX; x++) { if ((pixels[x] & 0xff000000) != 0) { minX = x; maxY = y1; anySelected = true; break; } } for (int x = width-1; x >= maxX; x--) { if ((pixels[x] & 0xff000000) != 0) { maxX = x; maxY = y1; anySelected = true; break; } } if ( anySelected ) break; } pixels = null; for (int y = 0; y < y1; y++) { pixels = getRGB( p, 0, y, width, 1, pixels ); for (int x = 0; x < minX; x++) { if ((pixels[x] & 0xff000000) != 0) { minX = x; if ( y < minY ) minY = y; anySelected = true; break; } } for (int x = width-1; x >= maxX; x--) { if ((pixels[x] & 0xff000000) != 0) { maxX = x; if ( y < minY ) minY = y; anySelected = true; break; } } } if ( anySelected ) return new Rectangle( minX, minY, maxX-minX+1, maxY-minY+1 ); return null; }
[ "public", "static", "Rectangle", "getSelectedBounds", "(", "BufferedImage", "p", ")", "{", "int", "width", "=", "p", ".", "getWidth", "(", ")", ";", "int", "height", "=", "p", ".", "getHeight", "(", ")", ";", "int", "maxX", "=", "0", ",", "maxY", "="...
Calculates the bounds of the non-transparent parts of the given image. @param p the image @return the bounds of the non-transparent area
[ "Calculates", "the", "bounds", "of", "the", "non", "-", "transparent", "parts", "of", "the", "given", "image", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L145-L199
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.composeThroughMask
public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) { int x = src.getMinX(); int y = src.getMinY(); int w = src.getWidth(); int h = src.getHeight(); int srcRGB[] = null; int selRGB[] = null; int dstRGB[] = null; for ( int i = 0; i < h; i++ ) { srcRGB = src.getPixels(x, y, w, 1, srcRGB); selRGB = sel.getPixels(x, y, w, 1, selRGB); dstRGB = dst.getPixels(x, y, w, 1, dstRGB); int k = x; for ( int j = 0; j < w; j++ ) { int sr = srcRGB[k]; int dir = dstRGB[k]; int sg = srcRGB[k+1]; int dig = dstRGB[k+1]; int sb = srcRGB[k+2]; int dib = dstRGB[k+2]; int sa = srcRGB[k+3]; int dia = dstRGB[k+3]; float a = selRGB[k+3]/255f; float ac = 1-a; dstRGB[k] = (int)(a*sr + ac*dir); dstRGB[k+1] = (int)(a*sg + ac*dig); dstRGB[k+2] = (int)(a*sb + ac*dib); dstRGB[k+3] = (int)(a*sa + ac*dia); k += 4; } dst.setPixels(x, y, w, 1, dstRGB); y++; } }
java
public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) { int x = src.getMinX(); int y = src.getMinY(); int w = src.getWidth(); int h = src.getHeight(); int srcRGB[] = null; int selRGB[] = null; int dstRGB[] = null; for ( int i = 0; i < h; i++ ) { srcRGB = src.getPixels(x, y, w, 1, srcRGB); selRGB = sel.getPixels(x, y, w, 1, selRGB); dstRGB = dst.getPixels(x, y, w, 1, dstRGB); int k = x; for ( int j = 0; j < w; j++ ) { int sr = srcRGB[k]; int dir = dstRGB[k]; int sg = srcRGB[k+1]; int dig = dstRGB[k+1]; int sb = srcRGB[k+2]; int dib = dstRGB[k+2]; int sa = srcRGB[k+3]; int dia = dstRGB[k+3]; float a = selRGB[k+3]/255f; float ac = 1-a; dstRGB[k] = (int)(a*sr + ac*dir); dstRGB[k+1] = (int)(a*sg + ac*dig); dstRGB[k+2] = (int)(a*sb + ac*dib); dstRGB[k+3] = (int)(a*sa + ac*dia); k += 4; } dst.setPixels(x, y, w, 1, dstRGB); y++; } }
[ "public", "static", "void", "composeThroughMask", "(", "Raster", "src", ",", "WritableRaster", "dst", ",", "Raster", "sel", ")", "{", "int", "x", "=", "src", ".", "getMinX", "(", ")", ";", "int", "y", "=", "src", ".", "getMinY", "(", ")", ";", "int",...
Compose src onto dst using the alpha of sel to interpolate between the two. I can't think of a way to do this using AlphaComposite. @param src the source raster @param dst the destination raster @param sel the mask raster
[ "Compose", "src", "onto", "dst", "using", "the", "alpha", "of", "sel", "to", "interpolate", "between", "the", "two", ".", "I", "can", "t", "think", "of", "a", "way", "to", "do", "this", "using", "AlphaComposite", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L208-L247
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/DiffusionFilter.java
DiffusionFilter.setMatrix
public void setMatrix(int[] matrix) { this.matrix = matrix; sum = 0; for (int i = 0; i < matrix.length; i++) sum += matrix[i]; }
java
public void setMatrix(int[] matrix) { this.matrix = matrix; sum = 0; for (int i = 0; i < matrix.length; i++) sum += matrix[i]; }
[ "public", "void", "setMatrix", "(", "int", "[", "]", "matrix", ")", "{", "this", ".", "matrix", "=", "matrix", ";", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "matrix", ".", "length", ";", "i", "++", ")", "sum", "+...
Set the dither matrix. @param matrix the dither matrix @see #getMatrix
[ "Set", "the", "dither", "matrix", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/DiffusionFilter.java#L86-L91
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.gain
public static float gain(float a, float b) { /* float p = (float)Math.log(1.0 - b) / (float)Math.log(0.5); if (a < .001) return 0.0f; else if (a > .999) return 1.0f; if (a < 0.5) return (float)Math.pow(2 * a, p) / 2; else return 1.0f - (float)Math.pow(2 * (1. - a), p) / 2; */ float c = (1.0f/b-2.0f) * (1.0f-2.0f*a); if (a < 0.5) return a/(c+1.0f); else return (c-a)/(c-1.0f); }
java
public static float gain(float a, float b) { /* float p = (float)Math.log(1.0 - b) / (float)Math.log(0.5); if (a < .001) return 0.0f; else if (a > .999) return 1.0f; if (a < 0.5) return (float)Math.pow(2 * a, p) / 2; else return 1.0f - (float)Math.pow(2 * (1. - a), p) / 2; */ float c = (1.0f/b-2.0f) * (1.0f-2.0f*a); if (a < 0.5) return a/(c+1.0f); else return (c-a)/(c-1.0f); }
[ "public", "static", "float", "gain", "(", "float", "a", ",", "float", "b", ")", "{", "/*\n\t\tfloat p = (float)Math.log(1.0 - b) / (float)Math.log(0.5);\n\n\t\tif (a < .001)\n\t\t\treturn 0.0f;\n\t\telse if (a > .999)\n\t\t\treturn 1.0f;\n\t\tif (a < 0.5)\n\t\t\treturn (float)Math.pow(2 * a,...
A variant of the gamma function. @param a the number to apply gain to @param b the gain parameter. 0.5 means no change, smaller values reduce gain, larger values increase gain. @return the output value
[ "A", "variant", "of", "the", "gamma", "function", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L62-L80
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.smoothPulse
public static float smoothPulse(float a1, float a2, float b1, float b2, float x) { if (x < a1 || x >= b2) return 0; if (x >= a2) { if (x < b1) return 1.0f; x = (x - b1) / (b2 - b1); return 1.0f - (x*x * (3.0f - 2.0f*x)); } x = (x - a1) / (a2 - a1); return x*x * (3.0f - 2.0f*x); }
java
public static float smoothPulse(float a1, float a2, float b1, float b2, float x) { if (x < a1 || x >= b2) return 0; if (x >= a2) { if (x < b1) return 1.0f; x = (x - b1) / (b2 - b1); return 1.0f - (x*x * (3.0f - 2.0f*x)); } x = (x - a1) / (a2 - a1); return x*x * (3.0f - 2.0f*x); }
[ "public", "static", "float", "smoothPulse", "(", "float", "a1", ",", "float", "a2", ",", "float", "b1", ",", "float", "b2", ",", "float", "x", ")", "{", "if", "(", "x", "<", "a1", "||", "x", ">=", "b2", ")", "return", "0", ";", "if", "(", "x", ...
A smoothed pulse function. A cubic function is used to smooth the step between two thresholds. @param a1 the lower threshold position for the start of the pulse @param a2 the upper threshold position for the start of the pulse @param b1 the lower threshold position for the end of the pulse @param b2 the upper threshold position for the end of the pulse @param x the input parameter @return the output value
[ "A", "smoothed", "pulse", "function", ".", "A", "cubic", "function", "is", "used", "to", "smooth", "the", "step", "between", "two", "thresholds", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L112-L123
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.smoothStep
public static float smoothStep(float a, float b, float x) { if (x < a) return 0; if (x >= b) return 1; x = (x - a) / (b - a); return x*x * (3 - 2*x); }
java
public static float smoothStep(float a, float b, float x) { if (x < a) return 0; if (x >= b) return 1; x = (x - a) / (b - a); return x*x * (3 - 2*x); }
[ "public", "static", "float", "smoothStep", "(", "float", "a", ",", "float", "b", ",", "float", "x", ")", "{", "if", "(", "x", "<", "a", ")", "return", "0", ";", "if", "(", "x", ">=", "b", ")", "return", "1", ";", "x", "=", "(", "x", "-", "a...
A smoothed step function. A cubic function is used to smooth the step between two thresholds. @param a the lower threshold position @param b the upper threshold position @param x the input parameter @return the output value
[ "A", "smoothed", "step", "function", ".", "A", "cubic", "function", "is", "used", "to", "smooth", "the", "step", "between", "two", "thresholds", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L132-L139
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.mixColors
public static int mixColors(float t, int rgb1, int rgb2) { int a1 = (rgb1 >> 24) & 0xff; int r1 = (rgb1 >> 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; int b1 = rgb1 & 0xff; int a2 = (rgb2 >> 24) & 0xff; int r2 = (rgb2 >> 16) & 0xff; int g2 = (rgb2 >> 8) & 0xff; int b2 = rgb2 & 0xff; a1 = lerp(t, a1, a2); r1 = lerp(t, r1, r2); g1 = lerp(t, g1, g2); b1 = lerp(t, b1, b2); return (a1 << 24) | (r1 << 16) | (g1 << 8) | b1; }
java
public static int mixColors(float t, int rgb1, int rgb2) { int a1 = (rgb1 >> 24) & 0xff; int r1 = (rgb1 >> 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; int b1 = rgb1 & 0xff; int a2 = (rgb2 >> 24) & 0xff; int r2 = (rgb2 >> 16) & 0xff; int g2 = (rgb2 >> 8) & 0xff; int b2 = rgb2 & 0xff; a1 = lerp(t, a1, a2); r1 = lerp(t, r1, r2); g1 = lerp(t, g1, g2); b1 = lerp(t, b1, b2); return (a1 << 24) | (r1 << 16) | (g1 << 8) | b1; }
[ "public", "static", "int", "mixColors", "(", "float", "t", ",", "int", "rgb1", ",", "int", "rgb2", ")", "{", "int", "a1", "=", "(", "rgb1", ">>", "24", ")", "&", "0xff", ";", "int", "r1", "=", "(", "rgb1", ">>", "16", ")", "&", "0xff", ";", "...
Linear interpolation of ARGB values. @param t the interpolation parameter @param rgb1 the lower interpolation range @param rgb2 the upper interpolation range @return the interpolated value
[ "Linear", "interpolation", "of", "ARGB", "values", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L266-L280
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.bilinearInterpolate
public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) { float m0, m1; int a0 = (nw >> 24) & 0xff; int r0 = (nw >> 16) & 0xff; int g0 = (nw >> 8) & 0xff; int b0 = nw & 0xff; int a1 = (ne >> 24) & 0xff; int r1 = (ne >> 16) & 0xff; int g1 = (ne >> 8) & 0xff; int b1 = ne & 0xff; int a2 = (sw >> 24) & 0xff; int r2 = (sw >> 16) & 0xff; int g2 = (sw >> 8) & 0xff; int b2 = sw & 0xff; int a3 = (se >> 24) & 0xff; int r3 = (se >> 16) & 0xff; int g3 = (se >> 8) & 0xff; int b3 = se & 0xff; float cx = 1.0f-x; float cy = 1.0f-y; m0 = cx * a0 + x * a1; m1 = cx * a2 + x * a3; int a = (int)(cy * m0 + y * m1); m0 = cx * r0 + x * r1; m1 = cx * r2 + x * r3; int r = (int)(cy * m0 + y * m1); m0 = cx * g0 + x * g1; m1 = cx * g2 + x * g3; int g = (int)(cy * m0 + y * m1); m0 = cx * b0 + x * b1; m1 = cx * b2 + x * b3; int b = (int)(cy * m0 + y * m1); return (a << 24) | (r << 16) | (g << 8) | b; }
java
public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) { float m0, m1; int a0 = (nw >> 24) & 0xff; int r0 = (nw >> 16) & 0xff; int g0 = (nw >> 8) & 0xff; int b0 = nw & 0xff; int a1 = (ne >> 24) & 0xff; int r1 = (ne >> 16) & 0xff; int g1 = (ne >> 8) & 0xff; int b1 = ne & 0xff; int a2 = (sw >> 24) & 0xff; int r2 = (sw >> 16) & 0xff; int g2 = (sw >> 8) & 0xff; int b2 = sw & 0xff; int a3 = (se >> 24) & 0xff; int r3 = (se >> 16) & 0xff; int g3 = (se >> 8) & 0xff; int b3 = se & 0xff; float cx = 1.0f-x; float cy = 1.0f-y; m0 = cx * a0 + x * a1; m1 = cx * a2 + x * a3; int a = (int)(cy * m0 + y * m1); m0 = cx * r0 + x * r1; m1 = cx * r2 + x * r3; int r = (int)(cy * m0 + y * m1); m0 = cx * g0 + x * g1; m1 = cx * g2 + x * g3; int g = (int)(cy * m0 + y * m1); m0 = cx * b0 + x * b1; m1 = cx * b2 + x * b3; int b = (int)(cy * m0 + y * m1); return (a << 24) | (r << 16) | (g << 8) | b; }
[ "public", "static", "int", "bilinearInterpolate", "(", "float", "x", ",", "float", "y", ",", "int", "nw", ",", "int", "ne", ",", "int", "sw", ",", "int", "se", ")", "{", "float", "m0", ",", "m1", ";", "int", "a0", "=", "(", "nw", ">>", "24", ")...
Bilinear interpolation of ARGB values. @param x the X interpolation parameter 0..1 @param y the y interpolation parameter 0..1 @param rgb array of four ARGB values in the order NW, NE, SW, SE @return the interpolated value
[ "Bilinear", "interpolation", "of", "ARGB", "values", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L289-L328
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.brightnessNTSC
public static int brightnessNTSC(int rgb) { int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = rgb & 0xff; return (int)(r*0.299f + g*0.587f + b*0.114f); }
java
public static int brightnessNTSC(int rgb) { int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = rgb & 0xff; return (int)(r*0.299f + g*0.587f + b*0.114f); }
[ "public", "static", "int", "brightnessNTSC", "(", "int", "rgb", ")", "{", "int", "r", "=", "(", "rgb", ">>", "16", ")", "&", "0xff", ";", "int", "g", "=", "(", "rgb", ">>", "8", ")", "&", "0xff", ";", "int", "b", "=", "rgb", "&", "0xff", ";",...
Return the NTSC gray level of an RGB value. @param rgb1 the input pixel @return the gray level (0-255)
[ "Return", "the", "NTSC", "gray", "level", "of", "an", "RGB", "value", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L335-L340
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.colorSpline
public static int colorSpline(int x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span+1] > x) break; if (span > numKnots-3) span = numKnots-3; float t = (float)(x-xknots[span]) / (xknots[span+1]-xknots[span]); span--; if (span < 0) { span = 0; t = 0; } int v = 0; for (int i = 0; i < 4; i++) { int shift = i * 8; k0 = (yknots[span] >> shift) & 0xff; k1 = (yknots[span+1] >> shift) & 0xff; k2 = (yknots[span+2] >> shift) & 0xff; k3 = (yknots[span+3] >> shift) & 0xff; c3 = m00*k0 + m01*k1 + m02*k2 + m03*k3; c2 = m10*k0 + m11*k1 + m12*k2 + m13*k3; c1 = m20*k0 + m21*k1 + m22*k2 + m23*k3; c0 = m30*k0 + m31*k1 + m32*k2 + m33*k3; int n = (int)(((c3*t + c2)*t + c1)*t + c0); if (n < 0) n = 0; else if (n > 255) n = 255; v |= n << shift; } return v; }
java
public static int colorSpline(int x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span+1] > x) break; if (span > numKnots-3) span = numKnots-3; float t = (float)(x-xknots[span]) / (xknots[span+1]-xknots[span]); span--; if (span < 0) { span = 0; t = 0; } int v = 0; for (int i = 0; i < 4; i++) { int shift = i * 8; k0 = (yknots[span] >> shift) & 0xff; k1 = (yknots[span+1] >> shift) & 0xff; k2 = (yknots[span+2] >> shift) & 0xff; k3 = (yknots[span+3] >> shift) & 0xff; c3 = m00*k0 + m01*k1 + m02*k2 + m03*k3; c2 = m10*k0 + m11*k1 + m12*k2 + m13*k3; c1 = m20*k0 + m21*k1 + m22*k2 + m23*k3; c0 = m30*k0 + m31*k1 + m32*k2 + m33*k3; int n = (int)(((c3*t + c2)*t + c1)*t + c0); if (n < 0) n = 0; else if (n > 255) n = 255; v |= n << shift; } return v; }
[ "public", "static", "int", "colorSpline", "(", "int", "x", ",", "int", "numKnots", ",", "int", "[", "]", "xknots", ",", "int", "[", "]", "yknots", ")", "{", "int", "span", ";", "int", "numSpans", "=", "numKnots", "-", "3", ";", "float", "k0", ",", ...
Compute a Catmull-Rom spline for RGB values, but with variable knot spacing. @param x the input parameter @param numKnots the number of knots in the spline @param xknots the array of knot x values @param yknots the array of knot y values @return the spline value
[ "Compute", "a", "Catmull", "-", "Rom", "spline", "for", "RGB", "values", "but", "with", "variable", "knot", "spacing", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L491-L534
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.copyTo
public void copyTo(Gradient g) { g.numKnots = numKnots; g.map = (int[])map.clone(); g.xKnots = (int[])xKnots.clone(); g.yKnots = (int[])yKnots.clone(); g.knotTypes = (byte[])knotTypes.clone(); }
java
public void copyTo(Gradient g) { g.numKnots = numKnots; g.map = (int[])map.clone(); g.xKnots = (int[])xKnots.clone(); g.yKnots = (int[])yKnots.clone(); g.knotTypes = (byte[])knotTypes.clone(); }
[ "public", "void", "copyTo", "(", "Gradient", "g", ")", "{", "g", ".", "numKnots", "=", "numKnots", ";", "g", ".", "map", "=", "(", "int", "[", "]", ")", "map", ".", "clone", "(", ")", ";", "g", ".", "xKnots", "=", "(", "int", "[", "]", ")", ...
Copy one Gradient into another. @param g the Gradient to copy into
[ "Copy", "one", "Gradient", "into", "another", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L138-L144
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setColor
public void setColor(int n, int color) { int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
java
public void setColor(int n, int color) { int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
[ "public", "void", "setColor", "(", "int", "n", ",", "int", "color", ")", "{", "int", "firstColor", "=", "map", "[", "0", "]", ";", "int", "lastColor", "=", "map", "[", "256", "-", "1", "]", ";", "if", "(", "n", ">", "0", ")", "for", "(", "int...
Set a knot color. @param n the knot index @param color the color
[ "Set", "a", "knot", "color", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L151-L160
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnotType
public void setKnotType(int n, int type) { knotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type); rebuildGradient(); }
java
public void setKnotType(int n, int type) { knotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type); rebuildGradient(); }
[ "public", "void", "setKnotType", "(", "int", "n", ",", "int", "type", ")", "{", "knotTypes", "[", "n", "]", "=", "(", "byte", ")", "(", "(", "knotTypes", "[", "n", "]", "&", "~", "COLOR_MASK", ")", "|", "type", ")", ";", "rebuildGradient", "(", "...
Set a knot type. @param n the knot index @param type the type @see #getKnotType
[ "Set", "a", "knot", "type", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L197-L200
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnotBlend
public void setKnotBlend(int n, int type) { knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type); rebuildGradient(); }
java
public void setKnotBlend(int n, int type) { knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type); rebuildGradient(); }
[ "public", "void", "setKnotBlend", "(", "int", "n", ",", "int", "type", ")", "{", "knotTypes", "[", "n", "]", "=", "(", "byte", ")", "(", "(", "knotTypes", "[", "n", "]", "&", "~", "BLEND_MASK", ")", "|", "type", ")", ";", "rebuildGradient", "(", ...
Set a knot blend type. @param n the knot index @param type the knot blend type @see #getKnotBlend
[ "Set", "a", "knot", "blend", "type", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L218-L221
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnots
public void setKnots(int[] x, int[] rgb, byte[] types) { numKnots = rgb.length+2; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; if (x != null) System.arraycopy(x, 0, xKnots, 1, numKnots-2); else for (int i = 1; i > numKnots-1; i++) xKnots[i] = 255*i/(numKnots-2); System.arraycopy(rgb, 0, yKnots, 1, numKnots-2); if (types != null) System.arraycopy(types, 0, knotTypes, 1, numKnots-2); else for (int i = 0; i > numKnots; i++) knotTypes[i] = RGB|SPLINE; sortKnots(); rebuildGradient(); }
java
public void setKnots(int[] x, int[] rgb, byte[] types) { numKnots = rgb.length+2; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; if (x != null) System.arraycopy(x, 0, xKnots, 1, numKnots-2); else for (int i = 1; i > numKnots-1; i++) xKnots[i] = 255*i/(numKnots-2); System.arraycopy(rgb, 0, yKnots, 1, numKnots-2); if (types != null) System.arraycopy(types, 0, knotTypes, 1, numKnots-2); else for (int i = 0; i > numKnots; i++) knotTypes[i] = RGB|SPLINE; sortKnots(); rebuildGradient(); }
[ "public", "void", "setKnots", "(", "int", "[", "]", "x", ",", "int", "[", "]", "rgb", ",", "byte", "[", "]", "types", ")", "{", "numKnots", "=", "rgb", ".", "length", "+", "2", ";", "xKnots", "=", "new", "int", "[", "numKnots", "]", ";", "yKnot...
Set the values of all the knots. This version does not require the "extra" knots at -1 and 256 @param x the knot positions @param rgb the knot colors @param types the knot types
[ "Set", "the", "values", "of", "all", "the", "knots", ".", "This", "version", "does", "not", "require", "the", "extra", "knots", "at", "-", "1", "and", "256" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L288-L306
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnots
public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) { numKnots = count; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; System.arraycopy(x, offset, xKnots, 0, numKnots); System.arraycopy(y, offset, yKnots, 0, numKnots); System.arraycopy(types, offset, knotTypes, 0, numKnots); sortKnots(); rebuildGradient(); }
java
public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) { numKnots = count; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; System.arraycopy(x, offset, xKnots, 0, numKnots); System.arraycopy(y, offset, yKnots, 0, numKnots); System.arraycopy(types, offset, knotTypes, 0, numKnots); sortKnots(); rebuildGradient(); }
[ "public", "void", "setKnots", "(", "int", "[", "]", "x", ",", "int", "[", "]", "y", ",", "byte", "[", "]", "types", ",", "int", "offset", ",", "int", "count", ")", "{", "numKnots", "=", "count", ";", "xKnots", "=", "new", "int", "[", "numKnots", ...
Set the values of a set of knots. @param x the knot positions @param y the knot colors @param types the knot types @param offset the first knot to set @param count the number of knots
[ "Set", "the", "values", "of", "a", "set", "of", "knots", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L316-L326
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.splitSpan
public void splitSpan(int n) { int x = (xKnots[n] + xKnots[n+1])/2; addKnot(x, getColor(x/256.0f), knotTypes[n]); rebuildGradient(); }
java
public void splitSpan(int n) { int x = (xKnots[n] + xKnots[n+1])/2; addKnot(x, getColor(x/256.0f), knotTypes[n]); rebuildGradient(); }
[ "public", "void", "splitSpan", "(", "int", "n", ")", "{", "int", "x", "=", "(", "xKnots", "[", "n", "]", "+", "xKnots", "[", "n", "+", "1", "]", ")", "/", "2", ";", "addKnot", "(", "x", ",", "getColor", "(", "x", "/", "256.0f", ")", ",", "k...
Split a span into two by adding a knot in the middle. @param n the span index
[ "Split", "a", "span", "into", "two", "by", "adding", "a", "knot", "in", "the", "middle", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L332-L336
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.knotAt
public int knotAt(int x) { for (int i = 1; i < numKnots-1; i++) if (xKnots[i+1] > x) return i; return 1; }
java
public int knotAt(int x) { for (int i = 1; i < numKnots-1; i++) if (xKnots[i+1] > x) return i; return 1; }
[ "public", "int", "knotAt", "(", "int", "x", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "numKnots", "-", "1", ";", "i", "++", ")", "if", "(", "xKnots", "[", "i", "+", "1", "]", ">", "x", ")", "return", "i", ";", "return", "...
Return the knot at a given position. @param x the position @return the knot number, or 1 if no knot found
[ "Return", "the", "knot", "at", "a", "given", "position", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L365-L370
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.randomize
public void randomize() { numKnots = 4 + (int)(6*Math.random()); xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; for (int i = 0; i < numKnots; i++) { xKnots[i] = (int)(255 * Math.random()); yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 * Math.random()) << 8) | (int)(255 * Math.random()); knotTypes[i] = RGB|SPLINE; } xKnots[0] = -1; xKnots[1] = 0; xKnots[numKnots-2] = 255; xKnots[numKnots-1] = 256; sortKnots(); rebuildGradient(); }
java
public void randomize() { numKnots = 4 + (int)(6*Math.random()); xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; for (int i = 0; i < numKnots; i++) { xKnots[i] = (int)(255 * Math.random()); yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 * Math.random()) << 8) | (int)(255 * Math.random()); knotTypes[i] = RGB|SPLINE; } xKnots[0] = -1; xKnots[1] = 0; xKnots[numKnots-2] = 255; xKnots[numKnots-1] = 256; sortKnots(); rebuildGradient(); }
[ "public", "void", "randomize", "(", ")", "{", "numKnots", "=", "4", "+", "(", "int", ")", "(", "6", "*", "Math", ".", "random", "(", ")", ")", ";", "xKnots", "=", "new", "int", "[", "numKnots", "]", ";", "yKnots", "=", "new", "int", "[", "numKn...
Randomize the gradient.
[ "Randomize", "the", "gradient", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L464-L480
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.mutate
public void mutate(float amount) { for (int i = 0; i < numKnots; i++) { int rgb = yKnots[i]; int r = ((rgb >> 16) & 0xff); int g = ((rgb >> 8) & 0xff); int b = (rgb & 0xff); r = PixelUtils.clamp( (int)(r + amount * 255 * (Math.random()-0.5)) ); g = PixelUtils.clamp( (int)(g + amount * 255 * (Math.random()-0.5)) ); b = PixelUtils.clamp( (int)(b + amount * 255 * (Math.random()-0.5)) ); yKnots[i] = 0xff000000 | (r << 16) | (g << 8) | b; knotTypes[i] = RGB|SPLINE; } sortKnots(); rebuildGradient(); }
java
public void mutate(float amount) { for (int i = 0; i < numKnots; i++) { int rgb = yKnots[i]; int r = ((rgb >> 16) & 0xff); int g = ((rgb >> 8) & 0xff); int b = (rgb & 0xff); r = PixelUtils.clamp( (int)(r + amount * 255 * (Math.random()-0.5)) ); g = PixelUtils.clamp( (int)(g + amount * 255 * (Math.random()-0.5)) ); b = PixelUtils.clamp( (int)(b + amount * 255 * (Math.random()-0.5)) ); yKnots[i] = 0xff000000 | (r << 16) | (g << 8) | b; knotTypes[i] = RGB|SPLINE; } sortKnots(); rebuildGradient(); }
[ "public", "void", "mutate", "(", "float", "amount", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numKnots", ";", "i", "++", ")", "{", "int", "rgb", "=", "yKnots", "[", "i", "]", ";", "int", "r", "=", "(", "(", "rgb", ">>", "1...
Mutate the gradient. @param amount the amount in the range zero to one
[ "Mutate", "the", "gradient", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L486-L500
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.setBufferedImage
public void setBufferedImage(BufferedImage img) { image = img; width = img.getWidth(); height = img.getHeight(); updateColorArray(); }
java
public void setBufferedImage(BufferedImage img) { image = img; width = img.getWidth(); height = img.getHeight(); updateColorArray(); }
[ "public", "void", "setBufferedImage", "(", "BufferedImage", "img", ")", "{", "image", "=", "img", ";", "width", "=", "img", ".", "getWidth", "(", ")", ";", "height", "=", "img", ".", "getHeight", "(", ")", ";", "updateColorArray", "(", ")", ";", "}" ]
Sets a new image @param BufferedImage imagem
[ "Sets", "a", "new", "image" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L353-L358
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.getNewImageInstance
public BufferedImage getNewImageInstance() { BufferedImage buf = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); buf.setData(image.getData()); return buf; }
java
public BufferedImage getNewImageInstance() { BufferedImage buf = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); buf.setData(image.getData()); return buf; }
[ "public", "BufferedImage", "getNewImageInstance", "(", ")", "{", "BufferedImage", "buf", "=", "new", "BufferedImage", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "image", ".", "getType", "(", ")", ")", ";", "bu...
Return a new instance of the BufferedImage @return BufferedImage
[ "Return", "a", "new", "instance", "of", "the", "BufferedImage" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L467-L471
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.getBufferedImage
public BufferedImage getBufferedImage(int width, int height) { // using the new approach of Java 2D API BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) buf.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.drawImage(image, 0, 0, width, height, null); g2d.dispose(); return (buf); }
java
public BufferedImage getBufferedImage(int width, int height) { // using the new approach of Java 2D API BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) buf.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.drawImage(image, 0, 0, width, height, null); g2d.dispose(); return (buf); }
[ "public", "BufferedImage", "getBufferedImage", "(", "int", "width", ",", "int", "height", ")", "{", "// using the new approach of Java 2D API", "BufferedImage", "buf", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "BufferedImage", ".", "TYPE_INT_ARGB"...
Resize and return the image passing the new height and width @param height @param width @return
[ "Resize", "and", "return", "the", "image", "passing", "the", "new", "height", "and", "width" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L480-L488
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.resize
public void resize(int w, int h) { // using the new approach of Java 2D API BufferedImage buf = new BufferedImage(w, h, image.getType()); Graphics2D g2d = (Graphics2D) buf.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.drawImage(image, 0, 0, w, h, null); g2d.dispose(); image = buf; width = w; height = h; updateColorArray(); }
java
public void resize(int w, int h) { // using the new approach of Java 2D API BufferedImage buf = new BufferedImage(w, h, image.getType()); Graphics2D g2d = (Graphics2D) buf.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.drawImage(image, 0, 0, w, h, null); g2d.dispose(); image = buf; width = w; height = h; updateColorArray(); }
[ "public", "void", "resize", "(", "int", "w", ",", "int", "h", ")", "{", "// using the new approach of Java 2D API", "BufferedImage", "buf", "=", "new", "BufferedImage", "(", "w", ",", "h", ",", "image", ".", "getType", "(", ")", ")", ";", "Graphics2D", "g2...
Resize the image passing the new height and width @param height @param width @return
[ "Resize", "the", "image", "passing", "the", "new", "height", "and", "width" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L534-L546
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.multi8p
public double multi8p(int x, int y, double masc) { int aR = getIntComponent0(x - 1, y - 1); int bR = getIntComponent0(x - 1, y); int cR = getIntComponent0(x - 1, y + 1); int aG = getIntComponent1(x - 1, y - 1); int bG = getIntComponent1(x - 1, y); int cG = getIntComponent1(x - 1, y + 1); int aB = getIntComponent1(x - 1, y - 1); int bB = getIntComponent1(x - 1, y); int cB = getIntComponent1(x - 1, y + 1); int dR = getIntComponent0(x, y - 1); int eR = getIntComponent0(x, y); int fR = getIntComponent0(x, y + 1); int dG = getIntComponent1(x, y - 1); int eG = getIntComponent1(x, y); int fG = getIntComponent1(x, y + 1); int dB = getIntComponent1(x, y - 1); int eB = getIntComponent1(x, y); int fB = getIntComponent1(x, y + 1); int gR = getIntComponent0(x + 1, y - 1); int hR = getIntComponent0(x + 1, y); int iR = getIntComponent0(x + 1, y + 1); int gG = getIntComponent1(x + 1, y - 1); int hG = getIntComponent1(x + 1, y); int iG = getIntComponent1(x + 1, y + 1); int gB = getIntComponent1(x + 1, y - 1); int hB = getIntComponent1(x + 1, y); int iB = getIntComponent1(x + 1, y + 1); double rgb = 0; rgb = ((aR * masc) + (bR * masc) + (cR * masc) + (dR * masc) + (eR * masc) + (fR * masc) + (gR * masc) + (hR * masc) + (iR * masc)); return (rgb); }
java
public double multi8p(int x, int y, double masc) { int aR = getIntComponent0(x - 1, y - 1); int bR = getIntComponent0(x - 1, y); int cR = getIntComponent0(x - 1, y + 1); int aG = getIntComponent1(x - 1, y - 1); int bG = getIntComponent1(x - 1, y); int cG = getIntComponent1(x - 1, y + 1); int aB = getIntComponent1(x - 1, y - 1); int bB = getIntComponent1(x - 1, y); int cB = getIntComponent1(x - 1, y + 1); int dR = getIntComponent0(x, y - 1); int eR = getIntComponent0(x, y); int fR = getIntComponent0(x, y + 1); int dG = getIntComponent1(x, y - 1); int eG = getIntComponent1(x, y); int fG = getIntComponent1(x, y + 1); int dB = getIntComponent1(x, y - 1); int eB = getIntComponent1(x, y); int fB = getIntComponent1(x, y + 1); int gR = getIntComponent0(x + 1, y - 1); int hR = getIntComponent0(x + 1, y); int iR = getIntComponent0(x + 1, y + 1); int gG = getIntComponent1(x + 1, y - 1); int hG = getIntComponent1(x + 1, y); int iG = getIntComponent1(x + 1, y + 1); int gB = getIntComponent1(x + 1, y - 1); int hB = getIntComponent1(x + 1, y); int iB = getIntComponent1(x + 1, y + 1); double rgb = 0; rgb = ((aR * masc) + (bR * masc) + (cR * masc) + (dR * masc) + (eR * masc) + (fR * masc) + (gR * masc) + (hR * masc) + (iR * masc)); return (rgb); }
[ "public", "double", "multi8p", "(", "int", "x", ",", "int", "y", ",", "double", "masc", ")", "{", "int", "aR", "=", "getIntComponent0", "(", "x", "-", "1", ",", "y", "-", "1", ")", ";", "int", "bR", "=", "getIntComponent0", "(", "x", "-", "1", ...
Multiple of gradient windwos per masc relation of x y @return int[]
[ "Multiple", "of", "gradient", "windwos", "per", "masc", "relation", "of", "x", "y" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L565-L606
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.fillRect
public void fillRect(int x, int y, int w, int h, Color c) { int color = c.getRGB(); for (int i = x; i < x + w; i++) { for (int j = y; j < y + h; j++) { setIntColor(i, j, color); } } }
java
public void fillRect(int x, int y, int w, int h, Color c) { int color = c.getRGB(); for (int i = x; i < x + w; i++) { for (int j = y; j < y + h; j++) { setIntColor(i, j, color); } } }
[ "public", "void", "fillRect", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "Color", "c", ")", "{", "int", "color", "=", "c", ".", "getRGB", "(", ")", ";", "for", "(", "int", "i", "=", "x", ";", "i", "<", "x", "...
Fills a rectangle in the image. @param x rect�s start position in x-axis @param y rect�s start positioj in y-axis @param w rect�s width @param h rect�s height @param c rect�s color
[ "Fills", "a", "rectangle", "in", "the", "image", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L707-L714
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/TransitionFilter.java
TransitionFilter.prepareFilter
public void prepareFilter( float transition ) { try { method.invoke( filter, new Object[] { new Float( transition ) } ); } catch ( Exception e ) { throw new IllegalArgumentException("Error setting value for property: "+property); } }
java
public void prepareFilter( float transition ) { try { method.invoke( filter, new Object[] { new Float( transition ) } ); } catch ( Exception e ) { throw new IllegalArgumentException("Error setting value for property: "+property); } }
[ "public", "void", "prepareFilter", "(", "float", "transition", ")", "{", "try", "{", "method", ".", "invoke", "(", "filter", ",", "new", "Object", "[", "]", "{", "new", "Float", "(", "transition", ")", "}", ")", ";", "}", "catch", "(", "Exception", "...
Prepare the filter for the transiton at a given time. The default implementation sets the given filter property, but you could override this method to make other changes. @param transition the transition time in the range 0 - 1
[ "Prepare", "the", "filter", "for", "the", "transiton", "at", "a", "given", "time", ".", "The", "default", "implementation", "sets", "the", "given", "filter", "property", "but", "you", "could", "override", "this", "method", "to", "make", "other", "changes", "...
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/TransitionFilter.java#L139-L146
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java
MarvinColorModelConverter.rgbToBinary
public static MarvinImage rgbToBinary(MarvinImage img, int threshold) { MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY); for (int y = 0; y < img.getHeight(); y++) { for (int x = 0; x < img.getWidth(); x++) { int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11)); if (gray <= threshold) { resultImage.setBinaryColor(x, y, true); } else { resultImage.setBinaryColor(x, y, false); } } } return resultImage; }
java
public static MarvinImage rgbToBinary(MarvinImage img, int threshold) { MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY); for (int y = 0; y < img.getHeight(); y++) { for (int x = 0; x < img.getWidth(); x++) { int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11)); if (gray <= threshold) { resultImage.setBinaryColor(x, y, true); } else { resultImage.setBinaryColor(x, y, false); } } } return resultImage; }
[ "public", "static", "MarvinImage", "rgbToBinary", "(", "MarvinImage", "img", ",", "int", "threshold", ")", "{", "MarvinImage", "resultImage", "=", "new", "MarvinImage", "(", "img", ".", "getWidth", "(", ")", ",", "img", ".", "getHeight", "(", ")", ",", "Ma...
Converts an image in RGB mode to BINARY mode @param img image @param threshold grays cale threshold @return new MarvinImage instance in BINARY mode
[ "Converts", "an", "image", "in", "RGB", "mode", "to", "BINARY", "mode" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L19-L34
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java
MarvinColorModelConverter.binaryToRgb
public static MarvinImage binaryToRgb(MarvinImage img) { MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_RGB); for (int y = 0; y < img.getHeight(); y++) { for (int x = 0; x < img.getWidth(); x++) { if (img.getBinaryColor(x, y)) { resultImage.setIntColor(x, y, 0, 0, 0); } else { resultImage.setIntColor(x, y, 255, 255, 255); } } } return resultImage; }
java
public static MarvinImage binaryToRgb(MarvinImage img) { MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_RGB); for (int y = 0; y < img.getHeight(); y++) { for (int x = 0; x < img.getWidth(); x++) { if (img.getBinaryColor(x, y)) { resultImage.setIntColor(x, y, 0, 0, 0); } else { resultImage.setIntColor(x, y, 255, 255, 255); } } } return resultImage; }
[ "public", "static", "MarvinImage", "binaryToRgb", "(", "MarvinImage", "img", ")", "{", "MarvinImage", "resultImage", "=", "new", "MarvinImage", "(", "img", ".", "getWidth", "(", ")", ",", "img", ".", "getHeight", "(", ")", ",", "MarvinImage", ".", "COLOR_MOD...
Converts an image in BINARY mode to RGB mode @param img image @return new MarvinImage instance in RGB mode
[ "Converts", "an", "image", "in", "BINARY", "mode", "to", "RGB", "mode" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L42-L55
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java
MarvinColorModelConverter.binaryToRgb
public static int[] binaryToRgb(boolean[] binaryArray) { int[] rgbArray = new int[binaryArray.length]; for (int i = 0; i < binaryArray.length; i++) { if (binaryArray[i]) { rgbArray[i] = 0x00000000; } else { rgbArray[i] = 0x00FFFFFF; } } return rgbArray; }
java
public static int[] binaryToRgb(boolean[] binaryArray) { int[] rgbArray = new int[binaryArray.length]; for (int i = 0; i < binaryArray.length; i++) { if (binaryArray[i]) { rgbArray[i] = 0x00000000; } else { rgbArray[i] = 0x00FFFFFF; } } return rgbArray; }
[ "public", "static", "int", "[", "]", "binaryToRgb", "(", "boolean", "[", "]", "binaryArray", ")", "{", "int", "[", "]", "rgbArray", "=", "new", "int", "[", "binaryArray", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "...
Converts a boolean array containing the pixel data in BINARY mode to an integer array with the pixel data in RGB mode. @param binaryArray pixel binary data @return pixel integer data in RGB mode.
[ "Converts", "a", "boolean", "array", "containing", "the", "pixel", "data", "in", "BINARY", "mode", "to", "an", "integer", "array", "with", "the", "pixel", "data", "in", "RGB", "mode", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L64-L75
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/SwimFilter.java
SwimFilter.setAngle
public void setAngle(float angle) { this.angle = angle; float cos = (float) Math.cos(angle); float sin = (float) Math.sin(angle); m00 = cos; m01 = sin; m10 = -sin; m11 = cos; }
java
public void setAngle(float angle) { this.angle = angle; float cos = (float) Math.cos(angle); float sin = (float) Math.sin(angle); m00 = cos; m01 = sin; m10 = -sin; m11 = cos; }
[ "public", "void", "setAngle", "(", "float", "angle", ")", "{", "this", ".", "angle", "=", "angle", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cos", "(", "angle", ")", ";", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin"...
Specifies the angle of the effect. @param angle the angle of the effect. @angle
[ "Specifies", "the", "angle", "of", "the", "effect", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/SwimFilter.java#L76-L84
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java
AutocropOps.scanright
public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) { if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height)))) return col; else return scanright(color, height, width, col + 1, f, tolerance); }
java
public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) { if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height)))) return col; else return scanright(color, height, width, col + 1, f, tolerance); }
[ "public", "static", "int", "scanright", "(", "Color", "color", ",", "int", "height", ",", "int", "width", ",", "int", "col", ",", "PixelsExtractor", "f", ",", "int", "tolerance", ")", "{", "if", "(", "col", "==", "width", "||", "!", "PixelTools", ".", ...
Starting with the given column index, will return the first column index which contains a colour that does not match the given color.
[ "Starting", "with", "the", "given", "column", "index", "will", "return", "the", "first", "column", "index", "which", "contains", "a", "colour", "that", "does", "not", "match", "the", "given", "color", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java#L9-L14
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImageMask.java
MarvinImageMask.clear
public void clear() { if (arrMask != null) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { arrMask[x][y] = false; } } } }
java
public void clear() { if (arrMask != null) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { arrMask[x][y] = false; } } } }
[ "public", "void", "clear", "(", ")", "{", "if", "(", "arrMask", "!=", "null", ")", "{", "for", "(", "int", "y", "=", "0", ";", "y", "<", "height", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "width", ";", "x...
Clear the mask for a new selection
[ "Clear", "the", "mask", "for", "a", "new", "selection" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImageMask.java#L82-L90
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.pixels
public Pixel[] pixels() { Pixel[] pixels = new Pixel[count()]; Point[] points = points(); for (int k = 0; k < points.length; k++) { pixels[k] = pixel(points[k]); } return pixels; }
java
public Pixel[] pixels() { Pixel[] pixels = new Pixel[count()]; Point[] points = points(); for (int k = 0; k < points.length; k++) { pixels[k] = pixel(points[k]); } return pixels; }
[ "public", "Pixel", "[", "]", "pixels", "(", ")", "{", "Pixel", "[", "]", "pixels", "=", "new", "Pixel", "[", "count", "(", ")", "]", ";", "Point", "[", "]", "points", "=", "points", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", ...
Returns all the pixels for the image @return an array of pixels for this image
[ "Returns", "all", "the", "pixels", "for", "the", "image" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L78-L85
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.forall
public boolean forall(PixelPredicate predicate) { return Arrays.stream(points()).allMatch(p -> predicate.test(p.x, p.y, pixel(p))); }
java
public boolean forall(PixelPredicate predicate) { return Arrays.stream(points()).allMatch(p -> predicate.test(p.x, p.y, pixel(p))); }
[ "public", "boolean", "forall", "(", "PixelPredicate", "predicate", ")", "{", "return", "Arrays", ".", "stream", "(", "points", "(", ")", ")", ".", "allMatch", "(", "p", "->", "predicate", ".", "test", "(", "p", ".", "x", ",", "p", ".", "y", ",", "p...
Returns true if the predicate is true for all pixels in the image. @param predicate a predicate function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate @return true if f holds for at least one pixel
[ "Returns", "true", "if", "the", "predicate", "is", "true", "for", "all", "pixels", "in", "the", "image", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L172-L174
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.foreach
public void foreach(PixelFunction fn) { Arrays.stream(points()).forEach(p -> fn.apply(p.x, p.y, pixel(p))); }
java
public void foreach(PixelFunction fn) { Arrays.stream(points()).forEach(p -> fn.apply(p.x, p.y, pixel(p))); }
[ "public", "void", "foreach", "(", "PixelFunction", "fn", ")", "{", "Arrays", ".", "stream", "(", "points", "(", ")", ")", ".", "forEach", "(", "p", "->", "fn", ".", "apply", "(", "p", ".", "x", ",", "p", ".", "y", ",", "pixel", "(", "p", ")", ...
Executes the given side effecting function on each pixel. @param fn a function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate
[ "Executes", "the", "given", "side", "effecting", "function", "on", "each", "pixel", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L181-L183
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.contains
public boolean contains(Color color) { return exists(p -> p.toInt() == color.toPixel().toInt()); }
java
public boolean contains(Color color) { return exists(p -> p.toInt() == color.toPixel().toInt()); }
[ "public", "boolean", "contains", "(", "Color", "color", ")", "{", "return", "exists", "(", "p", "->", "p", ".", "toInt", "(", ")", "==", "color", ".", "toPixel", "(", ")", ".", "toInt", "(", ")", ")", ";", "}" ]
Returns true if a pixel with the given color exists @param color the pixel colour to look for. @return true if there exists at least one pixel that has the given pixels color
[ "Returns", "true", "if", "a", "pixel", "with", "the", "given", "color", "exists" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L205-L207
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.argb
public int[] argb(int x, int y) { Pixel p = pixel(x, y); return new int[]{p.alpha(), p.red(), p.green(), p.blue()}; }
java
public int[] argb(int x, int y) { Pixel p = pixel(x, y); return new int[]{p.alpha(), p.red(), p.green(), p.blue()}; }
[ "public", "int", "[", "]", "argb", "(", "int", "x", ",", "int", "y", ")", "{", "Pixel", "p", "=", "pixel", "(", "x", ",", "y", ")", ";", "return", "new", "int", "[", "]", "{", "p", ".", "alpha", "(", ")", ",", "p", ".", "red", "(", ")", ...
Returns the ARGB components for the pixel at the given coordinates @param x the x coordinate of the pixel component to grab @param y the y coordinate of the pixel component to grab @return an array containing ARGB components in that order.
[ "Returns", "the", "ARGB", "components", "for", "the", "pixel", "at", "the", "given", "coordinates" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L235-L238
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.argb
public int[][] argb() { return Arrays.stream(points()).map(p -> argb(p.x, p.y)).toArray(int[][]::new); }
java
public int[][] argb() { return Arrays.stream(points()).map(p -> argb(p.x, p.y)).toArray(int[][]::new); }
[ "public", "int", "[", "]", "[", "]", "argb", "(", ")", "{", "return", "Arrays", ".", "stream", "(", "points", "(", ")", ")", ".", "map", "(", "p", "->", "argb", "(", "p", ".", "x", ",", "p", ".", "y", ")", ")", ".", "toArray", "(", "int", ...
Returns the ARGB components for all pixels in this image @return an array containing an array for each ARGB components in that order.
[ "Returns", "the", "ARGB", "components", "for", "all", "pixels", "in", "this", "image" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L245-L247
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.colours
public Set<RGBColor> colours() { return stream().map(Pixel::toColor).collect(Collectors.toSet()); }
java
public Set<RGBColor> colours() { return stream().map(Pixel::toColor).collect(Collectors.toSet()); }
[ "public", "Set", "<", "RGBColor", ">", "colours", "(", ")", "{", "return", "stream", "(", ")", ".", "map", "(", "Pixel", "::", "toColor", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}" ]
Returns a set of the distinct colours used in this image. @return the set of distinct Colors
[ "Returns", "a", "set", "of", "the", "distinct", "colours", "used", "in", "this", "image", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L332-L334
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.toNewBufferedImage
public BufferedImage toNewBufferedImage(int type) { BufferedImage target = new BufferedImage(width, height, type); Graphics2D g2 = (Graphics2D) target.getGraphics(); g2.drawImage(awt, 0, 0, null); g2.dispose(); return target; }
java
public BufferedImage toNewBufferedImage(int type) { BufferedImage target = new BufferedImage(width, height, type); Graphics2D g2 = (Graphics2D) target.getGraphics(); g2.drawImage(awt, 0, 0, null); g2.dispose(); return target; }
[ "public", "BufferedImage", "toNewBufferedImage", "(", "int", "type", ")", "{", "BufferedImage", "target", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "type", ")", ";", "Graphics2D", "g2", "=", "(", "Graphics2D", ")", "target", ".", "getGra...
Returns a new AWT BufferedImage from this image. @param type the type of buffered image to create, if not specified then defaults to the current image type @return a new, non-shared, BufferedImage with the same data as this Image.
[ "Returns", "a", "new", "AWT", "BufferedImage", "from", "this", "image", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L366-L372
train
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java
DimensionTools.dimensionsToFit
public static Dimension dimensionsToFit(Dimension target, Dimension source) { // if target width/height is zero then we have no preference for that, so set it to the original value, // since it cannot be any larger int maxWidth; if (target.getX() == 0) { maxWidth = source.getX(); } else { maxWidth = target.getX(); } int maxHeight; if (target.getY() == 0) { maxHeight = source.getY(); } else { maxHeight = target.getY(); } double wscale = maxWidth / (double) source.getX(); double hscale = maxHeight / (double) source.getY(); if (wscale < hscale) return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale)); else return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale)); }
java
public static Dimension dimensionsToFit(Dimension target, Dimension source) { // if target width/height is zero then we have no preference for that, so set it to the original value, // since it cannot be any larger int maxWidth; if (target.getX() == 0) { maxWidth = source.getX(); } else { maxWidth = target.getX(); } int maxHeight; if (target.getY() == 0) { maxHeight = source.getY(); } else { maxHeight = target.getY(); } double wscale = maxWidth / (double) source.getX(); double hscale = maxHeight / (double) source.getY(); if (wscale < hscale) return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale)); else return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale)); }
[ "public", "static", "Dimension", "dimensionsToFit", "(", "Dimension", "target", ",", "Dimension", "source", ")", "{", "// if target width/height is zero then we have no preference for that, so set it to the original value,", "// since it cannot be any larger", "int", "maxWidth", ";",...
Returns width and height that allow the given source width, height to fit inside the target width, height without losing aspect ratio
[ "Returns", "width", "and", "height", "that", "allow", "the", "given", "source", "width", "height", "to", "fit", "inside", "the", "target", "width", "height", "without", "losing", "aspect", "ratio" ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java#L42-L67
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/GammaFilter.java
GammaFilter.setGamma
public void setGamma(float rGamma, float gGamma, float bGamma) { this.rGamma = rGamma; this.gGamma = gGamma; this.bGamma = bGamma; initialized = false; }
java
public void setGamma(float rGamma, float gGamma, float bGamma) { this.rGamma = rGamma; this.gGamma = gGamma; this.bGamma = bGamma; initialized = false; }
[ "public", "void", "setGamma", "(", "float", "rGamma", ",", "float", "gGamma", ",", "float", "bGamma", ")", "{", "this", ".", "rGamma", "=", "rGamma", ";", "this", ".", "gGamma", "=", "gGamma", ";", "this", ".", "bGamma", "=", "bGamma", ";", "initialize...
Set the gamma levels. @param rGamma the gamma level for the red channel @param gGamma the gamma level for the blue channel @param bGamma the gamma level for the green channel @see #getGamma
[ "Set", "the", "gamma", "levels", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/GammaFilter.java#L58-L63
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java
ArrayColormap.setColorInterpolated
public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) { int firstColor = map[firstIndex]; int lastColor = map[lastIndex]; for (int i = firstIndex; i <= index; i++) map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color); for (int i = index; i < lastIndex; i++) map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor); }
java
public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) { int firstColor = map[firstIndex]; int lastColor = map[lastIndex]; for (int i = firstIndex; i <= index; i++) map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color); for (int i = index; i < lastIndex; i++) map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor); }
[ "public", "void", "setColorInterpolated", "(", "int", "index", ",", "int", "firstIndex", ",", "int", "lastIndex", ",", "int", "color", ")", "{", "int", "firstColor", "=", "map", "[", "firstIndex", "]", ";", "int", "lastColor", "=", "map", "[", "lastIndex",...
Set the color at "index" to "color". Entries are interpolated linearly from the existing entries at "firstIndex" and "lastIndex" to the new entry. firstIndex < index < lastIndex must hold. @param index the position to set @param firstIndex the position of the first color from which to interpolate @param lastIndex the position of the second color from which to interpolate @param color the color to set
[ "Set", "the", "color", "at", "index", "to", "color", ".", "Entries", "are", "interpolated", "linearly", "from", "the", "existing", "entries", "at", "firstIndex", "and", "lastIndex", "to", "the", "new", "entry", ".", "firstIndex", "<", "index", "<", "lastInde...
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L107-L114
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java
ArrayColormap.setColorRange
public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) { for (int i = firstIndex; i <= lastIndex; i++) map[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2); }
java
public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) { for (int i = firstIndex; i <= lastIndex; i++) map[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2); }
[ "public", "void", "setColorRange", "(", "int", "firstIndex", ",", "int", "lastIndex", ",", "int", "color1", ",", "int", "color2", ")", "{", "for", "(", "int", "i", "=", "firstIndex", ";", "i", "<=", "lastIndex", ";", "i", "++", ")", "map", "[", "i", ...
Set a range of the colormap, interpolating between two colors. @param firstIndex the position of the first color @param lastIndex the position of the second color @param color1 the first color @param color2 the second color
[ "Set", "a", "range", "of", "the", "colormap", "interpolating", "between", "two", "colors", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L123-L126
train
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java
ArrayColormap.setColorRange
public void setColorRange(int firstIndex, int lastIndex, int color) { for (int i = firstIndex; i <= lastIndex; i++) map[i] = color; }
java
public void setColorRange(int firstIndex, int lastIndex, int color) { for (int i = firstIndex; i <= lastIndex; i++) map[i] = color; }
[ "public", "void", "setColorRange", "(", "int", "firstIndex", ",", "int", "lastIndex", ",", "int", "color", ")", "{", "for", "(", "int", "i", "=", "firstIndex", ";", "i", "<=", "lastIndex", ";", "i", "++", ")", "map", "[", "i", "]", "=", "color", ";...
Set a range of the colormap to a single color. @param firstIndex the position of the first color @param lastIndex the position of the second color @param color the color
[ "Set", "a", "range", "of", "the", "colormap", "to", "a", "single", "color", "." ]
52dab448136e6657a71951b0e6b7d5e64dc979ac
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L134-L137
train
johnkil/Android-AppMsg
sample/src/com/devspark/appmsg/sample/MainActivity.java
MainActivity.buttonClick
public void buttonClick(View v) { switch (v.getId()) { case R.id.show: showAppMsg(); break; case R.id.cancel_all: AppMsg.cancelAll(this); break; default: return; } }
java
public void buttonClick(View v) { switch (v.getId()) { case R.id.show: showAppMsg(); break; case R.id.cancel_all: AppMsg.cancelAll(this); break; default: return; } }
[ "public", "void", "buttonClick", "(", "View", "v", ")", "{", "switch", "(", "v", ".", "getId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "show", ":", "showAppMsg", "(", ")", ";", "break", ";", "case", "R", ".", "id", ".", "cancel_all", "...
Button onClick listener. @param v
[ "Button", "onClick", "listener", "." ]
e7fdd7870530a24e6d825278ee0863be0521e8b8
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/sample/src/com/devspark/appmsg/sample/MainActivity.java#L97-L108
train
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.getLayoutParams
public LayoutParams getLayoutParams() { if (mLayoutParams == null) { mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } return mLayoutParams; }
java
public LayoutParams getLayoutParams() { if (mLayoutParams == null) { mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } return mLayoutParams; }
[ "public", "LayoutParams", "getLayoutParams", "(", ")", "{", "if", "(", "mLayoutParams", "==", "null", ")", "{", "mLayoutParams", "=", "new", "LayoutParams", "(", "LayoutParams", ".", "MATCH_PARENT", ",", "LayoutParams", ".", "WRAP_CONTENT", ")", ";", "}", "ret...
Gets the crouton's layout parameters, constructing a default if necessary. @return the layout parameters
[ "Gets", "the", "crouton", "s", "layout", "parameters", "constructing", "a", "default", "if", "necessary", "." ]
e7fdd7870530a24e6d825278ee0863be0521e8b8
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L549-L554
train
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.setLayoutGravity
public AppMsg setLayoutGravity(int gravity) { mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, gravity); return this; }
java
public AppMsg setLayoutGravity(int gravity) { mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, gravity); return this; }
[ "public", "AppMsg", "setLayoutGravity", "(", "int", "gravity", ")", "{", "mLayoutParams", "=", "new", "FrameLayout", ".", "LayoutParams", "(", "LayoutParams", ".", "MATCH_PARENT", ",", "LayoutParams", ".", "WRAP_CONTENT", ",", "gravity", ")", ";", "return", "thi...
Constructs and sets the layout parameters to have some gravity. @param gravity the gravity of the Crouton @return <code>this</code>, for chaining. @see android.view.Gravity
[ "Constructs", "and", "sets", "the", "layout", "parameters", "to", "have", "some", "gravity", "." ]
e7fdd7870530a24e6d825278ee0863be0521e8b8
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L574-L577
train
Unleash/unleash-client-java
src/main/java/no/finn/unleash/strategy/StrategyUtils.java
StrategyUtils.getPercentage
public static int getPercentage(String percentage) { if (isNotEmpty(percentage) && isNumeric(percentage)) { int p = Integer.parseInt(percentage); return p; } else { return 0; } }
java
public static int getPercentage(String percentage) { if (isNotEmpty(percentage) && isNumeric(percentage)) { int p = Integer.parseInt(percentage); return p; } else { return 0; } }
[ "public", "static", "int", "getPercentage", "(", "String", "percentage", ")", "{", "if", "(", "isNotEmpty", "(", "percentage", ")", "&&", "isNumeric", "(", "percentage", ")", ")", "{", "int", "p", "=", "Integer", ".", "parseInt", "(", "percentage", ")", ...
Takes a numeric string value and converts it to a integer between 0 and 100. returns 0 if the string is not numeric. @param percentage - A numeric string value @return a integer between 0 and 100
[ "Takes", "a", "numeric", "string", "value", "and", "converts", "it", "to", "a", "integer", "between", "0", "and", "100", "." ]
4d135ceb9ad8a0e74d6f4d1b333a80a4b59afd2d
https://github.com/Unleash/unleash-client-java/blob/4d135ceb9ad8a0e74d6f4d1b333a80a4b59afd2d/src/main/java/no/finn/unleash/strategy/StrategyUtils.java#L54-L61
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/App.java
App.named
public App named(String name) { App newApp = copy(); newApp.name = name; return newApp; }
java
public App named(String name) { App newApp = copy(); newApp.name = name; return newApp; }
[ "public", "App", "named", "(", "String", "name", ")", "{", "App", "newApp", "=", "copy", "(", ")", ";", "newApp", ".", "name", "=", "name", ";", "return", "newApp", ";", "}" ]
Builder method for specifying the name of an app. @param name The name to give an app. @return A copy of the {@link App}
[ "Builder", "method", "for", "specifying", "the", "name", "of", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/App.java#L35-L39
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/App.java
App.on
public App on(Heroku.Stack stack) { App newApp = copy(); newApp.stack = new App.Stack(stack); return newApp; }
java
public App on(Heroku.Stack stack) { App newApp = copy(); newApp.stack = new App.Stack(stack); return newApp; }
[ "public", "App", "on", "(", "Heroku", ".", "Stack", "stack", ")", "{", "App", "newApp", "=", "copy", "(", ")", ";", "newApp", ".", "stack", "=", "new", "App", ".", "Stack", "(", "stack", ")", ";", "return", "newApp", ";", "}" ]
Builder method for specifying the stack an app should be created on. @param stack Stack to create the app on. @return A copy of the {@link App}
[ "Builder", "method", "for", "specifying", "the", "stack", "an", "app", "should", "be", "created", "on", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/App.java#L46-L50
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listApps
public Range<App> listApps(String range) { return connection.execute(new AppList(range), apiKey); }
java
public Range<App> listApps(String range) { return connection.execute(new AppList(range), apiKey); }
[ "public", "Range", "<", "App", ">", "listApps", "(", "String", "range", ")", "{", "return", "connection", ".", "execute", "(", "new", "AppList", "(", "range", ")", ",", "apiKey", ")", ";", "}" ]
List all apps for the current user's account. @param range The range of apps provided by {@link Range#getNextRange()} @return a list of apps
[ "List", "all", "apps", "for", "the", "current", "user", "s", "account", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L134-L136
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.renameApp
public String renameApp(String appName, String newName) { return connection.execute(new AppRename(appName, newName), apiKey).getName(); }
java
public String renameApp(String appName, String newName) { return connection.execute(new AppRename(appName, newName), apiKey).getName(); }
[ "public", "String", "renameApp", "(", "String", "appName", ",", "String", "newName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AppRename", "(", "appName", ",", "newName", ")", ",", "apiKey", ")", ".", "getName", "(", ")", ";", "}" ]
Rename an existing app. @param appName Existing app name. See {@link #listApps()} for names that can be used. @param newName New name to give the existing app. @return the new name of the object
[ "Rename", "an", "existing", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L196-L198
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.addAddon
public AddonChange addAddon(String appName, String addonName) { return connection.execute(new AddonInstall(appName, addonName), apiKey); }
java
public AddonChange addAddon(String appName, String addonName) { return connection.execute(new AddonInstall(appName, addonName), apiKey); }
[ "public", "AddonChange", "addAddon", "(", "String", "appName", ",", "String", "addonName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AddonInstall", "(", "appName", ",", "addonName", ")", ",", "apiKey", ")", ";", "}" ]
Add an addon to the app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param addonName Addon name. See {@link #listAllAddons} to get a list of addons that can be used. @return The request object
[ "Add", "an", "addon", "to", "the", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L214-L216
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listAppAddons
public List<Addon> listAppAddons(String appName) { return connection.execute(new AppAddonsList(appName), apiKey); }
java
public List<Addon> listAppAddons(String appName) { return connection.execute(new AppAddonsList(appName), apiKey); }
[ "public", "List", "<", "Addon", ">", "listAppAddons", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AppAddonsList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
List the addons already added to an app. @param appName new of the app @return a list of add-ons
[ "List", "the", "addons", "already", "added", "to", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L242-L244
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.removeAddon
public AddonChange removeAddon(String appName, String addonName) { return connection.execute(new AddonRemove(appName, addonName), apiKey); }
java
public AddonChange removeAddon(String appName, String addonName) { return connection.execute(new AddonRemove(appName, addonName), apiKey); }
[ "public", "AddonChange", "removeAddon", "(", "String", "appName", ",", "String", "addonName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AddonRemove", "(", "appName", ",", "addonName", ")", ",", "apiKey", ")", ";", "}" ]
Remove an addon from an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param addonName Addon name. See {@link #listAppAddons} for a list of addons that can be used. @return the request object
[ "Remove", "an", "addon", "from", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L252-L254
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listReleases
public List<Release> listReleases(String appName) { return connection.execute(new ReleaseList(appName), apiKey); }
java
public List<Release> listReleases(String appName) { return connection.execute(new ReleaseList(appName), apiKey); }
[ "public", "List", "<", "Release", ">", "listReleases", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "ReleaseList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
List of releases for an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @return a list of releases
[ "List", "of", "releases", "for", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L263-L265
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.rollback
public Release rollback(String appName, String releaseUuid) { return connection.execute(new Rollback(appName, releaseUuid), apiKey); }
java
public Release rollback(String appName, String releaseUuid) { return connection.execute(new Rollback(appName, releaseUuid), apiKey); }
[ "public", "Release", "rollback", "(", "String", "appName", ",", "String", "releaseUuid", ")", "{", "return", "connection", ".", "execute", "(", "new", "Rollback", "(", "appName", ",", "releaseUuid", ")", ",", "apiKey", ")", ";", "}" ]
Rollback an app to a specific release. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param releaseUuid Release UUID. See {@link #listReleases} for a list of the app's releases. @return the release object
[ "Rollback", "an", "app", "to", "a", "specific", "release", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L283-L285
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.getReleaseInfo
public Release getReleaseInfo(String appName, String releaseName) { return connection.execute(new ReleaseInfo(appName, releaseName), apiKey); }
java
public Release getReleaseInfo(String appName, String releaseName) { return connection.execute(new ReleaseInfo(appName, releaseName), apiKey); }
[ "public", "Release", "getReleaseInfo", "(", "String", "appName", ",", "String", "releaseName", ")", "{", "return", "connection", ".", "execute", "(", "new", "ReleaseInfo", "(", "appName", ",", "releaseName", ")", ",", "apiKey", ")", ";", "}" ]
Information about a specific release. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param releaseName Release name. See {@link #listReleases} for a list of the app's releases. @return the release object
[ "Information", "about", "a", "specific", "release", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L293-L295
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listCollaborators
public List<Collaborator> listCollaborators(String appName) { return connection.execute(new CollabList(appName), apiKey); }
java
public List<Collaborator> listCollaborators(String appName) { return connection.execute(new CollabList(appName), apiKey); }
[ "public", "List", "<", "Collaborator", ">", "listCollaborators", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "CollabList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
Get a list of collaborators that are allowed access to an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @return list of collaborators
[ "Get", "a", "list", "of", "collaborators", "that", "are", "allowed", "access", "to", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L302-L304
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.addCollaborator
public void addCollaborator(String appName, String collaborator) { connection.execute(new SharingAdd(appName, collaborator), apiKey); }
java
public void addCollaborator(String appName, String collaborator) { connection.execute(new SharingAdd(appName, collaborator), apiKey); }
[ "public", "void", "addCollaborator", "(", "String", "appName", ",", "String", "collaborator", ")", "{", "connection", ".", "execute", "(", "new", "SharingAdd", "(", "appName", ",", "collaborator", ")", ",", "apiKey", ")", ";", "}" ]
Add a collaborator to an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param collaborator Username of the collaborator to add. This is usually in the form of "user@company.com".
[ "Add", "a", "collaborator", "to", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L311-L313
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.removeCollaborator
public void removeCollaborator(String appName, String collaborator) { connection.execute(new SharingRemove(appName, collaborator), apiKey); }
java
public void removeCollaborator(String appName, String collaborator) { connection.execute(new SharingRemove(appName, collaborator), apiKey); }
[ "public", "void", "removeCollaborator", "(", "String", "appName", ",", "String", "collaborator", ")", "{", "connection", ".", "execute", "(", "new", "SharingRemove", "(", "appName", ",", "collaborator", ")", ",", "apiKey", ")", ";", "}" ]
Remove a collaborator from an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param collaborator See {@link #listCollaborators} for collaborators that can be removed from the app.
[ "Remove", "a", "collaborator", "from", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L320-L322
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.updateConfig
public void updateConfig(String appName, Map<String, String> config) { connection.execute(new ConfigUpdate(appName, config), apiKey); }
java
public void updateConfig(String appName, Map<String, String> config) { connection.execute(new ConfigUpdate(appName, config), apiKey); }
[ "public", "void", "updateConfig", "(", "String", "appName", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "connection", ".", "execute", "(", "new", "ConfigUpdate", "(", "appName", ",", "config", ")", ",", "apiKey", ")", ";", "}" ]
Update environment variables to an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param config Key/Value pairs of environment variables.
[ "Update", "environment", "variables", "to", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L329-L331
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listConfig
public Map<String, String> listConfig(String appName) { return connection.execute(new ConfigList(appName), apiKey); }
java
public Map<String, String> listConfig(String appName) { return connection.execute(new ConfigList(appName), apiKey); }
[ "public", "Map", "<", "String", ",", "String", ">", "listConfig", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "ConfigList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
List all the environment variables for an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @return map of config vars
[ "List", "all", "the", "environment", "variables", "for", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L338-L340
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.transferApp
public void transferApp(String appName, String to) { connection.execute(new SharingTransfer(appName, to), apiKey); }
java
public void transferApp(String appName, String to) { connection.execute(new SharingTransfer(appName, to), apiKey); }
[ "public", "void", "transferApp", "(", "String", "appName", ",", "String", "to", ")", "{", "connection", ".", "execute", "(", "new", "SharingTransfer", "(", "appName", ",", "to", ")", ",", "apiKey", ")", ";", "}" ]
Transfer the ownership of an application to another user. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param to Username of the person to transfer the app to. This is usually in the form of "user@company.com".
[ "Transfer", "the", "ownership", "of", "an", "application", "to", "another", "user", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L347-L349
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.getLogs
public LogStreamResponse getLogs(String appName, Boolean tail) { return connection.execute(new Log(appName, tail), apiKey); }
java
public LogStreamResponse getLogs(String appName, Boolean tail) { return connection.execute(new Log(appName, tail), apiKey); }
[ "public", "LogStreamResponse", "getLogs", "(", "String", "appName", ",", "Boolean", "tail", ")", "{", "return", "connection", ".", "execute", "(", "new", "Log", "(", "appName", ",", "tail", ")", ",", "apiKey", ")", ";", "}" ]
Get logs for an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @return log stream response
[ "Get", "logs", "for", "an", "app", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L365-L367
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.getLogs
public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) { return connection.execute(new Log(logRequest), apiKey); }
java
public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) { return connection.execute(new Log(logRequest), apiKey); }
[ "public", "LogStreamResponse", "getLogs", "(", "Log", ".", "LogRequestBuilder", "logRequest", ")", "{", "return", "connection", ".", "execute", "(", "new", "Log", "(", "logRequest", ")", ",", "apiKey", ")", ";", "}" ]
Get logs for an app by specifying additional parameters. @param logRequest See {LogRequestBuilder} @return log stream response
[ "Get", "logs", "for", "an", "app", "by", "specifying", "additional", "parameters", "." ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L374-L376
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.isMaintenanceModeEnabled
public boolean isMaintenanceModeEnabled(String appName) { App app = connection.execute(new AppInfo(appName), apiKey); return app.isMaintenance(); }
java
public boolean isMaintenanceModeEnabled(String appName) { App app = connection.execute(new AppInfo(appName), apiKey); return app.isMaintenance(); }
[ "public", "boolean", "isMaintenanceModeEnabled", "(", "String", "appName", ")", "{", "App", "app", "=", "connection", ".", "execute", "(", "new", "AppInfo", "(", "appName", ")", ",", "apiKey", ")", ";", "return", "app", ".", "isMaintenance", "(", ")", ";",...
Checks if maintenance mode is enabled for the given app @param appName See {@link #listApps} for a list of apps that can be used. @return true if maintenance mode is enabled
[ "Checks", "if", "maintenance", "mode", "is", "enabled", "for", "the", "given", "app" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L392-L395
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.setMaintenanceMode
public void setMaintenanceMode(String appName, boolean enable) { connection.execute(new AppUpdate(appName, enable), apiKey); }
java
public void setMaintenanceMode(String appName, boolean enable) { connection.execute(new AppUpdate(appName, enable), apiKey); }
[ "public", "void", "setMaintenanceMode", "(", "String", "appName", ",", "boolean", "enable", ")", "{", "connection", ".", "execute", "(", "new", "AppUpdate", "(", "appName", ",", "enable", ")", ",", "apiKey", ")", ";", "}" ]
Sets maintenance mode for the given app @param appName See {@link #listApps} for a list of apps that can be used. @param enable true to enable; false to disable
[ "Sets", "maintenance", "mode", "for", "the", "given", "app" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L403-L405
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.createBuild
public Build createBuild(String appName, Build build) { return connection.execute(new BuildCreate(appName, build), apiKey); }
java
public Build createBuild(String appName, Build build) { return connection.execute(new BuildCreate(appName, build), apiKey); }
[ "public", "Build", "createBuild", "(", "String", "appName", ",", "Build", "build", ")", "{", "return", "connection", ".", "execute", "(", "new", "BuildCreate", "(", "appName", ",", "build", ")", ",", "apiKey", ")", ";", "}" ]
Creates a build @param appName See {@link #listApps} for a list of apps that can be used. @param build the build information
[ "Creates", "a", "build" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L441-L443
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.getBuildInfo
public Build getBuildInfo(String appName, String buildId) { return connection.execute(new BuildInfo(appName, buildId), apiKey); }
java
public Build getBuildInfo(String appName, String buildId) { return connection.execute(new BuildInfo(appName, buildId), apiKey); }
[ "public", "Build", "getBuildInfo", "(", "String", "appName", ",", "String", "buildId", ")", "{", "return", "connection", ".", "execute", "(", "new", "BuildInfo", "(", "appName", ",", "buildId", ")", ",", "apiKey", ")", ";", "}" ]
Gets the info for a running build @param appName See {@link #listApps} for a list of apps that can be used. @param buildId the unique identifier of the build
[ "Gets", "the", "info", "for", "a", "running", "build" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L451-L453
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listDynos
public Range<Dyno> listDynos(String appName) { return connection.execute(new DynoList(appName), apiKey); }
java
public Range<Dyno> listDynos(String appName) { return connection.execute(new DynoList(appName), apiKey); }
[ "public", "Range", "<", "Dyno", ">", "listDynos", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "DynoList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
List app dynos for an app @param appName See {@link #listApps} for a list of apps that can be used.
[ "List", "app", "dynos", "for", "an", "app" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L460-L462
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.restartDyno
public void restartDyno(String appName, String dynoId) { connection.execute(new DynoRestart(appName, dynoId), apiKey); }
java
public void restartDyno(String appName, String dynoId) { connection.execute(new DynoRestart(appName, dynoId), apiKey); }
[ "public", "void", "restartDyno", "(", "String", "appName", ",", "String", "dynoId", ")", "{", "connection", ".", "execute", "(", "new", "DynoRestart", "(", "appName", ",", "dynoId", ")", ",", "apiKey", ")", ";", "}" ]
Restarts a single dyno @param appName See {@link #listApps} for a list of apps that can be used. @param dynoId the unique identifier of the dyno to restart
[ "Restarts", "a", "single", "dyno" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L470-L472
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.scale
public Formation scale(String appName, String processType, int quantity) { return connection.execute(new FormationUpdate(appName, processType, quantity), apiKey); }
java
public Formation scale(String appName, String processType, int quantity) { return connection.execute(new FormationUpdate(appName, processType, quantity), apiKey); }
[ "public", "Formation", "scale", "(", "String", "appName", ",", "String", "processType", ",", "int", "quantity", ")", "{", "return", "connection", ".", "execute", "(", "new", "FormationUpdate", "(", "appName", ",", "processType", ",", "quantity", ")", ",", "a...
Scales a process type @param appName See {@link #listApps} for a list of apps that can be used. @param processType type of process to maintain @param quantity number of processes to maintain
[ "Scales", "a", "process", "type" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L490-L492
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listFormation
public List<Formation> listFormation(String appName) { return connection.execute(new FormationList(appName), apiKey); }
java
public List<Formation> listFormation(String appName) { return connection.execute(new FormationList(appName), apiKey); }
[ "public", "List", "<", "Formation", ">", "listFormation", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "FormationList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
Lists the formation info for an app @param appName See {@link #listApps} for a list of apps that can be used.
[ "Lists", "the", "formation", "info", "for", "an", "app" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L499-L501
train
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.listBuildpackInstallations
public List<BuildpackInstallation> listBuildpackInstallations(String appName) { return connection.execute(new BuildpackInstallationList(appName), apiKey); }
java
public List<BuildpackInstallation> listBuildpackInstallations(String appName) { return connection.execute(new BuildpackInstallationList(appName), apiKey); }
[ "public", "List", "<", "BuildpackInstallation", ">", "listBuildpackInstallations", "(", "String", "appName", ")", "{", "return", "connection", ".", "execute", "(", "new", "BuildpackInstallationList", "(", "appName", ")", ",", "apiKey", ")", ";", "}" ]
Lists the buildpacks installed on an app @param appName See {@link #listApps} for a list of apps that can be used.
[ "Lists", "the", "buildpacks", "installed", "on", "an", "app" ]
d9e52991293159498c10c498c6f91fcdd637378e
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L508-L510
train