void CASW_Hotbar_Entry::UpdateImage() { if ( !m_hMarine.Get() ) { ClearImage(); return; } C_ASW_Weapon *pWeapon = m_hMarine->GetASWWeapon( m_iInventoryIndex ); if ( !pWeapon ) { ClearImage(); return; } const CASW_WeaponInfo* pInfo = pWeapon->GetWeaponInfo(); if ( !pInfo || !pInfo->m_bOffhandActivate ) // TODO: Fix for sentry guns { if ( !asw_hotbar_self.GetBool() || m_iHotKeyIndex != -1 ) // allow your own third item to show even if it's not usable { ClearImage(); return; } } m_pWeaponImage->SetVisible( true ); m_pMarineNameLabel->SetVisible( true ); m_pKeybindLabel->SetVisible( true ); m_pQuantityLabel->SetVisible( true ); m_pWeaponImage->SetImage( pInfo->szEquipIcon ); CASW_Marine_Profile *pProfile = m_hMarine->GetMarineProfile(); if ( pProfile ) { m_pMarineNameLabel->SetText( pProfile->GetShortName() ); } const char *pszKey = ""; if ( m_iHotKeyIndex != -1 ) { char szBinding[ 128 ]; Q_snprintf( szBinding, sizeof( szBinding ), "asw_squad_hotbar %d", m_iHotKeyIndex ); pszKey = ASW_FindKeyBoundTo( szBinding ); } else { pszKey = ASW_FindKeyBoundTo( "+grenade1" ); } char szKey[ 12 ]; Q_snprintf( szKey, sizeof(szKey), "%s", pszKey ); Q_strupr( szKey ); m_pKeybindLabel->SetText( szKey ); // TODO: Eventually make this into instructor key style? or a version of that which fits the HUD char szQuantity[ 32 ]; Q_snprintf( szQuantity, sizeof( szQuantity ), "x%d", pWeapon->Clip1() ); m_pQuantityLabel->SetText( szQuantity ); }
void JXTextMenuData::SetImage ( const JIndex index, JXImage* image, const JBoolean menuOwnsImage ) { if (image == NULL) { ClearImage(index); return; } TextItemData itemData = itsTextItemData->GetElement(index); if (itemData.image == NULL || (itemData.image->GetBounds()) != image->GetBounds()) { itsNeedGeomRecalcFlag = kJTrue; } if (itemData.ownsImage && image != itemData.image) { delete itemData.image; } itemData.image = image; itemData.ownsImage = menuOwnsImage; itsTextItemData->SetElement(index, itemData); Broadcast(ImageChanged(index)); }
void CHelp::LoadGuideImage(char* file) { ClearImage(); GuideImage->Init(1); nGuideImageNum = GuideImage->CreateTextureMaterial(file,0, 0, 128,128, SMMAT_BLEND_ALPHA ); GuideImage->ReadTextures(); }
void DrawFrame() { //_LAT(LED1) = 1; global_drawop = SRCCOPY; SetFontSize(1); SetFont(fonts.Stellaris); // Draw the wallpaper //DrawImage(0,0,wallpaper); ClearImage(); // Draw foreground app if (foreground_app != NULL) foreground_app->draw(); // Draw the battery bar uint8 w = mLerp(0,100, 0,DISPLAY_WIDTH, battery_level); color_t c = WHITE; switch (power_status) { case pwBattery: { switch (battery_status) { case batFull: c = SKYBLUE; break; case batNormal: c = SKYBLUE; break; case batLow: c = RED; break; // No need to put batFlat or batNotConnected default: break; } break; } case pwCharged: c = GREEN; break; case pwCharging: c = ORANGE; break; } // Extra padding at the top of the display to compensate for the bezel //DrawBox(0,0, DISPLAY_WIDTH,4, BLACK,BLACK); DrawBox(0,0, w,3, c,c); // Draw the battery icon if (power_status == pwBattery) { char s[8]; sprintf(s, "%3d%%", battery_level); //utoa(s, battery_level, 10); //int x = DISPLAY_WIDTH - StringWidth(s) - 2; int x = DISPLAY_WIDTH - 30; DrawImString(s, x,5, WHITE); } else { if (usb_connected) { DrawImage(DISPLAY_WIDTH-USB_WIDTH-2,5, &img_usb); } else { DrawImage(DISPLAY_WIDTH-POWER_WIDTH-2,6, &img_power); } } // Framerate debug info // char s[8]; // sprintf(s, "%d", draw_ticks); // DrawString(s, 4,5, DARKGREEN); }
bool CCaptureWindow::SetImage(const BITMAPINFO *pbmi,const void *pBits) { ClearImage(); m_pImage=new CCaptureImage(pbmi,pBits); if (m_hwnd!=NULL) { m_Preview.SetImage(m_pImage); SetTitle(); } return true; }
bool CCaptureWindow::SetImage(CCaptureImage *pImage) { ClearImage(); m_pImage=pImage; if (m_hwnd!=NULL) { m_Preview.SetImage(m_pImage); SetTitle(); } return true; }
bool CCapturePreview::SetImage(CCaptureImage *pImage) { ClearImage(); m_pImage=pImage; if (m_hwnd!=NULL) { Invalidate(); Update(); } return true; }
void ImageFinder::SetImage(const std::string& base64) { ClearImage(); { std::string raw_png = base64_decode(base64); lodepng::decode(Data, Width, Height, (const unsigned char *)raw_png.c_str(), raw_png.size()); } ImageToFind = Mat(Height, Width, CV_8UC4, Data.data()); cvtColor(ImageToFind,ImageToFind, COLOR_BGRA2RGBA); }
void DisplayBootScreen() { byte y = 8; char s[10]; byte x; uint32 i; ClrWdt(); ClearImage(); ClrWdt(); BootPrintln("OLED Watch v1.0"); //DrawString("Booting...", 8, y, WHITE); y += 10; for (i=0; i<1000000; i++) { ClrWdt(); } }
bool nuiHugeImage::Load(const nglPath& rImagePath) { ClearImage(); // Load the big image: nglIStream* pStream = rImagePath.OpenRead(); nglImage* pImage = new nglImage(pStream); delete pStream; if (!pImage) return false; int32 w = pImage->GetWidth(); int32 h = pImage->GetHeight(); mTextures.resize((w / TEXTURE_SIZE) + 1); mImageSize.Set(w, h); int32 i = 0; for (int32 x = 0; x < w; x += TEXTURE_SIZE, i++) { int32 j = 0; mTextures[i].resize((h / TEXTURE_SIZE) + 1); for (int32 y = 0; y < h; y += TEXTURE_SIZE, j++) { int32 sx = MIN(TEXTURE_SIZE, w - x); int32 sy = MIN(TEXTURE_SIZE, h - y); nglImage* pCrop = pImage->Crop(x, y, sx, sy); //NGL_OUT(_T("Crop[%d][%d] 0x%x\n"), i, j, pCrop); mTextures[i][j] = nuiTexture::GetTexture(pCrop, true); // mTextures[i][j]->EnableAutoMipMap(true); // mTextures[i][j]->SetMagFilter(GL_LINEAR); // mTextures[i][j]->SetMinFilter(GL_LINEAR_MIPMAP_LINEAR); } } delete pImage; mZoom = 1.0f; mX = w / 2; mY = h / 2; InvalidateLayout(); return true; }
void Button::SetImage( Image::Ptr image ) { ClearImage(); Add( image ); }
/* * ImgEdFrameProc - handle messages for the image editor application */ WPI_MRESULT CALLBACK ImgEdFrameProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { static BOOL window_destroyed = FALSE; static HMENU hmenu; ctl_id cmdid; img_node *node; WPI_RECT rcmain; #ifndef __OS2_PM__ about_info ai; #endif WPI_RECTDIM left, top; if( !window_destroyed ) { enableMainItems( hmenu ); } switch( msg ) { case UM_EXIT: _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); /* fall through */ case UM_EXIT_NO_SAVE: if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { break; } #ifndef __OS2_PM__ _wpi_destroywindow( _wpi_getframe( hwnd ) ); #else _wpi_sendmessage( hwnd, WM_CLOSE, 0, 0 ); #endif break; case UM_SAVE_ALL: SaveAllImages(); break; case WM_CREATE: hmenu = _wpi_getmenu( _wpi_getframe( hwnd ) ); #ifndef __OS2_PM__ createClientWindow( hwnd ); #endif if( !InitStatusLine( hwnd ) ) { return( -1 ); } InitFunctionBar( hwnd ); InitIconInfo(); InitializeCursors(); /* * Set values from profile information ... */ if( ImgedConfigInfo.brush_size <= 5 && ImgedConfigInfo.brush_size >= 2 ) { checkBrushItem( hmenu, IMGED_2x2 - 2 + ImgedConfigInfo.brush_size ); } if( ImgedConfigInfo.grid_on ) { CheckGridItem( hmenu ); } if( ImgedConfigInfo.square_grid ) { CheckSquareGrid( hmenu ); } if( ImgedConfigInfo.show_state & SET_SHOW_VIEW ) { CheckViewItem( hmenu ); } _wpi_enablemenuitem( hmenu, IMGED_CRESET, FALSE, FALSE ); _wpi_enablemenuitem( hmenu, IMGED_RCOLOR, FALSE, FALSE ); #ifndef __OS2_PM__ // not necessary for PM InitMenus( hmenu ); #endif SetHintText( IEAppTitle ); return( 0 ); #ifdef __NT__ case WM_DROPFILES: OpenImage( (HANDLE)wparam ); break; #endif case WM_MOVE: _wpi_getwindowrect( hwnd, &rcmain ); if( !ImgedConfigInfo.ismaximized ) { ImgedConfigInfo.last_xpos = ImgedConfigInfo.x_pos; ImgedConfigInfo.last_ypos = ImgedConfigInfo.y_pos; _wpi_getrectvalues( rcmain, &left, &top, NULL, NULL ); ImgedConfigInfo.x_pos = (short)left; ImgedConfigInfo.y_pos = (short)top; } return( 0 ); case WM_SIZE: ResizeFunctionBar( lparam ); ResizeStatusBar( lparam ); #ifndef __OS2_PM__ if( ClientWindow != NULL ) { setClientSize( hwnd ); } #else resizeClientArea( lparam ); #endif if( !_imgwpi_issizeminimized( wparam ) && !_imgwpi_issizemaximized( wparam ) ) { _wpi_getwindowrect( hwnd, &rcmain ); ImgedConfigInfo.width = (short)_wpi_getwidthrect( rcmain ); ImgedConfigInfo.height = (short)_wpi_getheightrect( rcmain ); ImgedConfigInfo.ismaximized = FALSE; } else { ImgedConfigInfo.x_pos = ImgedConfigInfo.last_xpos; ImgedConfigInfo.y_pos = ImgedConfigInfo.last_ypos; ImgedConfigInfo.ismaximized = _imgwpi_issizemaximized( wparam ); } return( FALSE ); case WM_MENUSELECT: #ifndef __OS2_PM__ if( GET_WM_MENUSELECT_FLAGS( wparam, lparam ) & MF_SEPARATOR ) { break; } if( GET_WM_MENUSELECT_FLAGS( wparam, lparam ) & MF_SYSMENU ) { PrintHintTextByID( WIE_SYSMENUOPERATIONS, NULL ); break; } #endif ShowHintText( LOWORD( wparam ) ); break; case WM_COMMAND: cmdid = LOWORD( wparam ); if( !IEIsMenuIDValid( hmenu, cmdid ) ) { break; } switch( cmdid ) { case IMGED_NEW: if( !ImgedIsDDE ) { if( !NewImage( UNDEF_IMG, NULL ) ) { PrintHintTextByID( WIE_NEIMAGENOTCREATED, NULL ); } } break; case IMGED_CLOSE: node = GetCurrentNode(); if( node != NULL ) { _wpi_sendmessage( node->hwnd, WM_CLOSE, 0, 0L ); } break; case IMGED_CLOSEALL: CloseAllImages(); break; case IMGED_HELP: IEHelpRoutine(); break; case IMGED_HELP_SEARCH: IEHelpSearchRoutine(); break; case IMGED_HELP_ON_HELP: IEHelpOnHelpRoutine(); break; case IMGED_ABOUT: #ifndef __OS2_PM__ ai.owner = hwnd; ai.inst = Instance; ai.name = IEAllocRCString( WIE_ABOUTTEXT ); ai.version = IEAllocRCString( WIE_ABOUTVERSION ); ai.title = IEAllocRCString( WIE_ABOUTTITLE ); DoAbout( &ai ); if( ai.name != NULL ) { IEFreeRCString( ai.name ); } if( ai.version != NULL ) { IEFreeRCString( ai.version ); } if( ai.title != NULL ) { IEFreeRCString( ai.title ); } #endif break; #ifndef __OS2_PM__ case IMGED_DDE_UPDATE_PRJ: IEUpdateDDEEditSession(); break; #endif case IMGED_SAVE_AS: SaveFile( SB_SAVE_AS ); break; case IMGED_SAVE: SaveFile( SB_SAVE ); break; case IMGED_OPEN: if( !ImgedIsDDE ) { OpenImage( NULL ); } break; case IMGED_CLEAR: ClearImage(); break; case IMGED_NEWIMG: AddNewIcon(); break; case IMGED_SELIMG: SelectIconImg(); break; case IMGED_DELIMG: DeleteIconImg(); break; case IMGED_UNDO: UndoOp(); break; case IMGED_REDO: RedoOp(); break; case IMGED_REST: RestoreImage(); break; case IMGED_SNAP: #ifndef __OS2_PM__ SnapPicture(); #endif break; case IMGED_RIGHT: case IMGED_LEFT: case IMGED_UP: case IMGED_DOWN: ShiftImage( cmdid ); break; case IMGED_FLIPHORZ: case IMGED_FLIPVERT: FlipImage( cmdid ); break; case IMGED_ROTATECC: case IMGED_ROTATECL: RotateImage( cmdid ); break; case IMGED_PASTE: PlaceAndPaste(); break; case IMGED_COPY: IECopyImage(); break; case IMGED_CUT: CutImage(); break; case IMGED_COLOR: CheckPaletteItem( hmenu ); break; case IMGED_VIEW: CheckViewItem( hmenu ); break; case IMGED_TOOLBAR: CheckToolbarItem( hmenu ); break; case IMGED_SQUARE: CheckSquareGrid( hmenu ); break; case IMGED_SIZE: ChangeImageSize(); break; case IMGED_GRID: CheckGridItem( hmenu ); break; case IMGED_MAXIMIZE: MaximizeCurrentChild(); break; case IMGED_SETTINGS: SelectOptions(); break; case IMGED_2x2: case IMGED_3x3: case IMGED_4x4: case IMGED_5x5: checkBrushItem( hmenu, cmdid ); break; case IMGED_CEDIT: #ifndef __OS2_PM__ EditColors(); #endif break; case IMGED_CRESET: #ifndef __OS2_PM__ RestoreColors(); #endif break; case IMGED_CSCREEN: ChooseBkColor(); break; case IMGED_SCOLOR: #ifndef __OS2_PM__ SaveColorPalette(); #endif break; case IMGED_LCOLOR: #ifndef __OS2_PM__ if( LoadColorPalette() ) { _wpi_enablemenuitem( hmenu, IMGED_RCOLOR, TRUE, FALSE ); } #endif break; case IMGED_RCOLOR: RestoreColorPalette(); break; case IMGED_FREEHAND: case IMGED_LINE: case IMGED_RECTO: case IMGED_RECTF: case IMGED_CIRCLEO: case IMGED_CIRCLEF: case IMGED_FILL: case IMGED_BRUSH: case IMGED_CLIP: case IMGED_HOTSPOT: SetToolType( cmdid ); PushToolButton( cmdid ); break; case IMGED_ARRANGE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDIICONARRANGE, 0, 0L ); #endif break; case IMGED_TILE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDITILE, MDITILE_VERTICAL, 0L ); #endif break; case IMGED_CASCADE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDICASCADE, MDITILE_SKIPDISABLED, 0L ); #endif break; case IMGED_EXIT: _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { break; } #ifndef __OS2_PM__ _wpi_destroywindow( _wpi_getframe( hwnd ) ); #else _wpi_sendmessage( hwnd, WM_CLOSE, 0, 0 ); #endif break; default: #if 1 return( _imgwpi_defframeproc( hwnd, ClientWindow, msg, wparam, lparam ) ); #else return( 0 ); #endif } return( 0 ); #ifndef __OS2_PM__ case WM_COMPACTING: RelieveUndos(); return 0; #endif case WM_QUERYENDSESSION: if( _wpi_isiconic( _wpi_getframe( hwnd ) ) ) { if( ImgedConfigInfo.ismaximized ) { _wpi_maximizewindow( _wpi_getframe( hwnd ) ); } else { _wpi_showwindow( _wpi_getframe( hwnd ), SW_SHOWNORMAL ); } } _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { return( 0 ); } return( (WPI_MRESULT)1 ); case WM_CLOSE: // wParam is non-zero if the DDE connection died if( !wparam && !ImgEdEnableMenuInput ) { // this prevents the user from closing the editor during // DDE initialization return( 0 ); } _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); #ifdef __OS2_PM__ return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); #else if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { return( 0 ); } window_destroyed = TRUE; _wpi_destroywindow( _wpi_getframe( hwnd ) ); return( 0 ); #endif case WM_DESTROY: #ifndef __OS2_PM__ WWinHelp( HMainWindow, "resimg.hlp", HELP_QUIT, 0 ); #endif FiniStatusLine(); CleanupClipboard(); CleanupCursors(); CloseToolBar(); CloseFunctionBar(); _wpi_deletefont( SmallFont ); _wpi_postquitmessage( 0 ); return( 0 ); default: break; } return( _imgwpi_defframeproc( hwnd, ClientWindow, msg, wparam, lparam ) ); } /* ImgEdFrameProc */
int InitMachine(void) { int J; /* Initialize variables */ UseZoom = UseZoom<1? 1:UseZoom>5? 5:UseZoom; InMenu = 0; FastForward = 0; OutImage.Data = 0; KeyReady = 0; /* Initialize system resources */ if (!InitQNX(Title,UseZoom*WIDTH,UseZoom*HEIGHT)) return 0; /* Set visual effects */ BPSSetEffects(UseEffects); /* Create main image buffer */ if(!NewImage(&OutImage,WIDTH,HEIGHT)) { TrashQNX(); return(0); } ClearImage(&OutImage,PIXEL(0,0,0)); CropImage(&ScrImage,&OutImage,XOFFSET,YOFFSET,(TI83_FAMILY?5:4)*TIWIDTH,4*TIHEIGHT); /* Initialize video to main image */ SetVideo(&OutImage,0,0,WIDTH,HEIGHT); /* Set colors */ XPal[0] = White = PIXEL(255,255,255); XPal[1] = Black = PIXEL(0,0,0); /* Attach keyboard handler */ SetKeyHandler(HandleKeys); /* Attach mouse handler */ SetMouseHandler(HandleMouse); /* Initialize sound */ InitSound(UseSound,150); SndSwitch=(1<<4)-1; SndVolume=255/4; SetChannels(SndVolume,SndSwitch); /* Initialize sync timer if needed */ if((SyncFreq>0)&&!SetSyncTimer(SyncFreq*UPeriod/100)) SyncFreq=0; deviceinfo_details_t* data; deviceinfo_get_details(&data); const char* os = deviceinfo_details_get_device_os(data); if (strcmp(os, "BlackBerry 10") == 0) { int i = 0; while (TouchMap[i].KeyCode) { TouchMap[i].X = TouchMap[i].X * 1.28; TouchMap[i].W = TouchMap[i].W * 1.28; TouchMap[i].Y = TouchMap[i].Y * 1.25; TouchMap[i].H = TouchMap[i].H * 1.25; i++; } } deviceinfo_free_details(&data); /* Done */ return(1); }
int main(int argc) { do { char targetCommand; char commandLine[1024]; char* command = gets(commandLine); if (command == NULL) { break; } sscanf(command, "%c", &targetCommand); switch (targetCommand) { case 'I': sscanf(&command[1], "%c %lu %lu", &targetCommand, &width, &height); ClearImage(); break; case 'C': ClearImage(); break; case 'L': { unsigned long x = 0; unsigned long y = 0; char color = 0; sscanf(&command[1], "%c %lu %lu %c", &targetCommand, &x, &y, &color); SetPixel(x, y, color); } break; case 'V': { unsigned long x = 0; unsigned long y1 = 0; unsigned long y2 = 0; char color = 0; sscanf(&command[1], "%c %lu %lu %lu %c", &targetCommand, &x, &y1, &y2, &color); SwapMax(&y1, &y2); DrawRectangle(x, x, y1, y2, color); } break; case 'H': { unsigned long x1 = 0; unsigned long x2 = 0; unsigned long y = 0; char color = 0; sscanf(&command[1], "%c %lu %lu %lu %c", &targetCommand, &x1, &x2, &y, &color); SwapMax(&x1, &x2); DrawRectangle(x1, x2, y, y, color); } break; case 'K': { unsigned long x1 = 0; unsigned long x2 = 0; unsigned long y1 = 0; unsigned long y2 = 0; char color = 0; sscanf(&command[1], "%c %lu %lu %lu %lu %c", &targetCommand, &x1, &y1, &x2, &y2, &color); SwapMax(&x1, &x2); SwapMax(&y1, &y2); DrawRectangle(x1, x2, y1, y2, color); } break; case 'F': { unsigned long x = 0; unsigned long y = 0; char color = 0; sscanf(&command[1], "%c %lu %lu %c", &targetCommand, &x, &y, &color); Fill(x, y, color); } break; case 'S': { char achFile[1024]; sscanf(&command[1], "%c %s", &targetCommand, &achFile); SaveBitmap(achFile); } break; case 'X': return 0; default: break; } } while (1); return 0; }
int main(int argc, char **argv) { int len; char buf[1024 + 128]; #ifdef W3MIMGDISPLAY_SETUID uid_t runner_uid = getuid(); uid_t owner_uid = geteuid(); /* swap real and effective */ setreuid(owner_uid, runner_uid); #endif GetOption(argc, argv); if (!defined_debug) freopen(DEV_NULL_PATH, "w", stderr); #ifdef W3MIMGDISPLAY_SETUID /* * back real and effective * run w3mimg_open() in setuid privileges */ setreuid(runner_uid, owner_uid); #endif w_op = w3mimg_open(); #ifdef W3MIMGDISPLAY_SETUID /* make sure drop privileges now */ setreuid(runner_uid, runner_uid); #endif if (w_op == NULL) exit(1); if (defined_x) w_op->offset_x = offset_x; if (defined_y) w_op->offset_y = offset_y; w_op->max_anim = maxAnim; w_op->clear_margin = clearMargin; if (defined_test) { printf("%d %d\n", w_op->width - w_op->offset_x, w_op->height - w_op->offset_y); w_op->close(w_op); exit(0); } if (defined_size) { if (w_op->init(w_op)) { W3MImage img; int w, h; if (w_op->get_image_size(w_op, &img, defined_size, &w, &h)) printf("%d %d\n", w, h); } w_op->close(w_op); exit(0); } w_op->set_background(w_op, background); while (fgets(buf, sizeof(buf), stdin) != NULL) { if (!(isdigit(buf[0]) && buf[1] == ';')) { fputc('\n', stdout); fflush(stdout); continue; } len = strlen(buf); if (buf[len - 1] == '\n') { buf[--len] = '\0'; if (buf[len - 1] == '\r') buf[--len] = '\0'; } /* * w3mimg protocol * 0 1 2 .... * +--+--+--+--+ ...... +--+--+ * |op|; |args |\n| * +--+--+--+--+ .......+--+--+ * * args is separeted by ';' * op args * 0; params draw image * 1; params redraw image * 2; -none- terminate drawing * 3; -none- sync drawing * 4; -none- nop, sync communication * response '\n' * 5; path get size of image, * response "<width> <height>\n" * 6; params(6) clear image * 7; gif : once * 8; gif : infinite * * params * <n>;<x>;<y>;<w>;<h>;<sx>;<sy>;<sw>;<sh>;<path> * params(6) * <x>;<y>;<w>;<h> * gif * <n>;<x>;<y>;<w>;<h>;<sx>;<sy>;<sw>;<sh>;<path> //n->0 loop, >0 number of times loop * */ switch (buf[0]) { case '0': DrawImage(&buf[2], 0); break; case '1': DrawImage(&buf[2], 1); break; case '2': TermImage(); break; case '3': w_op->sync(w_op); break; case '4': fputs("\n", stdout); fflush(stdout); break; case '5': if (w_op->init(w_op)) { W3MImage img; int w, h; if (w_op->get_image_size(w_op, &img, &buf[2], &w, &h)) { fprintf(stdout, "%d %d\n", w, h); fflush(stdout); } else { fprintf(stdout, "\n"); fflush(stdout); } } else { fprintf(stdout, "\n"); fflush(stdout); } break; case '6': ClearImage(&buf[2]); break; case '7': { printf("single\n"); gif_info *gAnimate; gAnimate=malloc(sizeof(gif_info)); int i; if((i=gif_animate(&buf[2],gAnimate,1))) return i; break; } case '8': { gif_info *gAnimate; gAnimate=malloc(sizeof(gif_info)); int i; if((i=gif_animate(&buf[2],gAnimate,0))) return i; break; } } } TermImage(); w_op->close(w_op); exit(0); }
CPicWnd::~CPicWnd() { ClearImage(); }
void Render( PRENDERER r, int output ) { int a,b; Image surface = GetDisplayImage( r ); RCOORD aspect; if( !output_surface ) output_surface = MakeImageFile( surface->width, surface->height ); aspect = (RCOORD)output_surface->width / (RCOORD)output_surface->height; ofsx = (output_surface->width/2); ofsy = (output_surface->height/2); dx = display_scale*4.0 / (RCOORD)output_surface->width; dy = display_scale*4.0 / (RCOORD)output_surface->height; if( !drawn ) { drawn = 1; ClearImage( output_surface); _ii1_max_iter = 0; _ii2_max_iter = 0; { RCOORD dam, dbm; dam = ( mx - ofsx ) * dx + xorg; dbm = ( my - ofsy ) * dy + yorg; for( a = 0; a < output_surface->width; a++ ) { for( b = 0; b < output_surface->height; b++ ) { RCOORD da, db; RCOORD rda, rdb; int r, g = 0, bl = 0; int direction; //rda = ( ( b *2 ) / (RCOORD)output_surface->height) * sin(3.14159/2 + ( ( a * 2*3.14159 ) / (RCOORD)output_surface->width)); //rdb = ( ( b *2 ) / (RCOORD)output_surface->height) * cos(3.14159/2 + ( ( a * 2*3.14159 ) / (RCOORD)output_surface->width)); //da = ( rda ) + xorg; //db = ( rdb ) + yorg; da = aspect * ( a - ofsx ) * dx + xorg; db = ( b - ofsy ) * dy + yorg; //if( (r = IsInfinite( dam, dbm, da, db )) == -1 ) r = 0; /* // draw just in range of the cursor if( !( ( (mx - a) > -20) && ( (mx-a) < 20 ) && ( (my - b) > -20 ) && ( (my - b) < 20 ) ) ) { continue; } */ //if( (g = IsInfinite2( dam, dbm, da, db )) == -1 ) // g = 0; bl = IsInfinite2( 0, 0, da, db, &direction ); if( (direction) < 0 ) { r = ( -bl ); bl = 0; } else if( bl < 0 ) { g = 32; bl = 0; //r = 0; } else if( bl != 0 ) { //r = 0; bl = bl; } //else // r = 0; if( g == 255 ) { int a = 3; } { // point pair horiz -0.123 (R) 0.35071355833500363833634934966131 // 0.422(I) 0.64961527075646859365525325998975 // // point pair vert -0.563(R) 0.75033325929216279143681201481957 0(I) /*distance to next 0.49986672471039669667784846697923*/ // point pair vert -1.563(R) 1.2501999840025594881146604817988 0(I) /* to next 0.1125178884860932415243100526011 */ // next is -1.857 (R) 1.3627178724886527296389705343999 0(I) RCOORD unity = da*da + db*db; RCOORD offset_unity = (da+0.123)*(da+0.123) + db*db; if( unity < 0.564 && unity >= 0.562 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) ); else if( offset_unity < 0.422 && offset_unity >= 0.420 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) ); else if( unity < 1.001 && unity >= 0.999 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 138, 256 ) ); else if( unity < 1.564 && unity >= 1.562 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) ); else if( unity < 1.868 && unity >= 1.866 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) ); else if( da >= -0.125 && da <= -0.122 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_BLUE, 64, 256 ) ); else if( da >= -0.001 && da <= 0.001 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_GREEN, 64, 256 ) ); else if( db >= -0.001 && db <= 0.001 ) plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_ORANGE, 64, 256 ) ); else plot( output_surface, a, b, Color(r,g,bl) ); } } } } ii1_max_iter = _ii1_max_iter; ii2_max_iter = _ii1_max_iter; if( output ) { // actually put the changes on the screen.... PutString( output_surface, 10, 10, BASE_COLOR_WHITE, BASE_COLOR_BLACK, "Alt+TAB and select application,\nThen Press ALT+F4 to Exit. " ); } } BlotImage( surface, output_surface, 0, 0 ); { { RCOORD dam, dbm; dam = ( mx - ofsx ) * dx + xorg; dbm = ( my - ofsy ) * dy + yorg; for( a = -20; a <= 20; a++ ) { for( b = -20; b <= 20; b++ ) { RCOORD da, db; int r, g = 0, bl = 0; int direction; float v1[3]; float v2[3]; da = aspect * ( mx + a - ofsx ) * dx + xorg; db = ( my + b - ofsy ) * dy + yorg; r = 0; bl = IsInfinite2( 0, 0, da, db, &direction ); if( (direction) < 0 ) { v1[vForward] = bl * 0.05; r = ( bl ); bl = 0; } else if( bl < 0 ) { v1[vForward] = 0.5; g = 32; bl = 0; //r = 0; } else if( bl != 0 ) { v1[vForward] = bl * 0.04; //r = 0; bl = bl; } //else // r = 0; if( g == 255 ) { int a = 3; } glBegin( GL_LINES ); v2[vRight] = v1[vRight] = ( mx + a ) * 0.1; v2[vUp] = v1[vUp] = ( my + b ) * 0.1; v2[vForward] = 0; glColor4ub( r*0xFF,g,bl,255 ); glVertex3fv( v1 ); glVertex3fv( v2 ); glEnd(); //plot( output_surface, a, b, Color(r,g,bl) ); } } } } { RCOORD da, db; int r, g, bl = 0; int iter; da = aspect * ( mx - ofsx ) * dx + xorg; db = ( my - ofsy ) * dy + yorg; //iter = DrawInfinite2( output_surface, 0, 0, da, db, dx, dy, ofsx, ofsy ); iter = GLDrawInfinite2( output_surface, 0, 0, da, db, dx, dy, ofsx, ofsy ); if( 0 ) { TEXTCHAR buf[256]; snprintf( buf,256, "%d %d,%d = %g, %g", iter, mx, my, da, db ); PutString( output_surface, 10, 50, BASE_COLOR_WHITE, BASE_COLOR_BLACK, buf ); } } }