ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 HI. Mouse Interact contrast/brightness.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

sungho

Korea
14 Posts

Posted - Mar 25 2013 :  20:33:32  Show Profile  Reply
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 don’t 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.

fab

1310 Posts

Posted - Mar 29 2013 :  03:23:31  Show Profile  Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: