Пример #1
0
bool CWBButton::LoadBitmaps
(
     UINT id, int count ,    
     int TopHeight, int BottomHeight, int LeftWidth, int RightWidth
)
{
    m_TopHeight = TopHeight;
    m_BottomHeight = BottomHeight;
    m_LeftWidth = LeftWidth;
    m_RightWidth = RightWidth;

    m_RcId       = id;       // Resource ID
    m_NumofPics  = count;  


    CBitmap bmp;
    if( !bmp.LoadBitmap(id) ) return false;

    if( !InitBitmap( bmp, NormalBitmap, 0, count ) ) return false;
    if( !InitBitmap( bmp, SelectBitmap, 1, count ) ) return false;
    if( !InitBitmap( bmp, DisableBitmap,2, count ) ) return false;
    if( !InitBitmap( bmp, FocusBitmap,  3, count ) ) return false;

    bmp.DeleteObject();

    return true;
}
Пример #2
0
void CTitleBar::ConstructL(const TDesC& aTitleDes)
{
// 	iTitleText.Zero();
// 	iTitleText.Append(aTitleDes.Left(iTitleText.MaxLength()));

	InitBitmap();
	/*
	WriteLogsL(_L("CTitleBar::ConstructL"));
	WriteLogsL(aTitleDes);
	iTitleText = aTitleDes.AllocL();
	WriteLogsL(_L("CTitleBar::ConstructL iTitleText = %d"),iTitleText);
	const TDesC& testDes = *iTitleText;
	WriteLogsL(_L("CTitleBar::ConstructL iTitleText len = %d"),iTitleText->Length());
	WriteLogsL(testDes);
	WriteLogsL(*iTitleText);
	*/

	iSlideRect = iRect;
	iSlideText = CSlideText::NewL(iMainEngine,CSlideText::ELeftWithPause);
	iSlideText->SetFont(iFont);
	iSlideText->SetTextColor(KRgbWhite);
	iSlideText->SetMoveSpeed(5);
	iSlideText->SetStopTime(20);
	iSlideText->Layout(ECenterAlign);
	iSlideText->SetClientRect(iSlideRect);
	iSlideText->SetText(aTitleDes);
}
Пример #3
0
// Owner-drawn control service function:
void CVectorCtl::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC); // Get CDC to draw

	if (!m_bSelected && lpDrawItemStruct->itemState & ODS_SELECTED) {
			// Just got re-selected (user starts a new mouse dragging session)
	} else if (m_bSelected && // Last state was selected
			   !(lpDrawItemStruct->itemState & ODS_SELECTED) &&     // New state is NOT selected
			   (lpDrawItemStruct->itemState & ODS_FOCUS) &&         // New state is still in focus
			   m_procVectorChanged)     // User asked for a callback
		// User has left the track-ball and asked for a callback.
		m_procVectorChanged ( rotationQuat );

	m_bHasFocus = lpDrawItemStruct->itemState & ODS_FOCUS;      // Update focus status
	m_bSelected = lpDrawItemStruct->itemState & ODS_SELECTED;   // Update selection status

	if (!m_bBmpCreated)  // 1st time
		InitBitmap (lpDrawItemStruct, pDC);
	if (m_bImageChange) {   // Image has changes - recalc it!
		if (m_procVectorChanging)   // User has specified a callback
			m_procVectorChanging ( rotationQuat ); // Call it!
		BuildImage (lpDrawItemStruct);
		m_bImageChange = FALSE;
	}
	pDC->BitBlt (0,0,m_iWidth, m_iHeight, &m_dcMem, 0, 0, SRCCOPY); // Update screen
}
Пример #4
0
RenderTarget::RenderTarget(UINT InWidth, UINT InHeight) :
	Width(InWidth),
	Height(InHeight),
	Size(InWidth * InHeight)
{
	InitBitmap();
}
void CContentInfoDialog::RedrawView(TInt aType)
{
	if(aType==0)
	{
		DELETE(iShowBmp);
		iShowBmp=&(iAdapter->Image());
		InitBitmap();
		InitScrollBar();
		RequestDraw();
	}
}
Пример #6
0
    MyRawBitmapFrame(wxFrame *parent)
        : wxFrame(parent, wxID_ANY, wxT("Raw bitmaps (how exciting)")),
        m_bitmap(SIZE, SIZE, 24),
        m_alphaBitmap(SIZE, SIZE, 32)
    {
        SetClientSize(SIZE, SIZE*2+25);

        InitAlphaBitmap();
        InitBitmap();

    }
