The EndDibAccess method is used to allow access to pixels in the Device Independent Bitmap (DIB). This method is to be used in conjunction with the StartDibAccess method.

[C++Builder]   [ bool = ]imagekitcontrolname->Effect->EndDibAccess(short DibNo)
[Delphi]   [ Boolean = ]imagekitcontrolname.Effect.EndDibAccess(DibNo: Smallint)

Parameters

Name Explanation
DibNo The identification number of the DIB as retrieved from the StartDibAccess method.

Return Value

Returns True if successful, otherwise returns False.

Explanation

The EndDibAccess method is to be used in conjunction with the StartDibAccess method. The DibNo parameter value must be the same as that retrieved from the StartDibAccess method.

To access the DIB and manipulate pixel data, you must use the following methods as a group:
StartDibAccess
      |
GetDibPixel, SetDibPixel
      |
EndDibAccess

Note: When accessing the DIB, we recommend you use the ImageKit DLL functions which are faster than this method.

Sample Code
The following code starts access to the DIB, then loops through each pixel in the image, using the GetDibPixel method to retrieve the pixels' rgb values. Then those values are reversed and set using the SetDibPixel method. (For 1, 16, 24, or 32 bit images)

In C++Builder
   bool Ret;
   short DibNo;
   int i, j;
   Byte PalNo, Red, Green, Blue;

   VImageKit1->LayerNo = -1;
   Ret = VImageKit1->GetImageType();
   if (Ret == false) return;
   Ret = VImageKit1->Effect->StartDibAccess(VImageKit1->ImageHandle, DibNo);
   if (Ret == false) return;

   for (i = 0; i < VImageKit1->ImageHeight; i++)
   {
      for (j = 0; j < VImageKit1->ImageWidth; j++)
      {
         Ret = VImageKit1->Effect->GetDibPixel(DibNo, j, i, PalNo, Red, Green, Blue);
         if (VImageKit1->BitCount == 1)
         {
            if (PalNo != 0)
               PalNo = 0;
            else
               PalNo = 1;
         } else if (VImageKit1->BitCount > 8) {
            Blue = 255 - Blue;
            Green = 255 - Green;
            Red = 255 - Red;
         }
         Ret = VImageKit1->Effect->SetDibPixel(DibNo, j, i, PalNo, Red, Green, Blue);
      }
   }
   Ret = VImageKit1->Effect->EndDibAccess(DibNo);

   VImageKit1->Refresh();

In Delphi
   Ret: Boolean;
   DibNo: Smallint;
   i, j: Longint;
   PalNo, Red, Green, Blue: Byte;

   VImageKit1.LayerNo := -1;
   Ret := VImageKit1.GetImageType();
   if Ret = False then Exit;
   Ret := VImageKit1.Effect.StartDibAccess(ImageKit1.ImageHandle, DibNo);
   if Ret = False then Exit;

   for i := 0 to VImageKit1.ImageHeight - 1 do
   begin
      for j := 0 to VImageKit1.ImageWidth - 1 do
      begin
         Ret := VImageKit1.Effect.GetDibPixel(DibNo, j, i, PalNo, Red, Green, Blue);
         if VImageKit1.BitCount = 1 then
         begin
            if PalNo <> 0 then
               PalNo := 0
            else
               PalNo := 1;
         end
         else if VImageKit1.BitCount > 8 then
         begin
            Blue := 255 - Blue;
            Green := 255 - Green;
            Red := 255 - Red;
         end;
         Ret := VImageKit1.Effect.SetDibPixel(DibNo, j, i, PalNo, Red, Green, Blue);
      end;
   end;
   Ret := VImageKit1.Effect.EndDibAccess(DibNo);

   VImageKit1.Refresh;

The ImageKit10 VCL is a product created by Newtone Corporation