void imProcessRotate90(const imImage* src_image, imImage* dst_image, int dir)
{
  int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
  for (int i = 0; i < src_depth; i++)
  {
    switch(src_image->data_type)
    {
    case IM_BYTE:
      Rotate90(src_image->width, src_image->height, (imbyte*)src_image->data[i],  dst_image->width, dst_image->height, (imbyte*)dst_image->data[i], dir);
      break;
    case IM_USHORT:
      Rotate90(src_image->width, src_image->height, (imushort*)src_image->data[i],  dst_image->width, dst_image->height, (imushort*)dst_image->data[i], dir);
      break;
    case IM_INT:
      Rotate90(src_image->width, src_image->height, (int*)src_image->data[i],  dst_image->width, dst_image->height, (int*)dst_image->data[i], dir);
      break;
    case IM_FLOAT:
      Rotate90(src_image->width, src_image->height, (float*)src_image->data[i],  dst_image->width, dst_image->height, (float*)dst_image->data[i], dir);
      break;
    case IM_CFLOAT:
      Rotate90(src_image->width, src_image->height, (imcfloat*)src_image->data[i],  dst_image->width, dst_image->height, (imcfloat*)dst_image->data[i], dir);
      break;
    }
  }
}
Exemple #2
0
void DrawForPrinting(wxDC *printerdc, const CalChartConfiguration& config, const CalChartDoc& show, const CC_sheet& sheet, unsigned ref, bool landscape)
{
    auto boundingBox = GetMarcherBoundingBox(sheet.GetPoints());
    bool forced_landscape = !landscape && (boundingBox.second.x - boundingBox.first.x) > Int2Coord(kFieldStepSizeNorthSouth[0]);

    auto bitmapWidth = (landscape || forced_landscape ? kSizeXLandscape : kSizeX)*kBitmapScale;
    auto bitmapHeight = (landscape || forced_landscape ? kSizeYLandscape : kSizeY)*kBitmapScale;
    // construct a bitmap for drawing on.  This should
    wxBitmap membm(bitmapWidth, bitmapHeight);
    // first convert to image
    wxMemoryDC memdc(membm);
    DrawForPrintingHelper(memdc, config, show, sheet, ref, landscape || forced_landscape);

    auto image = membm.ConvertToImage();
    if (forced_landscape)
    {
        image = image.Rotate90(false);
    }
    wxBitmap rotate_membm(image);
    wxMemoryDC tmemdc(rotate_membm);

    int printerW, printerH;
    printerdc->GetSize(&printerW, &printerH);
    auto scaleX = printerW/float(rotate_membm.GetWidth());
    auto scaleY = printerH/float(rotate_membm.GetHeight());
    printerdc->SetUserScale(scaleX, scaleY);
    printerdc->Blit(0, 0, rotate_membm.GetWidth(), rotate_membm.GetHeight(), &tmemdc, 0, 0);
}
void SquareOrbit(int clockwise)
{
		Rotate90(-1 * clockwise);
		// Go half distance
		setMotor(50); // 50 is 22cm/s, square each side should be 50 cm
		wait1Msec(1000);
		setMotor(0);
		wait1Msec(200);
			int i = 0;
		for( i = 0; i < 5; i ++){
			Rotate90(1 * clockwise);
			// Go full distance
			setMotor(45); // 50 is 22cm/s, square each side should be 50 cm
			wait1Msec(2000);
			setMotor(0);
			wait1Msec(250);
		}

}
void SearchSaturn()
{
		// Rotate 90 degrees, then start sweeping the sonar sensor

		Rotate90(-1);
		setMotor(0);

		// Rotate in the other direction on spot
		motor[motorB] = 20;
		motor[motorC] = -20;

		while(SensorValue[sonarSensor] > 70){
				// Keep rotating
		}
		setMotor(0);

}
void PlanetSearch(int clockwise)
{
			// Rotate 90 degrees, then start sweeping the sonar sensor

		Rotate90(1 * clockwise);
		setMotor(0);
		wait1Msec(100);
		// Rotate in the other direction on spot
		motor[motorB] = -10 * clockwise;
		motor[motorC] = 10* clockwise;

		while(SensorValue[sonarSensor] > 60){
				// Keep rotating
		}
		setMotor(0);
		// Now pointing right at the planet, approach the planet
		while(SensorValue[sonarSensor] > 15){
			setMotor(50);
		}
		setMotor(0);

}