compress_pcx(char *name) { int x=0; get_palette_ptr=flc_paleta; curcolor=0;bar(0,0,639,479); //prepare_for_mjpg(); while (get_pcx_frame(name,x)) { open_frame(); if (x) create_mgif_delta();else create_mgif_lzw(); reserve_track(); //create_jpg_frame(); close_frame(); curcolor=0;bar(0,400,639,430); write_frame_name(name,x); write_frame_size(last_frame_size,max_colors); if (last_frame_size>MAX_FRAME) {difdif=difdif<=0?1:difdif+1;hdiff+=difdif;} else if (last_frame_size<MIN_FRAME && hranice>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;} else if (hdiff>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;}else if(hdiff<0) hdiff=0; show_screen (); if (statpic) statpic--;else x+=frame_step; global_frame_counter++; } }
void prereserve_tracks() { int size; int celk; size=SOUND_SPEED/speed; size&=~1; celk=PRE_SOUND; while (celk-size>0) { open_frame(); create_sound_track(size); close_frame(); celk-=size; } if (celk) { open_frame(); create_sound_track(celk); close_frame(); } }
void convert_image(char *in,char *out) { IMAGE2D src,dst; int npix[2]; double start[2],step[2]; if (open_frame(&src,in,"I")<0) { print_error("Cannot open input file %s",in); exit_session(ERR_OPEN); } else { npix[0]=src.nx; npix[1]=src.ny; start[0]=src.startx; start[1]=src.starty; step[0]=src.stepx; step[1]=src.stepy; if (create_frame(&dst,out,npix,start,step,src.data_type,src.ident,src.cunit)<0) { close_frame(&src); print_error("Cannot create output file %s",out); exit_session(ERR_CREAT); } else { int i,j; for (i=0;i<src.nx;i++) for (j=0;j<src.ny;j++) WR_frame(&dst,i,j,RD_frame(&src,i,j)); CP_non_std_desc(&src,&dst); close_frame(&dst); close_frame(&src); } } printf("\n"); }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; case OPENFRAME1: case OPENFRAME2: open_frame(); break; case PREVFRAME: prev_frame(); break; case NEXTFRAME: next_frame(); break; case RESET: cur_frame = -1; cur_working_path[0] = '\0'; InvalidateRect(g_hWnd, NULL, true); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); draw_cur_frame(); EndPaint(hWnd, &ps); break; case WM_DESTROY: DestroyWindow(); PostQuitMessage(0); break; case WM_SYSCOMMAND: if (wParam == sys_menu_item_open) { open_frame(); return false; } return DefWindowProc(hWnd, message, wParam, lParam); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }