bool ColorsEqual(Gdiplus::Color a, Gdiplus::Color b)
 {
     return a.GetR() == b.GetR() &&
         a.GetG() == b.GetG() &&
         a.GetB() == b.GetB() &&
         a.GetA() == b.GetA();
 }
Ejemplo n.º 2
0
void OutlineText::Extrude(
	Gdiplus::Color color, 
	int nThickness,
	Gdiplus::Point ptOffset)
{
	ExtrudeStrategy* pStrat = new ExtrudeStrategy();
	pStrat->Init(Gdiplus::Color(0,0,0,0),color,nThickness,ptOffset.X,ptOffset.Y);

	m_clrShadow = color;

	if(m_pFontBodyShadow)
		delete m_pFontBodyShadow;

	ExtrudeStrategy* pFontBodyShadow = new ExtrudeStrategy();
	pFontBodyShadow->Init(Gdiplus::Color(color.GetA(),255,255),Gdiplus::Color(0,0,0,0),0,ptOffset.X,ptOffset.Y);
	m_pFontBodyShadow = pFontBodyShadow;

	if(m_pShadowStrategy)
		delete m_pShadowStrategy;

	m_ptShadowOffset = ptOffset;
	m_pShadowStrategy = pStrat;
	m_bExtrudeShadow = true;
	m_bDiffuseShadow = false;
	m_nShadowThickness = nThickness;
}
Ejemplo n.º 3
0
		Gwen::Color GDIPlus::PixelColour( Gwen::Texture* pTexture, unsigned int x, unsigned int y, const Gwen::Color& col_default )
		{
			Gdiplus::Bitmap* pImage = (Gdiplus::Bitmap*) pTexture->data;
			if ( !pImage ) return col_default;

			Gdiplus::Color c;
			pImage->GetPixel( x, y, &c );

			return Gwen::Color( c.GetR(), c.GetG(), c.GetB(), c.GetA() );
		}
Ejemplo n.º 4
0
//===============================================
void LoadPixel(UINT ofs, BYTE* rgba)
//===============================================
{
	// get pixel of current image by offset ofs
	UINT x,y;
	Gdiplus::Color	col;

	PixelToCoord(ofs, &x, &y);
	img->GetPixel(x,y, &col);
	rgba[0] = col.GetR();
	rgba[1] = col.GetG();
	rgba[2] = col.GetB();
	rgba[3] = col.GetA();
}
Ejemplo n.º 5
0
void CSurface::Init(char* filename)
{
	Gdiplus::GdiplusStartupInput startupInput;
	ULONG_PTR token;
	GdiplusStartup(&token, &startupInput, NULL);

	int len = strlen(filename);
	wchar_t* temp = new wchar_t[len + 1];
	for (int i = 0; i < len; i++)
	{
		temp[i] = filename[i];
	}
	temp[len] = '\0';
	Gdiplus::Bitmap bitmap(temp);
	Gdiplus::Color pixel;

	if (bitmap.GetWidth() <= 0)
		return;
	if (bitmap.GetHeight() <= 0)
		return;

	m_width = bitmap.GetWidth();
	m_height = bitmap.GetHeight();

	m_pPixels = new CVector4[m_width * m_height];

	for (int x = 0; x < m_width; x++)
	{
		for (int y = 0; y < m_height; y++)
		{
			bitmap.GetPixel(x, y, &pixel);
			m_pPixels[x + y * m_width] = CVector4(pixel.GetR(), pixel.GetG(), pixel.GetB(), pixel.GetA());
		}
	}

	if (!m_pPixels)
		return;

	STRING::Copy(m_pFilename, filename);
}
Ejemplo n.º 6
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
bool PngTextureLoader::Load(void* data, int32_t size, bool rev)
{
#if __PNG_DDI
	auto global = GlobalAlloc(GMEM_MOVEABLE,size);
	auto buf = GlobalLock(global);
	CopyMemory(buf, data, size);
	GlobalUnlock(global);
	LPSTREAM stream = NULL;
	CreateStreamOnHGlobal( global, false, &stream);
	Gdiplus::Bitmap* bmp = Gdiplus::Bitmap::FromStream(stream);
	ES_SAFE_RELEASE(stream);
	GlobalFree(global);


	if( bmp != NULL && bmp->GetLastStatus() == Gdiplus::Ok )
	{
		textureWidth = bmp->GetWidth();
		textureHeight = bmp->GetHeight();
		textureData.resize(textureWidth * textureHeight * 4);

		if(rev)
		{
			for(auto y = 0; y < textureHeight; y++ )
			{
				for(auto x = 0; x < textureWidth; x++ )
				{
					Gdiplus::Color  color;
					bmp->GetPixel(x, textureHeight - y - 1, &color);

					textureData[(x + y * textureWidth) * 4 + 0] = color.GetR();
					textureData[(x + y * textureWidth) * 4 + 1] = color.GetG();
					textureData[(x + y * textureWidth) * 4 + 2] = color.GetB();
					textureData[(x + y * textureWidth) * 4 + 3] = color.GetA();
				}
			}
		}
		else
		{
			for(auto y = 0; y < textureHeight; y++ )
			{
				for(auto x = 0; x < textureWidth; x++ )
				{
					Gdiplus::Color  color;
					bmp->GetPixel(x, y, &color);

					textureData[(x + y * textureWidth) * 4 + 0] = color.GetR();
					textureData[(x + y * textureWidth) * 4 + 1] = color.GetG();
					textureData[(x + y * textureWidth) * 4 + 2] = color.GetB();
					textureData[(x + y * textureWidth) * 4 + 3] = color.GetA();
				}
			}
		}
		
		return true;
	}
	else
	{
		ES_SAFE_DELETE(bmp);
		return false;
	}
#else
	uint8_t* data_ = (uint8_t*) data;

	/* pngアクセス構造体を作成 */
	png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	
	/* リードコールバック関数指定 */
	png_set_read_fn(png, &data_, &PngReadData);

	/* png画像情報構造体を作成 */
	png_infop png_info = png_create_info_struct(png);

	/* エラーハンドリング */
	if (setjmp(png_jmpbuf(png)))
	{
		png_destroy_read_struct(&png, &png_info, NULL);
		return false;
	}

	/* IHDRチャンク情報を取得 */
	png_read_info(png, png_info);
	png_uint_32 width, height;
	int bit_depth, color_type, interlace_type, comp_type, filter_type;
	png_get_IHDR(png, png_info, &width, &height, &bit_depth, &color_type, &interlace_type,
				 &comp_type, &filter_type);

	/* RGBA8888フォーマットに変換する */
	if (bit_depth < 8)
	{
		png_set_packing(png);
	}
	else if (bit_depth == 16)
	{
		png_set_strip_16(png);
	}

	uint32_t pixelBytes = 4;
	switch (color_type)
	{
	case PNG_COLOR_TYPE_PALETTE:
		png_set_palette_to_rgb(png);
		pixelBytes = 4;
		break;
	case PNG_COLOR_TYPE_GRAY:
		png_set_expand_gray_1_2_4_to_8(png);
		pixelBytes = 3;
		break;
	case PNG_COLOR_TYPE_RGB:
		pixelBytes = 3;
		break;
	case PNG_COLOR_TYPE_RGBA:
		break;
	}

	uint8_t* image = new uint8_t[width * height * pixelBytes];
	uint32_t pitch = width * pixelBytes;

	/* イメージデータを読み込む */

	textureWidth = width;
	textureHeight = height;
	textureData.resize(textureWidth * textureHeight * 4);

	if (rev)
	{
		for (uint32_t i = 0; i < height; i++)
		{
			png_read_row(png, &image[(height - 1 - i) * pitch], NULL);
		}
	}
	else
	{
		for (uint32_t i = 0; i < height; i++)
		{
			png_read_row(png, &image[i * pitch], NULL);
		}
	}

	if (pixelBytes == 4)
	{
		memcpy(textureData.data(), image, width * height * pixelBytes);
	}
	else
	{
		for (int32_t y = 0; y < height; y++)
		{
			for (int32_t x = 0; x < width; x++)
			{
				int32_t src = (x + y * width) * 3;
				int32_t dst = (x + y * width) * 4;
				textureData[dst + 0] = image[src + 0];
				textureData[dst + 1] = image[src + 1];
				textureData[dst + 2] = image[src + 2];
				textureData[dst + 3] = 255;
			}
		}
	}
	
	delete [] image;
	png_destroy_read_struct(&png, &png_info, NULL);

	return true;
#endif
}
Ejemplo n.º 7
0
inline std::string myToString(const Gdiplus::Color& value)
{
	char buffer[30];
	sprintf(buffer,"rgba(%d,%d,%d,%1.4f)", (int)value.GetR(), (int)value.GetG(), (int)value.GetB(), (float)(value.GetA()/255.0));
	return buffer;
}
Ejemplo n.º 8
0
void CSkinButton2::DrawFrame(Gdiplus::Graphics& gdi,CRect& rect)
{
	if( m_enmuDrawType == NO_FRAME )
	{
		Gdiplus::Pen pen1( m_colFrame1 );
		gdi.DrawLine( &pen1, rect.left+1, rect.top, rect.right-2, rect.top );
		gdi.DrawLine( &pen1, rect.left+1, rect.bottom-1, rect.right-2, rect.bottom-1 );
		gdi.DrawLine( &pen1, rect.left, rect.top+1, rect.left, rect.bottom-2 );
		gdi.DrawLine( &pen1, rect.right-1, rect.top+1, rect.right-1, rect.bottom-2 );

		Gdiplus::Color colpix;
		pen1.GetColor( &colpix );
		colpix.SetValue( Gdiplus::Color::MakeARGB(colpix.GetA()/2,colpix.GetR(),colpix.GetG(),colpix.GetB() ) );
		Gdiplus::Pen penPix1( colpix );
		gdi.DrawLine( &penPix1, rect.left, rect.top, rect.left+1, rect.top );
		gdi.DrawLine( &penPix1, rect.right-1, rect.top, rect.right-1, rect.top+1 );
		gdi.DrawLine( &penPix1, rect.right-1, rect.bottom-1, rect.right-2, rect.bottom-1 );
		gdi.DrawLine( &penPix1, rect.left,  rect.bottom-1, rect.left+1,  rect.bottom-1 );

		CRect rect2 = rect;
		::InflateRect( &rect2, -1,-1 );
		if( !m_bMouseDown )
		{
			Gdiplus::Pen pen2(m_colFrame2);
			if( m_bMouseDown )
				pen2.SetColor(m_colFrame1);
			else
				pen2.SetColor(m_colFrame2);

			gdi.DrawLine( &pen2, rect2.left+1, rect2.top, rect2.right-2, rect2.top );
			gdi.DrawLine( &pen2, rect2.left+1, rect2.bottom-1, rect2.right-2, rect2.bottom-1 );
			gdi.DrawLine( &pen2, rect2.left, rect2.top+1, rect2.left, rect2.bottom-2 );
			gdi.DrawLine( &pen2, rect2.right-1, rect2.top+1, rect2.right-1, rect2.bottom-2 );

			Gdiplus::Color colpix2;
			pen2.GetColor( &colpix2 );
			colpix2.SetValue( Gdiplus::Color::MakeARGB(colpix2.GetA()/2,colpix2.GetR(),colpix2.GetG(),colpix2.GetB() ) );
			Gdiplus::Pen penPix2( colpix2 );
			gdi.DrawLine( &penPix2, rect2.left, rect2.top, rect2.left+1, rect2.top );
			gdi.DrawLine( &penPix2, rect2.right-1, rect2.top, rect2.right-1, rect2.top+1 );
			gdi.DrawLine( &penPix2, rect2.right-1, rect2.bottom-1, rect2.right-2, rect2.bottom-1 );
			gdi.DrawLine( &penPix2, rect2.left,  rect2.bottom-1, rect2.left+1,  rect2.bottom-1 );
		}

		if( m_bMouseDown )
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/3 );
			Gdiplus::Color colBrush1,colBrush2;
			colBrush1.SetValue( Gdiplus::Color::MakeARGB(15,1,1,1)  );
			colBrush2.SetValue( Gdiplus::Color::MakeARGB(0,1,1,1)  );

			LinearGradientBrush brush( rc, colBrush1, colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}
		else
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/2 );
			rc.Inflate(-1,-1);
			LinearGradientBrush brush( rc, m_colBrush1, m_colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}

		return;
	}
	else if( m_enmuDrawType == NO_FRAME_SELECT )
	{
		Gdiplus::Pen pen1( m_colFrame1 );
		gdi.DrawLine( &pen1, rect.left+1, rect.top, rect.right-2, rect.top );
		gdi.DrawLine( &pen1, rect.left+1, rect.bottom-1, rect.right-2, rect.bottom-1 );
		gdi.DrawLine( &pen1, rect.left, rect.top+1, rect.left, rect.bottom-2 );
		gdi.DrawLine( &pen1, rect.right-1, rect.top+1, rect.right-1, rect.bottom-2 );

		Gdiplus::Color colpix;
		pen1.GetColor( &colpix );
		colpix.SetValue( Gdiplus::Color::MakeARGB(colpix.GetA()/2,colpix.GetR(),colpix.GetG(),colpix.GetB() ) );
		Gdiplus::Pen penPix1( colpix );
		gdi.DrawLine( &penPix1, rect.left, rect.top, rect.left+1, rect.top );
		gdi.DrawLine( &penPix1, rect.right-1, rect.top, rect.right-1, rect.top+1 );
		gdi.DrawLine( &penPix1, rect.right-1, rect.bottom-1, rect.right-2, rect.bottom-1 );
		gdi.DrawLine( &penPix1, rect.left,  rect.bottom-1, rect.left+1,  rect.bottom-1 );

		CRect rect2 = rect;
		::InflateRect( &rect2, -1,-1 );
		if( !m_bMouseDown )
		{
			Gdiplus::Pen pen2(m_colFrame2);
			if( m_bMouseDown )
				pen2.SetColor(m_colFrame1);
			else
				pen2.SetColor(m_colFrame2);

			gdi.DrawLine( &pen2, rect2.left+1, rect2.top, rect2.right-2, rect2.top );
			gdi.DrawLine( &pen2, rect2.left+1, rect2.bottom-1, rect2.right-2, rect2.bottom-1 );
			gdi.DrawLine( &pen2, rect2.left, rect2.top+1, rect2.left, rect2.bottom-2 );
			gdi.DrawLine( &pen2, rect2.right-1, rect2.top+1, rect2.right-1, rect2.bottom-2 );

			Gdiplus::Color colpix2;
			pen2.GetColor( &colpix2 );
			colpix2.SetValue( Gdiplus::Color::MakeARGB(colpix2.GetA()/2,colpix2.GetR(),colpix2.GetG(),colpix2.GetB() ) );
			Gdiplus::Pen penPix2( colpix2 );
			gdi.DrawLine( &penPix2, rect2.left, rect2.top, rect2.left+1, rect2.top );
			gdi.DrawLine( &penPix2, rect2.right-1, rect2.top, rect2.right-1, rect2.top+1 );
			gdi.DrawLine( &penPix2, rect2.right-1, rect2.bottom-1, rect2.right-2, rect2.bottom-1 );
			gdi.DrawLine( &penPix2, rect2.left,  rect2.bottom-1, rect2.left+1,  rect2.bottom-1 );
		}

	/*	if( m_bMouseDown )
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/3 );
			Gdiplus::Color colBrush1,colBrush2;
			colBrush1.SetValue( Gdiplus::Color::MakeARGB(15,1,1,1)  );
			colBrush2.SetValue( Gdiplus::Color::MakeARGB(0,1,1,1)  );

			LinearGradientBrush brush( rc, colBrush1, colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}
		else
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/2 );
			rc.Inflate(-1,-1);
			LinearGradientBrush brush( rc, m_colBrush1, m_colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}*/

		CRect rect3 = rect2;
		::InflateRect( &rect3, -1,-1 );
		Gdiplus::RectF rc( rect3.left, rect3.top, rect3.Width(), rect3.Height() );
		LinearGradientBrush brush( rc, m_colBK, m_colBK,LinearGradientModeVertical );
		gdi.FillRectangle( &brush, rc );

		Gdiplus::Color colBlack1 = Gdiplus::Color::MakeARGB(30,50,50,50);
		Gdiplus::Color colBlack2 = Gdiplus::Color::MakeARGB(15,50,50,50);
	    Gdiplus::RectF rc1( rect3.left, rect3.top+rect3.Height()/2, rect3.Width(), rect3.Height()/2 );
		LinearGradientBrush brush2( rc1, colBlack1, colBlack2,LinearGradientModeVertical );
		gdi.FillRectangle( &brush2, rc1 );
		return;
	}
	if( m_enmuDrawType == TOP_ARC )
	{
		Gdiplus::Pen pen1( m_colFrame1 );
		gdi.DrawLine( &pen1, rect.left+5, rect.top, rect.right-7, rect.top );
		gdi.DrawLine( &pen1, rect.left, rect.bottom-1, rect.right, rect.bottom-1 );
		gdi.DrawLine( &pen1, rect.left, rect.top+5, rect.left, rect.bottom-2 );
		gdi.DrawLine( &pen1, rect.right-1, rect.top+5, rect.right-1, rect.bottom-2 );

		CRect rect2 = rect;
		::InflateRect( &rect2, -1,-1 );
		if( !m_bMouseDown )
		{
			Gdiplus::Pen pen2(m_colFrame2);
			gdi.DrawLine( &pen2, rect2.left+4, rect2.top, rect2.right-5, rect2.top );
			gdi.DrawLine( &pen2, rect2.left, rect2.bottom-1, rect2.right-1, rect2.bottom-1 );
			gdi.DrawLine( &pen2, rect2.left, rect2.top+4, rect2.left, rect2.bottom-2 );
			gdi.DrawLine( &pen2, rect2.right-1, rect2.top+4, rect2.right-1, rect2.bottom-2 );

			Gdiplus::RectF rectLeftTop2;
			rectLeftTop2.X = rect2.left;
			rectLeftTop2.Y  = rect2.top;
			rectLeftTop2.Width = 6;
			rectLeftTop2.Height  = 6;
			gdi.DrawArc(  &pen2, rectLeftTop2,180,90 );

			Gdiplus::RectF rectRightTop2;
			rectRightTop2.X = rect2.right-7;
			rectRightTop2.Y  = rect2.top;
			rectRightTop2.Width = 6;
			rectRightTop2.Height  = 6;
			gdi.DrawArc(  &pen2, rectRightTop2,270,90 );
		}

		Gdiplus::RectF rectLeftTop;
		rectLeftTop.X = rect.left;
		rectLeftTop.Y  = rect.top;
		rectLeftTop.Width = 9;
		rectLeftTop.Height  = 9;
		gdi.DrawArc(  &pen1, rectLeftTop,180,90 );

		Gdiplus::RectF rectRightTop;
		rectRightTop.X = rect.right-10;
		rectRightTop.Y  = rect.top;
		rectRightTop.Width = 9;
		rectRightTop.Height  = 9;
		gdi.DrawArc(  &pen1, rectRightTop,270,90 );

		/*Gdiplus::SolidBrush sb( m_colBrush );
		Gdiplus::Brush *pbrush = sb.Clone();*/
		if( m_bMouseDown )
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/3 );
			Gdiplus::Color colBrush1,colBrush2;
			colBrush1.SetValue( Gdiplus::Color::MakeARGB(15,1,1,1)  );
			colBrush2.SetValue( Gdiplus::Color::MakeARGB(0,1,1,1)  );

			LinearGradientBrush brush( rc, colBrush1, colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}
		else
		{
			Gdiplus::RectF rc( rect2.left, rect2.top, rect2.Width(), rect2.Height()/2 );
			rc.Inflate(-1,-1);
			LinearGradientBrush brush( rc, m_colBrush1, m_colBrush2,LinearGradientModeVertical );
			gdi.FillRectangle( &brush, rc );
		}
	}
	else if( m_enmuDrawType == BOTTON_ARC )
	{
	}
	else if( m_enmuDrawType == RIGHT_ARC )
	{
	}
	else if( m_enmuDrawType == LEFT_ARC )
	{
	}
	else if( m_enmuDrawType & (TOP_ARC|BOTTON_ARC) || m_enmuDrawType & (RIGHT_ARC|LEFT_ARC) )
	{
		// 四角都有弧线
	}

	//gdi.DrawString(
}
Ejemplo n.º 9
0
D2D1_COLOR_F ToColorF(const Gdiplus::Color& color)
{
	return D2D1::ColorF(color.GetR() / 255.0f, color.GetG() / 255.0f, color.GetB() / 255.0f, color.GetA() / 255.0f);
}
Ejemplo n.º 10
0
BOOL SavePngFile(HICON hIcon, LPCSTR strPngFile,int iOutWith = -1,int iOutHeight = -1)
{
	if (hIcon == NULL)
		return FALSE;

	ICONINFO icInfo = { 0 };
	if (!::GetIconInfo(hIcon, &icInfo))
		return FALSE;


	BITMAP bitmap; 
	GetObject(icInfo.hbmColor, sizeof(BITMAP), &bitmap);

	Bitmap* pBitmap = NULL;
	Bitmap* pWrapBitmap = NULL;
	if (bitmap.bmBitsPixel != 32) 
	{   
		pBitmap = Bitmap::FromHICON(hIcon); 
	} 
	else
	{
		pWrapBitmap = Bitmap::FromHBITMAP(icInfo.hbmColor, NULL);
		BitmapData bitmapData;
		Rect rcImage(0,0, pWrapBitmap->GetWidth(), pWrapBitmap->GetHeight());
		pWrapBitmap->LockBits(&rcImage, ImageLockModeRead, pWrapBitmap->GetPixelFormat(), &bitmapData); 

		pBitmap = new Bitmap(bitmapData.Width, bitmapData.Height, bitmapData.Stride, 
			PixelFormat32bppARGB, (BYTE*)bitmapData.Scan0);

		pWrapBitmap->UnlockBits(&bitmapData);

		Gdiplus::Color Bmpcolor;
		BOOL BmpcolorTag=TRUE;
		for (UINT bmpx=0;bmpx<pBitmap->GetWidth();bmpx++)
		{
			for (UINT bmpy=0;bmpy<pBitmap->GetHeight();bmpy++)
			{
				pBitmap->GetPixel(bmpx,bmpy,&Bmpcolor);
				if(Bmpcolor.GetA()!=0)
				{
					BmpcolorTag=FALSE;
					break;	
				}
			}
			if (BmpcolorTag==FALSE)
				break;
		}
		if (BmpcolorTag==TRUE)
		{
			delete pWrapBitmap;
			pWrapBitmap = NULL;
			delete pBitmap;
			pBitmap = NULL;
			pBitmap = Gdiplus::Bitmap::FromHICON(hIcon); 
		} 
	}

	DeleteObject(icInfo.hbmColor); 
	DeleteObject(icInfo.hbmMask);

	static bool GetPngCode = false;
	static CLSID pngid;
	if (!GetPngCode)
	{
		GetPngCode = true;
		GetEncoderClsid(L"image/png", &pngid);
	}

	if (iOutWith !=-1 && iOutHeight!=-1)
	{
		Bitmap *pStretched =  StretchBitmap(pBitmap,128,128);
		if (pStretched)
		{
			delete pBitmap; 
			pBitmap = pStretched;
		}
	}

	_bstr_t bstr(strPngFile);
	wstring wstrPng = (WCHAR*)bstr;
	Gdiplus::Status s = pBitmap->Save(wstrPng.c_str(),&pngid,NULL);
	delete pBitmap; 
	if (pWrapBitmap)
		delete pWrapBitmap;

	DeleteObject(icInfo.hbmColor); 
	DeleteObject(icInfo.hbmMask); 

	if (s==Gdiplus::Ok)
		return TRUE;

	return FALSE;
}
Ejemplo n.º 11
0
Color Pen::GetColor() const {
    Gdiplus::Pen* gdiPen = reinterpret_cast<Gdiplus::Pen*>(_private);
    Gdiplus::Color gdiColor;
    gdiPen->GetColor(&gdiColor);
    return Color(gdiColor.GetA(), gdiColor.GetR(), gdiColor.GetG(), gdiColor.GetB());
}