Beispiel #1
0
tstring CMagicKHelper::GrayImage(tstring& strSrcPng)
{
	Magick::Image imgSrc(strSrcPng.c_str());
	tstring strGrayName = CFileHelper::GetGrayImageName(strSrcPng);
	imgSrc.grayscale(UndefinedPixelIntensityMethod);

//	EnterCriticalSection(cs_);
	imgSrc.write(strGrayName);
//	LeaveCriticalSection(cs_);

	return strGrayName;
}
    void draw(SkCanvas* canvas, sk_sp<SkImage> image, const SkIPoint& offset, int inset) {
        sk_sp<SkImageFilter> imgSrc(SkImageSource::Make(std::move(image)));

        SkRect srcRect = SkRect::MakeXYWH(1.0f, 1.0f, 2.0f, 2.0f);
        sk_sp<SkImageFilter> magFilter(SkMagnifierImageFilter::Make(srcRect, inset, imgSrc));

        SkPaint paint;
        paint.setImageFilter(std::move(magFilter));

        canvas->save();
        canvas->translate(offset.fX, offset.fY);
        SkRect rect = SkRect::MakeWH(kImgSize, kImgSize);
        canvas->drawRect(rect, paint);

        canvas->restore();
    }
Beispiel #3
0
bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour)
{
#if wxUSE_IMAGE
    const wxColour clr(bitmap.QuantizeColour(colour));

    wxImage imgSrc(bitmap.ConvertToImage());
    imgSrc.SetMask(false);
    wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue()));
    if ( !image.IsOk() )
        return false;

    m_bitmap = wxBitmap(image, 1);

    return m_bitmap.IsOk();
#else // !wxUSE_IMAGE
    wxUnusedVar(bitmap);
    wxUnusedVar(colour);

    return false;
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
}
Beispiel #4
0
void CMagicKHelper::GetPhotoBinval( const tstring& strPhotoName, tstring& strBinval )
{
	try
	{
		CLogger::GetInstance()->PrintErrLog("begin getphotoBinval");
		Magick::Image imgSrc(strPhotoName);
		CLogger::GetInstance()->PrintErrLog("imgSrc()");
		Magick::Blob blob;

//		EnterCriticalSection(cs_);
		imgSrc.write(&blob);
//		LeaveCriticalSection(cs_);

		CLogger::GetInstance()->PrintErrLog("write()");
		unsigned int len = blob.length();
		strBinval.assign((const char*)blob.data(), blob.length());
		CLogger::GetInstance()->PrintErrLog("write()");
	}
	catch (std::exception &ex)
	{
		CLogger::GetInstance()->PrintErrLog("resize image failure  %s", ex.what());
	}
}