June 2005
Beginner to intermediate
336 pages
6h 29m
English
If the user has selected the Draw menu's Draw freehand item, he can use the mouse to draw freehand. As you'll recall, the successive locations of the mouse are stored in an array named dots if the user is drawing freehand, so all that's necessary is to connect those dots.
If the user wants a drop shadow, you should draw that first, then reproduce what the user has drawn with the mouse. Here's what it looks like in code:
if(draw){ Line2D.Double drawLine; if(shadow){ paint = gImage.getPaint(); composite = gImage.getComposite(); gImage.setPaint(Color.black); gImage.setComposite(AlphaComposite.getInstance (AlphaComposite.SRC_OVER, 0.3f)); for(int loop_index = 0; loop_index < dots - 1; loop_index++){ if(dragging){ drawLine = new ...Read now
Unlock full access