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
 Mask layer from selection
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

spetric

Croatia
308 Posts

Posted - Feb 09 2015 :  16:10:52  Show Profile  Reply
Hi,

I have background image in ImageEnView and I add a mask layer
that contains SelectionMask. After mask layer, I add another layer containg some image. All layers have the same size. Here is a code snippet:


imageContainer->PaintView->LockPaint();
if (imageContainer->PaintView->Selected)
   {
   TIEBitmap *map = new TIEBitmap;
   imageContainer->PaintView->SaveSelection();
   imageContainer->PaintView->VisibleSelection = false;
  imageContainer->PaintView->MakeSelectionFeather(SelFeather);
   imageContainer->PaintView->LayersAdd();
   imageContainer->PaintView->CurrentLayer->Visible = false;
   imageContainer->PaintView->CurrentLayer->IsMask = true;
   map->CopyFromTIEMask(imageContainer->PaintView->SelectionMask);
   imageContainer->PaintView->CurrentLayer->Bitmap->AssignImage(map);
   delete map;
   imageContainer->PaintView->MakeSelectionFeather(0);
   imageContainer->PaintView->RestoreSelection();
   imageContainer->PaintView->VisibleSelection = true;
   _maskLayerIndex = imageContainer->PaintView->LayersCurrent;
   }
imageContainer->PaintView->LayersAdd();
_imageLayerIndex = imageContainer->PaintView->LayersCurrent;
imageContainer->PaintView->CurrentLayer->Bitmap->AssignImage(imageContainer->ImageSidekick->ieBitmap);
imageContainer->PaintView->UnLockPaint();


However, upper layer is fully visible, when it's transparency is set to 255. Only when transparency is below 255 (or when operation is something other then normal) I get that check-board displayed in non-selected area.

I'm obviously doing something wrong.

xequte

38615 Posts

Posted - Feb 09 2015 :  21:02:14  Show Profile  Reply
Sorry Spectric, can you send me a demo, or give me more code and a few images to illustrate the issue.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Feb 10 2015 :  02:35:12  Show Profile  Reply
Hi Nigel,

I've resolved the issue...the mask layer has wrong index:
When layer 0 is background image. layer 1 is mask, and layer 2 is another image, mask layer affects layer with lower index, not with higher one (I have misinterpreted meaning of upper layer in help).

I have reversed the order of layers creation and now it works as it should:
Layer 0 is background image, layer 1 is color image and layer 2 is mask and it affects layer 1.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: