input
stringlengths
10
828
output
stringlengths
5
107
public void move left if set image offset offset x 1 offset y repaint
move the image one pixel to the left
public composite get main container return main container
returns the main container composite
private buffered image get resized image nearest buffered image image double width factor double height factor affine transform tx new affine transform use affine transform class to do the resizing tx scale width factor height factor affine transform op op new affine transform op tx affine transform op type nearest neighbor return op filter image null
returns a new resized image using the
private void show ioreading error int swt icon string title string message notify the user in a new thread with the given message message box mb new message box s shell swt icon mb set text title mb set message message mb open
display a message box given its icon
public void move right if set image offset offset x 1 offset y repaint
move the image one pixel to the right
private runnable gui updater final float percentage done final object source object return new runnable public void run if s shell is disposed progress bar is disposed source abort source object return s shell get display async exec new runnable public void run if progress bar is disposed progress bar set selection math round percentage done if cancel operation source abort source object s shell dispose if percentage done 100 0 s shell dispose
returns a new runnable used to update the dialog used by this class
public void move up if set image offset offset x offset y 1 repaint
move the image up with one pixel
public void redraw drawing container drawing container repaint
ask the projects drawing container to repaint its image
public buffered image get current image buffered image result new buffered image awt container composite width awt container composite height buffered image type int rgb drawing container paint image result get graphics return result
return a copy of the current drawing containers image
public void move down if set image offset offset x offset y 1 repaint
move the image down with one pixel
private void source abort object source object if source object instanceof image reader image reader source image reader source object source abort else if source object instanceof image writer image writer source image writer source object source abort
tells the given object to abort its operation
public void register mouse listener mouse listener mouse listener drawing container add mouse listener mouse listener
adds the specified mouse listener to receive mouse motion events
public void register mouse motion listener mouse motion listener mouse motion listener drawing container add mouse motion listener mouse motion listener
adds the specified mouse motion listener to receive mouse motion events
public void adjust scale int scale value scale value 15 double width factor double scale value 35 1 double height factor double scale value 35 1 if width factor 0 resized image resize image resized image original width factor 2 height factor 2 rotate image set image offset offset x offset y repaint
method that adjusts the image scale
private void set current color java awt color color scribble set current color color
change the scribbles current color
private void set stroke basic stroke stroke scribble set stroke stroke
sets the stroke used for drawing
private void set alpha opacity alpha composite ac scribble set alpha opacity ac
change the scribble drawing opacity
private int list all directory files file hairstyles directory int res 0 for file f hairstyles directory list files if f is directory f get name equals cvs res list all directory files f else if f is file res return res
process the given directory and count all the files in it
private void table item selected try button set image table list table get selection 0 get image 0 button set tool tip text table list table get selection 0 get text 1 if table selection listener null notify image on button changed event evt new event evt widget button evt item table list table get selection 0 table selection listener widget selected new selection event evt catch exception e possible table is empty no problem
update the button values every time a table item is selected
private tabs container get current tabs container for control c get main container get children if c instanceof tabs container tabs container t tabs container c if t is visible return t return null
returns the current visible tabs container or null if none is visible
public void tab disposed boolean tab visible exists false for control c get main container get children if c instanceof tabs container tabs container t tabs container c if t is visible tab visible exists true break if tab visible exists mirror composite set visible true
inform this instance of main window that a project tabs container was disposed
private void hide table list table list s shell set visible false
hide the table by setting its shell visible false
protected void widget disposed dispose event e if is background color disposable background color dispose outer color dispose inner color dispose my white dispose foreground upper color my white dispose foreground lower color my white dispose mouse up white dispose mouse down white dispose selected color dispose
dispose the used resources on widget disposed event
public void set text string string button set text string
sets the receivers text
private void draw borders gc gc int width int height color outer color inner if is selected outer selected color gc set foreground outer gc draw rectangle 0 0 width height gc set foreground inner gc draw rectangle 1 1 width 2 height 2
update the buttons borders colors
public void set visible item count int count if count 0 count 0 visible item count count
sets the number of items that are visible in the drop
public table item add table item int style return new table item table list table style
constructs a new instance of table item class given a style value
private rgb get upper color color color int new red color get red 10 255 255 color get red 10 int new green color get green 10 255 255 color get green 10 int new blue color get blue 10 255 255 color get blue 10 return new rgb new red new green new blue
given a color return a brighter rgb color description
public void set page increment int value if value 1 return page increment value
sets the amount that the receivers value will be
private rgb get lower color color color int new red color get red 10 0 0 color get red 10 int new green color get green 10 0 0 color get green 10 int new blue color get blue 10 0 0 color get blue 10 return new rgb new red new green new blue
given a color return a darker rgb color description
private void create composite image area grid data for the composite grid data grid data composite new grid data grid data composite horizontal alignment org eclipse swt layout grid data fill grid data composite grab excess vertical space true grid data composite vertical alignment org eclipse swt layout grid data fill initialize the composite composite image area new composite s shell swt none composite image area set layout new grid layout composite image area set layout data grid data composite create the composite s children create composite awt swt
this method initializes composite image area
public void select int index table list table select index table item selected
selects the item at the given zero relative index in the receivers
public void set selected boolean is selected this is selected is selected if is selected redraw
change the selection state of this button
public void deselect table list table deselect all button set image null button set tool tip text null
deselects selected item in the receiver
public void push e e if list size max size list remove 0 list add e
pushes an item onto the top of this stack
private void extend color buttons behavior for final color button button colored button list button add mouse listener new org eclipse swt events mouse adapter public void mouse down org eclipse swt events mouse event e todo history is created but user may click cancel on eyes tracer and nothing is drawn tabs container create history step public void mouse up org eclipse swt events mouse event e if has eyes path tabs container set lens path create eye lens image if image area redraw allowed tabs container redraw image area this lens tab
color buttons should do more than just updating the
public int get selection index return table list table get selection index
returns the zero relative index of the item which is currently
private void initialize grid layout grid layout new grid layout grid layout margin height 0 grid layout margin width 0 this set layout grid layout undo stack new undo stack history step max undo history redo stack new stack history step
method that sets the tabs container layout and size
public void add mouse listener mouse listener listener button add mouse listener listener
adds the listener to the collection of listeners who will
public hair color data get hair color return hair color
the hair color data used for creating the preview image
public image get hair color image return hair color image
the sample preview image created with this instances hair color
public void init reading vars hair colors list new array list hair color data
reset this instances variables so that a new parsing can be made
private void clear image area eyes lens image null tab gui set selected color button null
clears this tabs image in the drawing area
public string to string return name name blending mode blending mode red red green green blue blue
a string representation for this hair color
public void set selected boolean is selected this is selected is selected if is selected current border color normal border color update border null
change the selection state of this button
private void update border gc given gc gc gc null if given gc null gc new gc get accessible get control else gc given gc int width get size x int height get size y if is selected current border color selected border color gc set foreground current border color gc draw rectangle 0 0 width 1 height 1 dispose the created gc if given gc null gc dispose
update the buttons border color using the given
private void widget disposed dispose event e if is background color disposable background color dispose normal border color dispose hover border color dispose clicked border color dispose selected border color dispose associated xml null todo necessary who should dispose the image is the caller for set background image image image if background image null background image dispose
dispose the used resources on widget disposed event
public boolean has eyes path return eyes general path null
check whether this tab instance has an associated eyes lens path
public file get hair style file return hair style file
the file that was used to create this hair style data
public image get thumbnail return thumbnail
a thumbnail containing this hair style which
public string get hair style name return hair style name
the name of this hair style
public string get hair type return hair type
the untranslated code for the type of the hair
public void init reading vars str thumbnail new string builder str content new string builder str highlights new string builder str shadow new string builder hair style type null hair style title null hair owner gender null hair owner name null
reset this instances variables so that a new parsing can be made
private void draw lens image graphics2 d g2d save the current composite java awt composite default composite g2d get composite set lens image opacity g2d set composite current composite opacity draw the lens image g2d draw image eyes lens image 0 0 null restore the g2d original composite g2d set composite default composite
draws the lens image using the given graphics context
public string get str thumbnail return str thumbnail to string
the hair thumbnail image in
public string get str content return str content to string
the hair image in
public string get str highlights return str highlights to string
the hair highlights in
public string get str shadow return str shadow to string
the hair shadow in
public string get hair owner gender return hair owner gender
the hair owners gender
public string get hair owner name return hair owner name
the hair owners name
public string get hair style title return hair style title
the hair title
public string get hair style type return hair style type
the hair owners gender
private void create composite top identation grid data for the composite grid data grid data composite new grid data grid data composite horizontal span 2 grid data composite grab excess horizontal space true grid data composite horizontal alignment org eclipse swt layout grid data fill initialize the composite composite top identation new composite s shell swt none composite top identation set layout new grid layout composite top identation set layout data grid data composite
this method initializes composite top identation
public scale get stroke scale return size scale
returns the current size scale value
public scale get alpha scale return opacity scale
returns the current opacity scale value
public void set selected color button color button cb if cb null if selected button null selected button set selected false selected button null else if selected button null selected button set selected false selected button cb selected button set selected true color difference set current color cb get background color difference set new color cb get background cb redraw
select a given colored button
public color button get selected button return selected button
returns the current selected colored button
private void resplit layers set s the new selected tab available to be used by get current tab currnet tab tab container tab folder get item tab folder get selection index get control current tab is being used by lower and upper methods so needs to be initialized before calling the methods resplit layers lower resplit layers upper
method that splits all the tab layers in three
private void clear image area tab gui set selected color button null shadow left eye null shadow right eye null
clears this tabs image in the drawing area
private void resplit layers lower lower layers new buffered image resized image width resized image height buffered image type int argb graphics2 d g2d lower layers create graphics if original image null draw white background if no original image was set yet g2d set color color white g2d fill rect 0 0 resized image width resized image height g2d draw image original image 0 0 null for tab container t tabs list if t get tab layer position currnet tab get tab layer position g2d draw image t get layer image 0 0 null else break g2d dispose
method that creates an empty transparent image and begins to draw
private void resplit layers upper upper layers new buffered image resized image width resized image height buffered image type int argb graphics2 d g2d upper layers create graphics for int i tabs list index of currnet tab 1 i tabs list size i tab container t tabs list get i g2d draw image t get layer image 0 0 null g2d dispose
method that creates an empty transparent image and begins to draw
private void save to file string file name add png extension in the name as currently is the only format available for saving if file name ends with png file name file name concat png file ioprogress file io new file ioprogress s shell if file io save image image area get current image file name todo put to project window s title when the image is different from the saved one s shell set text new file file name get name messages get string project window title selected file for save file name
save the resulting image to the given file name
public boolean has eyes path return eyes image null
check whether this tab instance has an associated eyes shadow path
public buffered image get upper layers return upper layers
method that returns an image containing all the layers
public composite get parent main container return parent get main container
returns the main windows main container used as a parent for the tabs
public buffered image get current layer return currnet tab get layer image
method that returns the selected tab layer
private void extend color buttons behavior for final color button button colored button list button add mouse listener new org eclipse swt events mouse adapter public void mouse down org eclipse swt events mouse event e todo history is created but user may click cancel on lips tracer and nothing is drawn tabs container create history step public void mouse up org eclipse swt events mouse event e if has lips path tabs container set lips path create lips image if image area redraw allowed tabs container redraw image area this lips tab
color buttons should do more than just updating the
public void draw current layer graphics2 d g2d currnet tab draw current layer g2d
calls the current tab to draw its resulting image on the drawing container
public void clear last drawing content new buffered image resized image width resized image height buffered image type int argb
clear the scribbles image
public void draw current layer graphics2 d g2d g2d draw image last drawing content 0 0 null java awt composite c g2d get composite backup original g2d composite g2d set composite ac user concealer tab composite g2d draw image current drawn content 0 0 null g2d set composite c restore g2d original composite
draw this scribble image using the given graphics context
public buffered image get lower layers return lower layers
method that returns an image containing all the layers
private void clear image area lips image null tab gui set selected color button null
clears this tabs image in the drawing area
public object get current state buffered image history step new buffered image resized image width resized image height buffered image type int argb graphics2 d g2d history history step create graphics g2d history draw image last drawing content 0 0 null g2d history dispose return history step
returns a copy of the scribbles current image
public buffered image get layer image return last drawing content
returns the scribbles current image
public void mouse pressed mouse event e end x start x e get x end y start y e get y current drawn content new buffered image resized image width resized image height buffered image type int argb current drawn content g2d current drawn content create graphics current drawn content g2d set rendering hint rendering hints key antialiasing rendering hints value antialias on current drawn content g2d set stroke stroke current drawn content g2d set color current color current drawn content g2d draw line start x start y end x end y
notify the scribble that the mouse was pressed
public void mouse released mouse event e update last drawing content graphics2 d g2d last drawing content create graphics g2d set composite ac g2d draw image current drawn content 0 0 null g2d dispose mouse is released there is no current draw content available current drawn content g2d dispose current drawn content g2d null current drawn content null
notify the scribble that the mouse was released
public void set enabled undo boolean enabled push undo set enabled enabled
enables the undo menu item if the argument is code true code
private void create lips image lips image null if lips general path null tab gui get selected button null lips image new buffered image tabs container get original image get width tabs container get original image get height buffered image type int rgb graphics2 d g2d lips image create graphics g2d set color tab gui get current color g2d fill rect 0 0 lips image get width lips image get height g2d dispose lips image image utils create soft clipping lips image lips general path
create this tabs lips image by
public void mouse dragged mouse event evt end x evt get x end y evt get y current drawn content g2d draw line start x start y end x end y start x end x start y end y
notify the scribble that the mouse is dragged
public tab container get current tab return currnet tab
method that returns the selected tab layer
public void set current state object o if o instanceof buffered image buffered image b buffered image o last drawing content b
set the current scribbles image
public void set lips path general path lips path if lips path null return lips general path lips path create lips image if image area redraw allowed tabs container redraw image area this lips tab
set the lips path to the given one if the new
public void set alpha opacity alpha composite ac this ac ac
change the scribbles drawing opacity
protected void set current color color color current color color
change the scribbles drawing color
private void clear image area tab gui set selected color button null blush left cheek null blush right cheek null
clears this tabs image in the drawing area
protected color getcurrent color return current color
returns the scribbles current drawing color
public void set original image buffered image original image todo a copy of the original image is created for use by tabs maybe not necessary creates an blank transparent image and draws the original image on it int w original image get width int h original image get height this original image new buffered image w h buffered image type int argb graphics2 d g2d this original image create graphics g2d draw image original image 0 0 null g2d dispose we need to redraw only the lower layers because the original image was changed resplit layers lower
method that initializes the original image with the image read
public boolean has lips path return lips general path null
check whether this tab instance has an associated lips path
public void set enabled redo boolean enabled push redo set enabled enabled
enables the redo menu item if the argument is code true code
protected void set tab image image tab image this tab image tab image
sets the tab image that will be shown on tab name