ImageAttributes::ClearNoOp 메서드(gdiplusimageattributes.h)

ImageAttributes::ClearNoOp 메서드는 지정된 범주에 대한 NoOp 설정을 지웁니다.

구문

Status ClearNoOp(
  [in, optional] ColorAdjustType type
);

매개 변수

[in, optional] type

형식: ColorAdjustType

NoOp 설정이 지워지는 범주를 지정하는 ColorAdjustType 열거형의 요소입니다. 기본값은 ColorAdjustTypeDefault입니다.

반환 값

형식: 상태

메서드가 성공하면 Status 열거형의 요소인 Ok를 반환합니다.

메서드가 실패하면 Status 열거형의 다른 요소 중 하나를 반환합니다.

설명

ImageAttributes::SetNoOp 메서드를 호출하여 특정 개체 형식에 대한 색 조정을 사용하지 않도록 설정할 수 있습니다. 나중에 ImageAttributes::ClearNoOp 메서드를 호출하여 해당 개체 형식에 대한 색 조정을 복원할 수 있습니다. 예를 들어 다음 문은 브러시에 대한 색 조정을 사용하지 않도록 설정합니다.

myImageAttributes.SetNoOp(ColorAdjustTypeBrush);

다음 문은 ImageAttributes::SetNoOp 호출 전에 적용된 브러시 색 조정을 복원합니다.

myImageAttributes.ClearNoOp(ColorAdjustTypeBrush);

예제

다음 예제에서는 .emf 파일에서 Image 개체를 만듭니다. 또한 이 코드는 ImageAttributes 개체를 만듭니다. ImageAttributes::SetColorMatrix 호출은 해당 ImageAttributes 개체의 브러시 색 조정 매트릭스를 빨간색에서 녹색으로 변환하는 행렬로 설정합니다.

이 코드는 Image 개체의 주소와 ImageAttributes 개체의 주소를 전달할 때마다 DrawImage를 세 번 호출합니다. 이미지를 처음 그릴 때 브러시로 그린 모든 빨간색이 녹색으로 변환됩니다. (펜으로 그린 빨간색은 변경되지 않습니다.) 이미지를 두 번째로 그리기 전에 코드는 ImageAttributes 개체의 ImageAttributes::SetNoOp 메서드를 호출합니다. 따라서 이미지를 두 번째로 그릴 때 브러시에 색 조정이 적용되지 않습니다. 이미지를 세 번째로 그리기 전에 코드는 ImageAttributes::ClearNoOp 메서드를 호출하여 브러시 색 조정 설정을 복원합니다. 따라서 이미지가 세 번째로 그려지면 브러시로 그린 모든 빨간색이 녹색으로 변환됩니다.


VOID Example_SetClearNoOp(HDC hdc)
{
   Graphics graphics(hdc);

   Image image(L"TestMetafile4.emf");
   ImageAttributes imAtt;

    ColorMatrix brushMatrix = {     // red converted to green
      0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
      0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
      0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
      0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
      0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

   imAtt.SetColorMatrix(
      &brushMatrix, 
      ColorMatrixFlagsDefault, 
      ColorAdjustTypeBrush);

   // Draw the image (metafile) using brush color adjustment.
   // Items filled with a brush change from red to green.
   graphics.DrawImage(
      &image,
      Rect(0, 0, image.GetWidth(), image.GetHeight()),  // dest rect
      0, 0, image.GetWidth(), image.GetHeight(),        // source rect
      UnitPixel,
      &imAtt);

   // Temporarily disable brush color adjustment.
   imAtt.SetNoOp(ColorAdjustTypeBrush);

   // Draw the image (metafile) without brush color adjustment.
   // There is no change from red to green.
   graphics.DrawImage(
      &image,
      Rect(0, 80, image.GetWidth(), image.GetHeight()),  // dest rect
      0, 0, image.GetWidth(), image.GetHeight(),          // source rect
      UnitPixel,
      &imAtt);

   // Reinstate brush color adjustment.
   imAtt.ClearNoOp(ColorAdjustTypeBrush);

   // Draw the image (metafile) using brush color adjustment.
   // Items filled with a brush change from red to green.
   graphics.DrawImage(
      &image,
      Rect(0, 160, image.GetWidth(), image.GetHeight()),  // dest rect
      0, 0, image.GetWidth(), image.GetHeight(),          // source rect
      UnitPixel,
      &imAtt);
}
				

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdiplusimageattributes.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

추가 정보

Bitmap

ColorAdjustType

이미지

ImageAttributes

ImageAttributes::Reset

ImageAttributes::SetNoOp

ImageAttributes::SetToIdentity

Metafile

다시 칠하기