In short, no, it isn't legal if what you are using has been copyrighted.
Here's an odd example that I can think of off the top of my head. Take Mr Spock from Star Trek.
You can:
Take his live long and prosper sign and do anything you like with it because there is no copyright on that.
You cannot:
Take a screenshot of Spock from a TV series or film and plaster it onto a tshirt in any form (including illustrative)
You can:
Use a screenshot as reference to modify the scene in such a way that it constitutes a new, *original* piece of work.
Basically, there is no definitive yes or no to your question. Only the final piece will give you that answer. However, take Shepard Fairey's HOPE poster.
Fairey then filed a lawsuit in U.S. District Court in Manhattan, claiming that he did not violate the copyright of the April 2006 photograph because he dramatically changed the nature of the image. Fairey is currently represented by the Center of Internet and Society at Stanford University, arguing that his use of the AP photo falls under "fair use."
According to the complaint, Fairey's team argues that the two images have different purposes. "While the evident purpose of the Garcia Photograph is to document the events that took place at the National Press Club that day in April 2006, the evident purpose of both Obama Progress and Obama Hope is to inspire, convince and convey the power of Obama’s ideals, as well as his potential as a leader, through graphic metaphor," the claim says.
So basically, each case must be treated separately but overall, the artwork must have enough of a degree of separation in order to be exempt from copyright.