Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.faces.RawScale2x Class Reference

A simple implementation of the Scale2x algorithm for scaling raw image data. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.faces.RawScale2x:

Public Member Functions

int [] getScaledData ()
 Gets the scale image data. More...
 
 RawScale2x (@NotNull final int[] imageData, final int dataWidth, final int dataHeight)
 Creates a new scaler based on some raw data. More...
 

Private Member Functions

int getSourcePixel (final int x, final int y)
 Gets a pixel from the source image. More...
 
void process (final int x, final int y)
 Processes a specific pixel. More...
 
void setDestPixel (final int x, final int y, final int p)
 Sets a pixel in the destination image data. More...
 

Static Private Member Functions

static boolean different (final int a, final int b)
 Checks if two pixels are different. More...
 

Private Attributes

final int [] dstImage
 The destination image data. More...
 
final int height
 The height of the source image. More...
 
final int [] srcImage
 The source image data. More...
 
final int width
 The width of the source image. More...
 

Detailed Description

A simple implementation of the Scale2x algorithm for scaling raw image data.

Author
Kevin Glass

Definition at line 30 of file RawScale2x.java.

Constructor & Destructor Documentation

◆ RawScale2x()

com.realtime.crossfire.jxclient.faces.RawScale2x.RawScale2x ( @NotNull final int []  imageData,
final int  dataWidth,
final int  dataHeight 
)

Creates a new scaler based on some raw data.

Right now it doesn't matter what order the channels in, just that its an int per pixel

Parameters
imageDatathe source image data
dataWidththe width of the source image
dataHeightthe height of the source image

Definition at line 61 of file RawScale2x.java.

Member Function Documentation

◆ different()

static boolean com.realtime.crossfire.jxclient.faces.RawScale2x.different ( final int  a,
final int  b 
)
staticprivate

Checks if two pixels are different.

Place holder for maybe some clever code about tolerance checking.

Parameters
athe first pixel value
bthe second pixel value
Returns
true
if the pixels are different

Definition at line 76 of file RawScale2x.java.

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.process().

+ Here is the caller graph for this function:

◆ getScaledData()

int [] com.realtime.crossfire.jxclient.faces.RawScale2x.getScaledData ( )

Gets the scale image data.

Note this is the method that does the work so it might take some time to process.

Returns
an array of pixels 4 times the size of the input array containing the smoothly scaled image

Definition at line 148 of file RawScale2x.java.

References com.realtime.crossfire.jxclient.faces.RawScale2x.dstImage, com.realtime.crossfire.jxclient.faces.RawScale2x.height, com.realtime.crossfire.jxclient.faces.RawScale2x.process(), and com.realtime.crossfire.jxclient.faces.RawScale2x.width.

Referenced by com.realtime.crossfire.jxclient.faces.ImageScale2x.getScaledImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSourcePixel()

int com.realtime.crossfire.jxclient.faces.RawScale2x.getSourcePixel ( final int  x,
final int  y 
)
private

Gets a pixel from the source image.

This handles bonds checks and resolves to edge pixels.

Parameters
xthe x location of the pixel to retrieve
ythe y location of the pixel to retrieve
Returns
the pixel value at the specified location

Definition at line 97 of file RawScale2x.java.

References com.realtime.crossfire.jxclient.faces.RawScale2x.width.

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.process().

+ Here is the caller graph for this function:

◆ process()

void com.realtime.crossfire.jxclient.faces.RawScale2x.process ( final int  x,
final int  y 
)
private

Processes a specific pixel.

This will generate 4 pixels in the destination image based on the scale2x algorithm.

Parameters
xthe x location in the source image of the pixel to process
ythe y location in the source image of the pixel to process

Definition at line 109 of file RawScale2x.java.

References com.realtime.crossfire.jxclient.faces.RawScale2x.different(), com.realtime.crossfire.jxclient.faces.RawScale2x.getSourcePixel(), and com.realtime.crossfire.jxclient.faces.RawScale2x.setDestPixel().

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.getScaledData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDestPixel()

void com.realtime.crossfire.jxclient.faces.RawScale2x.setDestPixel ( final int  x,
final int  y,
final int  p 
)
private

Sets a pixel in the destination image data.

Parameters
xthe x location of the pixel to set
ythe y location of the pixel to set
pthe value of the pixel to set

Definition at line 86 of file RawScale2x.java.

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.process().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dstImage

final int [] com.realtime.crossfire.jxclient.faces.RawScale2x.dstImage
private

The destination image data.

Definition at line 42 of file RawScale2x.java.

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.getScaledData().

◆ height

final int com.realtime.crossfire.jxclient.faces.RawScale2x.height
private

The height of the source image.

Definition at line 52 of file RawScale2x.java.

Referenced by com.realtime.crossfire.jxclient.faces.RawScale2x.getScaledData().

◆ srcImage

final int [] com.realtime.crossfire.jxclient.faces.RawScale2x.srcImage
private

The source image data.

Definition at line 36 of file RawScale2x.java.

◆ width

final int com.realtime.crossfire.jxclient.faces.RawScale2x.width
private

The documentation for this class was generated from the following file: