bool MCamera::getHalfSizeImages3(unsigned char ***li, unsigned char ***ri, unsigned char ***mi, int xRes, int yRes) { if (limage == NULL) { limage = (unsigned char *)calloc (sizeof(unsigned char), getXRes() * getYRes()/2); } if (rimage == NULL) { rimage = (unsigned char *)calloc (sizeof(unsigned char), getXRes() * getYRes()/2); } if (mimage == NULL) { mimage = (unsigned char *)calloc (sizeof(unsigned char), getXRes() * getYRes()/2); } int r = Camera_HalfSizeImagesGet3(m_handle, (unsigned char *)limage, (unsigned char *)rimage, (unsigned char *)mimage); if (r != mtOK) { *li = NULL; *ri = NULL; *mi = NULL; return false; } else { *li = (unsigned char **)limage; *ri = (unsigned char **)rimage; *mi = (unsigned char **)mimage; return true; } }
bool MCamera::getImages( unsigned char ***li, unsigned char ***ri) { if (limage == NULL) { limage = (unsigned char *)calloc (sizeof(unsigned char), getXRes() * getYRes()); } if (rimage == NULL) { rimage = (unsigned char *)calloc (sizeof(unsigned char), getXRes() * getYRes()); } int r = Camera_ImagesGet(m_handle, (unsigned char *)limage, (unsigned char *)rimage); if (r != mtOK) { *li = NULL; *ri = NULL; return false; } else { *li = (unsigned char **)limage; *ri = (unsigned char **)rimage; return true; } }
ossimRefPtr<ossimProjection> ossimFgdcXmlDoc::getProjection() { if ( (m_projection.valid() == false) && isOpen() ) { ossimString projName; if ( getProjCsn(projName) ) { if (!projName.empty()) { m_projection = ossimEpsgProjectionFactory::instance()->createProjection(projName); if ( m_projection.valid() ) { ossimDpt gsd; gsd.makeNan(); ossim_float64 d; if ( getXRes(d) ) { gsd.x = std::fabs(d); } if ( getYRes(d) ) { gsd.y = std::fabs(d); } ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(m_projection.get()); if (mapProj) { ossimDrect rect; getBoundingBox(rect); if (mapProj->isGeographic()) { ossimGpt tie(rect.ul().lat, rect.ul().lon); mapProj->setUlTiePoints(tie); mapProj->setDecimalDegreesPerPixel(gsd); } else { ossimDpt tie(rect.ul().x, rect.ul().y); ossimUnitType unitType = getUnitType(); if ( unitType == OSSIM_US_SURVEY_FEET) { gsd = gsd * US_METERS_PER_FT; tie = tie * US_METERS_PER_FT; } else if ( unitType == OSSIM_FEET ) { gsd = gsd * MTRS_PER_FT; tie = tie * MTRS_PER_FT; } mapProj->setUlTiePoints(tie); mapProj->setMetersPerPixel(gsd); } } } } } } return m_projection; }
void drawPix(int x, int y, unsigned char R, unsigned char G, unsigned char B, unsigned char alpha){ if (x>=0 && y>=0 && x<getXRes() && y<getYRes()){ location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y+vinfo.yoffset) * finfo.line_length; setColor(R,G,B,alpha); } }
CFontPtr CFont:: rotated(double dangle) const { double angle = getAngle() + dangle; while (angle < 0 ) angle += 360; while (angle >= 360) angle -= 360; return dup(getFamily(), getStyle(), getSize(), angle, getCharAngle(), getXRes(), getYRes()); }
void drawPix(int x, int y, unsigned char R, unsigned char G, unsigned char B, unsigned char A){ // Check if it is within screen boundary if (x>=0 && y>=0 && x<getXRes() && y<getYRes()){ // (xoffset,yoffset) is the (0,0) pixel // location is an array of Y (size: line_length); // Y is an array of X (size: bit-per-pixel); // X is an array of 4x8-bit char; location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y+vinfo.yoffset) * finfo.line_length; setColor(R,G,B,A); } }
void drawRectangle(int x1, int y1, int x2, int y2, unsigned char R, unsigned char G, unsigned char B, unsigned char A) { int i,j; // Check if it is within boundary if (x1<0) x1 = 0; if (y1<0) y1 = 0; for (i=0; i<=y2-y1 && y1+i<getYRes(); i++) { for (j=0; j<=x2-x1 && x1+j<getXRes();j++) { location = (vinfo.yoffset+y1+i) * finfo.line_length + (vinfo.xoffset+x1+j) * (vinfo.bits_per_pixel/8); setColor(R,G,B,A); } } }
int main(){ initializePrinter(); drawCanvas(0,0,0,255); int x,y; y = getYRes()/2; x = getXRes()/2; circle C = makeCircle(0,0,0,255,20,x,y); for (i=0;i<=360;i++) { rotateCircle(C,i,x,y); drawCircle(C); } printToScreen(); finishPrinter(); }
void game::init(){ initTermios(); initializePrinter(); kapalterbang newkapal(getXRes(),50,50,20); kapalterbang1 = newkapal; addScreenObject(&kapalterbang1); kapalterbang newkapal2(getXRes(),50,50,20,"planecolor2.txt"); kapalterbang2 = newkapal2; addScreenObject(&kapalterbang2); kapalterbang newkapal3(getXRes(),50,50,20,"planecolor3.txt"); kapalterbang3 = newkapal3; addScreenObject(&kapalterbang3); kapallaut newkapallaut(50,getYRes()-80,270*PI/180); kapallaut1 = newkapallaut; addScreenObject(&kapallaut1); }
ossimProjection* ossimFgdcXmlDoc::getProjection() { if ( m_projection.valid() ) { return m_projection.get(); } ossimDrect rect = getBoundingBox(); ossimString projName (getProjCsn()); if (!projName.empty()) { m_projection = ossimEpsgProjectionFactory::instance()->createProjection(projName); if ( m_projection.valid() ) { ossimDpt gsd(fabs(getXRes()), fabs(getYRes())); ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(m_projection.get()); if (mapProj) { if (mapProj->isGeographic()) { ossimGpt tie(rect.ul().lat, rect.ul().lon); mapProj->setUlTiePoints(tie); mapProj->setDecimalDegreesPerPixel(gsd); } else { ossimDpt tie(rect.ul().x, rect.ul().y); if (getUnits().upcase() == "FEET") { gsd = gsd * METER_PER_FOOT; tie = tie * METER_PER_FOOT; } mapProj->setUlTiePoints(tie); mapProj->setMetersPerPixel(gsd); } } } } return m_projection.get(); }
ossimRefPtr<ossimProjection> ossimFgdcXmlDoc::getGridCoordSysProjection() { static const char M[] = "ossimFgdcXmlDoc::getGridCoordSysProjection"; if ( traceDebug() ) { ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n"; } if ( m_projection.valid() == false ) { ossimString s; if ( getGridCoordinateSystem(s) ) { ossimString gridsysn = s.downcase(); if ( getHorizontalDatum(s) ) { ossimString horizdn = s.downcase(); const ossimDatum* datum = createOssimDatum(s); // throws exception if ( gridsysn == "universal transverse mercator" ) { // Get the zone: if ( getUtmZone(s) ) { ossim_int32 zone = s.toInt32(); //--- // Note: Contruct with an origin with our datum. // "proj->setDatum" does not change the origin's datum. // This ensures theossimEpsgProjectionDatabase::findProjectionCode // sets the psc code correctly down the line. //--- ossimRefPtr<ossimUtmProjection> utmProj = new ossimUtmProjection( *(datum->ellipsoid()), ossimGpt(0.0,0.0,0.0,datum) ); utmProj->setDatum(datum); utmProj->setZone(zone); // Hemisphere( North false easting = 0.0, South = 10000000): bool tmpResult = getUtmFalseNorthing(s); if ( tmpResult && ( s != "0.0" ) ) { utmProj->setHemisphere('S'); } else { utmProj->setHemisphere('N'); } utmProj->setPcsCode(0); ossim_float64 xRes = 0.0; ossim_float64 yRes = 0.0; if (getXRes(xRes) && getYRes(yRes)) { ossimDrect rect; getBoundingBox(rect); ossimDpt gsd(std::fabs(xRes), std::fabs(yRes)); ossimUnitType unitType = getUnitType(); if (m_boundInDegree) { ossimGpt tieg(rect.ul().lat, rect.ul().lon); utmProj->setUlTiePoints(tieg); } else { ossimDpt tie(rect.ul().x, rect.ul().y); if ( unitType == OSSIM_US_SURVEY_FEET) { tie = tie * US_METERS_PER_FT; } else if ( unitType == OSSIM_FEET ) { tie = tie * MTRS_PER_FT; } utmProj->setUlTiePoints(tie); } if ( unitType == OSSIM_US_SURVEY_FEET) { gsd = gsd * US_METERS_PER_FT; } else if ( unitType == OSSIM_FEET ) { gsd = gsd * MTRS_PER_FT; } utmProj->setMetersPerPixel(gsd); } m_projection = utmProj.get(); // Capture projection. } else { std::string errMsg = M; errMsg += " ERROR: Could not determine utm zone!"; throw ossimException(errMsg); } } } } } if ( traceDebug() ) { if ( m_projection.valid() ) { m_projection->print(ossimNotify(ossimNotifyLevel_DEBUG)); } ossimNotify(ossimNotifyLevel_DEBUG) << M << " exiting...\n"; } return m_projection; }
CFontPtr CFont:: dup() const { return dup(getFamily(), getStyle(), getSize(), getAngle(), getCharAngle(), getXRes(), getYRes()); }