本文整理汇总了C++中ImgFile_Ptr类的典型用法代码示例。如果您正苦于以下问题:C++ ImgFile_Ptr类的具体用法?C++ ImgFile_Ptr怎么用?C++ ImgFile_Ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImgFile_Ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_mask_pixels
static bool read_mask_pixels(
FILE* fp,
PsdLayerData* pLayerData,
ImgFile_Ptr pFile,
ImgLayerGroup_Ptr pLayerGroup)
{
int i,j;
AddNewLayerHandle* handle = (AddNewLayerHandle*)pFile->CreateImgFileHandle(IFH_ADD_NEW_LAYER );
handle->SetNewLayerRect(&(pLayerData->rect));
handle->Do( pFile );
ImgLayer_Ptr new_layer = handle->GetNewLayer().lock();
pFile->ReleaseImgFileHandle(handle);
handle = NULL;
//set blend forurCC
new_layer->SetLayerSynthFourCC( LayerSynthesizerMG::GetAlphaMaskLayerSynthFourCC() );
pFile->SetSelectLayer( new_layer );
//set name
char mask_name[MAX_IMG_LAYER_NAME + 32];
sprintf(mask_name, "%s マスク", pLayerData->name);
new_layer->SetName( mask_name );
int c_width = pLayerData->rect.right - pLayerData->rect.left;
int c_height = pLayerData->rect.bottom - pLayerData->rect.top;
IplImage* channel;
IplImage* alpha;
channel = cvCreateImage(cvSize(c_width, c_height), IPL_DEPTH_8U, 1);
alpha = cvCreateImage(cvSize(c_width, c_height), IPL_DEPTH_8U, 1);
if(!read_channel_pixels(fp, channel, c_width, c_height, pLayerData->depth, false)){
return false;
}
//set alpha channel
cvSet(alpha, cvScalar(255));
new_layer->Merge(
pLayerData->rect.left,
pLayerData->rect.top,
pLayerData->rect.right - pLayerData->rect.left,
pLayerData->rect.bottom - pLayerData->rect.top,
channel,
channel,
channel,
alpha);
LPUPDATE_DATA pData = new_layer->CreateUpdateData();
pData->isAll = true;
new_layer->PushUpdateData( pData );
return true;
}
示例2: IEIO_LoadImgFile
IEIO_EXPORT bool IEIO_LoadImgFile(
const char* filePath,
ImgFile_Ptr pFile)
{
if(filePath == NULL) return NULL;
FILE* fp;
errno_t err;
//if(err = fopen_s(&fp, filePath, "rb") != 0){
if(!(fp = fopen(filePath, "rb"))){
char str[256];
int last_err = GetLastError();
sprintf(str, "PSDファイルの読み込みに失敗しました。 %s err = %d lasterror = %d", filePath, last_err);
OutputError::Alert(str);
return false;
}
//read psd header
PsdHeader header;
if(!read_psd_header(fp, pFile, &header)){
fclose(fp);
return false;
}
//
if(!read_psd_color_mode_data(fp, pFile)){
fclose(fp);
return false;
}
//
if(!read_psd_image_resource(fp, pFile)){
fclose(fp);
return false;
}
//
if(!read_psd_layer_and_mask(fp, pFile, &header)){
fclose(fp);
return false;
}
//
if(pFile->GetLayerSize() == 0){
if(!read_psd_merged_image(fp, pFile, &header)){
fclose(fp);
return false;
}
}
fclose(fp);
//
NullHandle* null_handle = (NullHandle*) pFile->CreateImgFileHandle(IFH_NULL);
strcpy_s(null_handle->handle_name, MAX_IMG_FILE_HANDLE_NAME, "PSDファイル読み込み");
pFile->DoImgFileHandle( null_handle );
return true;
}
示例3: Redo
void AddCopyLayerHandle::Redo(ImgFile_weakPtr wpFile){
ImgFile_Ptr pFile = wpFile.lock();
pFile->AddLayer(m_addLayer.lock());
m_is_added_layer = true;
m_addLayer_lock = NULL;
LPUPDATE_DATA data = pFile->CreateUpdateData();
data->isAll = true;
pFile->PushUpdateData(data);
}
示例4: Undo
void AddCopyLayerHandle::Undo(ImgFile_weakPtr wpFile){
ImgFile_Ptr pFile = wpFile.lock();
m_addLayer_lock = m_addLayer.lock();
pFile->RemoveLayer(m_addLayer_lock);
m_is_added_layer = false;
LPUPDATE_DATA data=pFile->CreateUpdateData();
data->isAll = true;
pFile->PushUpdateData(data);
}
示例5: OnSelect
void IImgSelecter::OnSelect()
{
ImgFile_Ptr file = m_pImgEdit->GetActiveFile();
if(file){
file->SetMaskDrawType( MASK_SOLID_DRAW );
LPUPDATE_DATA data = file->CreateUpdateData();
data->isAll = false;
file->GetMaskRect(&(data->rect));
file->PushUpdateData(data);
}
}
示例6: OnMouseLButtonDown
void ViewRot::OnMouseLButtonDown(UINT nFlags, const LPIE_INPUT_DATA lpd)
{
startPt.x = lpd->x;
startPt.y = lpd->y;
ImgFile_Ptr f = m_pImgEdit->GetActiveFile();
if(f){
start_rot = f->GetViewRot();
CvPoint2D64f tmp = f->GetViewCenterPos();
f->ConvertPosImgToWnd(&tmp, ¢er);
}
}
示例7: OnNeutral
void IMakeRectImgSelecter::OnNeutral()
{
IMakeRect::OnNeutral();
ImgFile_Ptr file = m_pImgEdit->GetActiveFile();
if(file){
file->SetMaskDrawType( MASK_DOT_LINE_DRAW );
LPUPDATE_DATA data = file->CreateUpdateData();
data->isAll = false;
file->GetMaskRect(&(data->rect));
file->PushUpdateData(data);
}
}
示例8: GetRot
void ViewRot::OnMouseLDrag(UINT nFlags, const LPIE_INPUT_DATA lpd)
{
double rot = GetRot(&startPt, lpd);
ImgFile_Ptr f = m_pImgEdit->GetActiveFile();
if(f){
f->SetViewRot(rot + start_rot);
//表示画像に適用
LPUPDATE_DATA data = f->CreateUpdateData();
data->isAll = true;
f->PushUpdateData(data);
}
}
示例9: read_psd_header
static bool read_psd_header(
FILE* fp,
ImgFile_Ptr pFile,
PsdHeader* pHeader)
{
char signature[4];
int16_t version;
char reserved[6];
if(!fread(signature, 4, 1, fp)) return false;
if(memcmp(signature, "8BPS", 4) != 0) return false;
version = read_2byte_BE(fp);
if(version != 1) return false;
if(!fread(reserved, 6, 1, fp)) return false;
pHeader->channels = read_2byte_BE(fp);
pHeader->row = read_4byte_BE(fp);
pHeader->col = read_4byte_BE(fp);
pHeader->depth = read_2byte_BE(fp);
pHeader->mode = read_2byte_BE(fp);
if(pHeader->depth != 8) return false;
if(pHeader->mode != PSD_COLOR_MODE_RGB) return false;
pFile->Init( cvSize(pHeader->col, pHeader->row) );
return true;
}
示例10: MAKEINTRESOURCE
BOOL LevelCorrection::Run(ImgEdit* pEdit, void* pvoid)
{
if(m_pEditNode == NULL) return FALSE;
int ret = ::DialogBoxParam((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDD_LEVEL_CORRECTION_DLG),
::GetForegroundWindow(), (DLGPROC)LevelCorrectionDlgProc, (LPARAM)this);
if(ret == IDCANCEL){
ImgFile_Ptr f = pEdit->GetActiveFile();
if(f){
m_pEditLayerHandle->EndEdit();
f->Undo(1);
}
}
return FALSE;
}
示例11: Do
bool AddCopyLayerHandle::Do(ImgFile_weakPtr wpFile)
{
ImgFile_Ptr pFile = wpFile.lock();
m_addLayer = m_addLayer_lock = CreateIEImgLayer( pFile );
IImgLayer_weakPtr wlayer = pFile->GetSelectLayer();
if (wlayer.expired()) {
OutputError::PushLog(LOG_LEVEL::_ERROR, "AddCopyLayerHandle::Do() select layer is expired");
return false;
}
IImgLayer_Ptr layer = wlayer.lock();
if(layer->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER){
OutputError::PushLog(LOG_LEVEL::_ERROR, "AddCopyLayerHandle::Do() select layer is not normal layer");
return false;
}
if(m_copyLayer.lock() == NULL){
m_copyLayer = std::dynamic_pointer_cast<ImgLayer>(layer);
}
const_ImgLayer_Ptr copy_layer = m_copyLayer.lock();
copy_layer->CopyImgLayer( m_addLayer_lock );
char layer_name[MAX_IMG_LAYER_NAME];
copy_layer->GetName(layer_name);
sprintf(layer_name, "%s�̃R�s�[", layer_name);
m_addLayer_lock->SetName(layer_name);
m_addLayer_lock->SetLayerSynthFourCC( LayerSynthesizerMG::GetDefaultLayerSynthFourCC() );
pFile->AddLayer(m_addLayer_lock);
m_is_added_layer = true;
m_addLayer_lock = NULL;
LPUPDATE_DATA data = pFile->CreateUpdateData();
data->isAll = true;
pFile->PushUpdateData(data);
return true;
}
示例12: Init
bool E_ColorReverse::Init(ImgFile_Ptr pFile)
{
IImgLayer_weakPtr _sl = pFile->GetSelectLayer();
if (_sl.expired()) {
OutputError::Alert(IE_ERROR_SELECT_LAYER_DONT_EXIST);
return false;
}
IImgLayer_Ptr sl = _sl.lock();
if (sl->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER) {
OutputError::Alert(IE_ERROR_CANT_EDIT_LAYER);
return false;
}
m_pEditLayer = std::dynamic_pointer_cast<ImgLayer>(sl);
RECT rect, mask_rect;
m_pEditLayer->GetLayerRect(&rect);
//マスクの範囲取得
if (pFile->GetMaskState() == IE_MASK_STATE_ID::INVALID) {
m_mask = NULL;
}
else {
pFile->GetMaskRect(&mask_rect);
//範囲を計算
AndRect(&rect, &mask_rect, &rect);
//マスク切り出し
IplImage* tmp_mask = cvCreateImage(
cvSize(rect.right - rect.left, rect.bottom - rect.top),
IPL_DEPTH_8U,
1);
pFile->CopyFileMask(
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
tmp_mask,
0, 0);
m_mask = tmp_mask;
}
CvSize sizeOfImage;
sizeOfImage.width = rect.right - rect.left;
sizeOfImage.height = rect.bottom - rect.top;
m_pEditLayerHandle = (EditLayerHandle*)pFile->CreateImgFileHandle( IFH_EDIT_LAYER );
m_pEditLayerHandle->SetHandleName( DISPLAY_NAME );
pFile->DoImgFileHandle( m_pEditLayerHandle );
m_pEditNode = m_pEditLayerHandle->CreateEditNode(&rect);
m_pEditNode->blt_rect = rect;
return true;
}
示例13: read_psd_layer_and_mask
static bool read_psd_layer_and_mask(
FILE* fp,
ImgFile_Ptr pFile,
const PsdHeader* pHeader)
{
uint32_t block_length = read_4byte_BE(fp);
if(block_length > 0){
uint32_t block_start = ftell(fp);
uint32_t block_end = block_start + block_length;
read_4byte_BE(fp);
int16_t layer_num = read_2byte_BE(fp);
if(layer_num <0){
layer_num = -layer_num;
}
if(layer_num > 0){
int i;
//read layer data
PsdLayerData* psd_layers = (PsdLayerData*) malloc(sizeof(PsdLayerData)*layer_num);
memset(psd_layers, 0, sizeof(PsdLayerData)*layer_num);
for(i=0; i<layer_num; i++){
psd_layers[i].depth = pHeader->depth;
if(!read_layer(fp, &psd_layers[i])){
return false;
}
}
//read layer pixel data
ImgLayerGroup_Ptr pRootLayerGroup = pFile->GetRootLayerGroup();
int start_index = 0;
read_psd_layer_group(fp, layer_num, psd_layers, &start_index, pFile, pRootLayerGroup);
free_psd_layer_data(layer_num, psd_layers);
}
long now = ftell(fp);
if(now != block_end){
if(fseek(fp, block_end, SEEK_SET)){
return false;
}
}
}
return true;
}
示例14: OnChangeActiveFile
void CViewCtrlPane::OnChangeActiveFile(ImgFile_Ptr pNewFile, ImgFile_Ptr pOldFile)
{
if (m_pEditFile) {
m_pEditFile->DeleteEventListener(this);
}
if (pNewFile) {
pNewFile->AddEventListener(this);
}
m_pEditFile = pNewFile;
if (m_pEditFile) {
m_FlipHBtn.SetToggle(m_pEditFile->IsViewFlipH());
m_FlipVBtn.SetToggle(m_pEditFile->IsViewFlipV());
} else {
m_FlipHBtn.SetToggle(false);
m_FlipVBtn.SetToggle(false);
}
}
示例15: Run
BOOL ViewFlipV::Run(ImgEdit* pEdit, void* pvoid)
{
ImgFile_Ptr f = pEdit->GetActiveFile();
if(!f) return FALSE;
if( f->IsViewFlipV() ){
f->SetViewFlipV( false );
}
else{
f->SetViewFlipV( true );
}
//update display
LPUPDATE_DATA data = f->CreateUpdateData();
data->isAll = true;
f->PushUpdateData(data);
return FALSE;
}