Пример #7
0
void FreeBitmap(CSBitmap* pBitmap)
{
	// Carefully free up the resources we allocated.
	if (pBitmap->mBitmapDC)
	{
		if (pBitmap->mBitmapMonochrome)
		{
			// Select the stock 1x1 monochrome bitmap back in. It is critically important
			// that you do that before deleting the bitmap and device context, or else
			// the DeleteObject() and DeleteDC() commands may silently fail.
			HBITMAP hBitmapOld = SelectBitmap(pBitmap->mBitmapDC, pBitmap->mBitmapMonochrome);
			assert(hBitmapOld == pBitmap->mBitmapNew);
		}
		if (pBitmap->mBitmapNew)
			DeleteObject(pBitmap->mBitmapNew);
		if (pBitmap->mBitmapDC)
			DeleteDC(pBitmap->mBitmapDC);
	}
	// Zero all of the resource handles, so that we don't
	// free resources multiple times.
	InitBitmap(pBitmap);
}
Пример #8
0
Bitmap::Bitmap() {
	InitBitmap();
}
Пример #9
0
// Routine to startup and install all the hooks and stuff
BOOL
vncDesktop::Startup()
{


	KillScreenSaver();

	if (!InitDesktop())
		return FALSE;

	if (!InitBitmap())
		return FALSE;

	if (!ThunkBitmapInfo())
		return FALSE;

	EnableOptimisedBlits();

	if (!SetPixFormat())
		return FALSE;

    if (!SetPixShifts())
		return FALSE;

	if (!SetPalette())
		return FALSE;

	if (!InitWindow())
		return FALSE;

	// Add the system hook
/*
if (!SetHooks(
		GetCurrentThreadId(),
		RFB_SCREEN_UPDATE,
		RFB_COPYRECT_UPDATE,
		RFB_MOUSE_UPDATE
		))
	{
		//vnclog.Print(LL_INTERR, VNCLOG("failed to set system hooks\n"));
		// Switch on full screen polling, so they can see something, at least...
		m_server->PollFullScreen(TRUE);
	} else {
		//vnclog.Print(LL_INTERR, VNCLOG("set hooks OK\n"));
	}

	// Start up the keyboard and mouse filters
	SetKeyboardFilterHook(m_server->LocalInputsDisabled());
	SetMouseFilterHook(m_server->LocalInputsDisabled());
*/
    m_server->PollFullScreen(TRUE);

	// Start a timer to handle Polling Mode.  The timer will cause
	// an "idle" event once every quarter second, which is necessary if Polling
	// Mode is being used, to cause TriggerUpdate to be called.
	m_timerid = SetTimer(m_hwnd, 1, 250, NULL);

	// Initialise the buffer object
	m_buffer.SetDesktop(this);

	// Create the quarter-screen rectangle for polling
	m_qtrscreen = rfb::Rect(0, 0, m_bmrect.br.x, m_bmrect.br.y/4);

	// Everything is ok, so return TRUE
	return TRUE;
}
Пример #10
0
int main( int argc, char *argv[] )
{
  char out_filename[256];
  
  if( argc != 4 )
  {
    fprintf( stderr, "closeshp poly_shape arc_shape output_shape\n" );
    return 1;
  }
  char *poly_file = argv[1];
  char *arc_file = argv[2];
  char *out_file = argv[3];

  struct source poly, arc, simplified;
  memset( &poly, 0, sizeof(poly) );
  memset( &arc, 0, sizeof(arc) );
  memset( &simplified, 0, sizeof(simplified) );
  poly.in_memory = arc.in_memory = 0;
  simplified.in_memory = 1;

  /* open shapefiles and dbf files */
  if( SourceOpen( &poly, poly_file, SHPT_POLYGON ) )
    return 1;
  if( SourceOpen( &arc, arc_file, SHPT_ARC ) )
    return 1;

  sprintf( out_filename, "%s_p", out_file );
  shp_out = SHPCreate( out_filename, SHPT_POLYGON );
  if( !shp_out )
  {
    fprintf( stderr, "Couldn't create shapefile '%s': %s\n", out_file, strerror(errno));
    return 1;
  }
  
  dbf_out = DBFCreate( out_filename );
  if( !dbf_out )
  {
    fprintf( stderr, "Couldn't create DBF '%s': %s\n", out_file, strerror(errno));
    return 1;
  }
//  DBFAddField( dbf_out, "way_id", FTInteger, 11, 0 );
//  DBFAddField( dbf_out, "orientation", FTInteger, 1, 0 );
  DBFAddField( dbf_out, "error", FTInteger, 1, 0 );
  DBFAddField( dbf_out, "tile_x", FTInteger, 4, 0 );
  DBFAddField( dbf_out, "tile_y", FTInteger, 4, 0 );

  /* Initialise node arrays */
  v_x = malloc( MAX_NODES * sizeof(double) );
  v_y = malloc( MAX_NODES * sizeof(double) );
  
  if( !v_x || !v_y )
  {
    fprintf( stderr, "Couldn't allocate memory for nodes\n" );
    return 1;
  }
  /* Setup state */
  struct state state;
  memset( &state, 0, sizeof(state) );
  ResizeSubareas(&state, INIT_MAX_SUBAREAS);
  
  // Temporary file for simplified shapes
  {
      // Make the file and open it
      char filename[32];
      sprintf( filename, "tmp_coastline_%d", getpid() );
      simplified.shp = SHPCreate( filename, SHPT_ARC );
      if( !simplified.shp )
      {
          fprintf( stderr, "Couldn't open temporary shapefile: %s\n", strerror(errno) );
          return 1;
      }
      // And now unlink them so they're cleaned up when we die
      int len = strlen( filename );
      strcpy( filename+len, ".shp" );
      unlink(filename);
      strcpy( filename+len, ".shx" );
      unlink(filename);
      
      // Setup the bitmap while creating the simplified polygons
      InitBitmap( &arc, &simplified );
      InitBitmap( &poly, &simplified );
      
      // And index the simplified polygons
      simplified.shx = SHPCreateTree( simplified.shp, 2, 10, NULL, NULL );
      if( !simplified.shx )
      {
          fprintf( stderr, "Couldn't build temporary shapetree\n" );
          return 1;
      }
      SHPGetInfo( simplified.shp, &simplified.shape_count, NULL, NULL, NULL );
      simplified.shapes = calloc( simplified.shape_count, sizeof(SHPObject*) );
  }
  /* Split coastlines into arcs no longer than MAX_NODES_PER_ARC long */
  sprintf( out_filename, "%s_i", out_file );
  SplitCoastlines( &poly, &arc, out_filename );

#if !TEST  
  for( int i=0; i<DIVISIONS; i++ )
    for( int j=0; j<DIVISIONS; j++ )  //Divide the world into mercator blocks approx 100km x 100km
#else
  for( int i=204; i<=204; i++ )
    for( int j=248; j<=248; j++ )  //Divide the world into mercator blocks approx 100km x 100km
#endif
    {
      state.x = i;
      state.y = j;
      
      double left   = -MERC_MAX + (i*MERC_BLOCK) - TILE_OVERLAP;
      double right  = -MERC_MAX + ((i+1)*MERC_BLOCK) + TILE_OVERLAP;
      double bottom = -MERC_MAX + (j*MERC_BLOCK) - TILE_OVERLAP;
      double top    = -MERC_MAX + ((j+1)*MERC_BLOCK) + TILE_OVERLAP;
      
      if( left  < -MERC_MAX ) left  = -MERC_MAX;
      if( right > +MERC_MAX ) right = +MERC_MAX;
      
      state.lb[0] = left;
      state.lb[1] = bottom;
      state.rt[0] = right;
      state.rt[1] = top;
      
      if(isatty(STDERR_FILENO))
//        fprintf( stderr, "\rProcessing (%d,%d)  (%.2f,%.2f)-(%.2f,%.2f)   ", i, j, left, bottom, right, top );
        fprintf( stderr, "\rProcessing (%d,%d)  (%.2f,%.2f)-(%.2f,%.2f)   ", i, j, state.lb[0], state.lb[1], state.rt[0], state.rt[1] );
      state.seg_count = 0;
      state.subarea_count = 0;
      state.subarea_nodecount = 0;
      state.enclosed = 0;
      
      // Optimisation: if we have determined nothing enters the tile, we can used the simplified tiles
      // Basically, we only need to test for enclosure
      if( check_tile( state.x, state.y ) )
      {
        Process( &state, &poly, 1 );
        Process( &state, &arc,  0 );
      }
      else
        Process( &state, &simplified, 0 );

      OutputSegs( &state );
    }
    
  free( state.sub_areas );
  free( simplified.shapes );
  SHPDestroyTree( poly.shx );
  SHPDestroyTree( arc.shx );
  SHPDestroyTree( simplified.shx );
  DBFClose( poly.dbf );
  DBFClose( arc.dbf );
  DBFClose( dbf_out );
  SHPClose( poly.shp );
  SHPClose( arc.shp );
  SHPClose( simplified.shp );
  SHPClose( shp_out );
  
  printf("\n");
  return 0;
}