![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Регистрация: Sep 2006
Сообщений: 453
|
Подскажите пожалусто. Как возможно программно убрать эффект красных глаз? Может есть готовый пример.
|
|
|||||
|
Регистрация: Sep 2006
Сообщений: 453
|
iNils это что-ли невозможно? |
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
BitmapData в руки и вперед!
|
|
|||||
|
А зачем программно - ИМХО легче тогда фотошопом
|
|
|||||
|
Регистрация: Dec 1999
Адрес: Магадан
Сообщений: 763
|
Ben Pritchard ещё в позапрошлом году очень неплохой вариант сделал:
import flash.display.BitmapData;
class RedEyeReducer{
//Ben Pritchard 2005
//Bitmap Data Object
private var pBMP:BitmapData;
//Input Mc
private var mc:MovieClip;
//Tolerances
private var toleranceRed:Number;
private var toleranceGreen:Number;
private var toleranceBlue:Number;
function RedEyeReducer(){
}
//Apply tolerances
public function setColorTolerance(r:Number,g:Number,b:Number):Void{
toleranceRed = r;
toleranceGreen = g;
toleranceBlue = b;
}
//Sets the mc to use for reduction
public function setPictureClip(mc:MovieClip):Void{
trace("MC " + mc);
mc.cRef = this;
//Creates the overlay
mc.createEmptyMovieClip("shade_mc", 2);
//Track the click and drag
mc.onPress = function(){
this.shade_mc.moveTo(this._xmouse, this._ymouse);
this.origX = this._xmouse;
this.origY = this._ymouse;
this.drawing = true;
}
//Redraw the overlay
mc.onMouseMove = function(){
if(this.drawing == true){
this.shade_mc.clear();
this.shade_mc.moveTo(this.origX,this.origY);
this.shade_mc.beginFill(0xFFFFFF,50);
this.shade_mc.lineTo(this._xmouse, this.origY);
this.shade_mc.lineTo(this._xmouse, this._ymouse);
this.shade_mc.lineTo(this.origX, this._ymouse);
this.shade_mc.lineTo(this.origX, this.origY);
this.shade_mc.endFill();
}
}
mc.onRelease = function(){
//Record the coordinates
this.endX = this._xmouse;
this.endY = this._ymouse;
//Clear the overlay
this.shade_mc.clear();
//Turn the overlay updating off
this.drawing = false;
//Create the bitmap object
var transparent:Boolean = true;
var fillColor:Number = 0xFFFFFFFF;
this.cRef.pBMP = new BitmapData(this._width, this._height, transparent, fillColor);
this.cRef.pBMP.draw(this);
this.attachBitmap(this.cRef.pBMP,1);
//Call the reduction method
this.cRef.setRedtoBlack(this.origX,this.origY,this.endX,this.endY);
}
}
private function setRedtoBlack(origX,origY,endX,endY):Void{
//Loop through the coordinate colors
trace(toleranceRed);
for(var i:Number= origX;i< endX;i++){
for(var j:Number = origY;j < endY;j++){
if(parseInt(pBMP.getPixel(i,j).toString(16).substring(0,2),16) > toleranceRed && parseInt(pBMP.getPixel(i,j).toString(16).substring(2,4),16) < toleranceGreen && parseInt(pBMP.getPixel(i,j).toString(16).substring(4,6),16) < toleranceBlue){
var currentColor = "0x" + "00" + pBMP.getPixel(i,j).toString(16).substring(2,6);
pBMP.setPixel(i,j,currentColor);
}
}
}
}
public function reset():Void{
pBMP.dispose();
}
}
http://pixelfumes.blogspot.com/2005/...-8-upload.html
__________________
Верить никому нельзя. Мне - можно. :) Последний раз редактировалось etc; 26.03.2007 в 20:40. |
|
|||||
|
Регистрация: Mar 2007
Сообщений: 168
|
Может стоит попробовать написать компонент для флэша?
|
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
Цитата:
|
![]() |
![]() |
Часовой пояс GMT +4, время: 04:52. |
|
|
« Предыдущая тема | Следующая тема » |
|
|