T O P I C R E V I E W |
sungho |
Posted - Mar 25 2013 : 20:33:32 Hi. Program development to adjust the contrast / brightness mouse move.
Smooth image processing using the code(1). // 1 void __fastcall TForm1::ImageEnView1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if( Shift.Contains(ssLeft)) { // left/right if (prex < X) { if (ncontrast < 100) ncontrast++; // contrast -100 - 100 0 : no change }
if (prex > X) { if (ncontrast > -100) ncontrast--; }
this->ImageEnView2->IO->IEBitmap->Contrast = ncontrast; // contrast this->ImageEnView2->IO->Update();
// up/down // Brightness 512 - 100 0 : No Change if (prey > Y) { if (nbright < 512) nbright++; }
if (prey < Y) { if (nbright > -100) nbright--; }
ImageEnView2->IO->IEBitmap->ChannelOffset[0] = nbright; // red ImageEnView2->IO->IEBitmap->ChannelOffset[1] = nbright; // green ImageEnView2->IO->IEBitmap->ChannelOffset[2] = nbright; // blue this->ImageEnView2->IO->Update();
}
prex = X; prey = Y; } //---------------------------------------------------------------------------
But you use the mouse to move the image processing code(2) below Motion does not run smoothly. // 2 void __fastcall TForm1::ImageEnView1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if( Shift.Contains(ssLeft)) { // left/right if (prex < X) { if (ncontrast < 100) ncontrast++; // contrast -100 - 100 0 : no change }
if (prex > X) { if (ncontrast > -100) ncontrast--; }
// up/down // Brightness 512 - 100 0 : No Change if (prey > Y) { if (nbright < 512) nbright++; }
if (prey < Y) { if (nbright > -100) nbright--; }
ImageEnView1->Proc->Undo(); this->ImageEnView1->Proc->AdjustBrightnessContrastSaturation(nbright, ncontrast, 0); this->ImageEnView1->Proc->Update(); }
prex = X; prey = Y; } //---------------------------------------------------------------------------
Code 1) Fast image processing buf can not save the file.
Code 2) Slow image processing and it can be save the file.
Questions If you dont mind, would you send the code which can have fast image processing with save file function in the mouse move. Looking forward to your earlist response. Best Regards. Thanks. |
1 L A T E S T R E P L I E S (Newest First) |
fab |
Posted - Mar 29 2013 : 03:23:31 At the moment the two options (code 1 and 2) are the unique possibilities. Starting from next minor release there will be two new methods of TIEBitmap, which allows Contrast and ChannelOffset properties to make permanent changes to the bitmap. |
|
|