Adesk::Boolean AsdkSmiley::worldDraw(AcGiWorldDraw *wd) { assertReadEnabled(); AcGeVector3d offset(0,0,0); AcGeCircArc3d face = mfacecircle; // If dragging, don't fill the smiley // if( wd->isDragging() ){ wd->subEntityTraits().setColor( colorIndex() ); wd->subEntityTraits().setFillType( kAcGiFillNever ); } else wd->subEntityTraits().setFillType( kAcGiFillAlways ); // Give the circle a GS marker of 1 // wd->subEntityTraits().setSelectionMarker( 1 ); wd->geometry().circle( face.center(), face.radius(), mnormal ); if( !wd->isDragging() ) wd->subEntityTraits().setColor( 250 ); // Give the eyes GS markers of 2 etc. // AcGePoint3dArray eyearray; eyes( eyearray ); for( int i = 0; i < eyearray.length(); i++ ){ wd->subEntityTraits().setSelectionMarker( i + 2 ); wd->geometry().circle( eyearray.at(i) + offset, meyesize, mnormal ); } AcGePoint3d smilecen( mouthCenter() + offset ), startpt( mouthLeft() + offset ), endpt( mouthRight() + offset ); AcGeVector3d startvec = startpt - smilecen, endvec = endpt - smilecen; double mouthangle = startvec.angleTo( endvec ); wd->subEntityTraits().setSelectionMarker( eyearray.length() + 2 ); wd->geometry().circularArc( smilecen, mouthRadius(), mnormal, startvec, mouthangle, kAcGiArcChord ); return Adesk::kTrue; }
Acad::ErrorStatus asdkBolt::dwgOutFields(AcDbDwgFiler* pFiler) const { assertReadEnabled(); Acad::ErrorStatus es; // Call dwgOutFields from AcDbEntity if ((es = AcDbEntity::dwgOutFields(pFiler)) != Acad::eOk) { return es; } // Write version number. pFiler->writeItem((Adesk::UInt16) VERSION_ASDKBOLT); // Write the data members. pFiler->writeItem(headDiameter); pFiler->writeItem(headHeight); pFiler->writeInt32(headSides); pFiler->writeItem(shaftDiameter); pFiler->writeItem(shaftLength); pFiler->writeItem(threadLength); pFiler->writeItem(threadWidth); pFiler->writeBytes(transformation.entry,128); pFiler->writeItem(alignment); pFiler->writeItem(position); pHead->dwgOutFields(pFiler); pShaft->dwgOutFields(pFiler); if(visibility()==AcDb::kVisible) int j=1; char *layername; layername=layer(); int color=colorIndex(); color=pHead->colorIndex(); color=pShaft->colorIndex(); return pFiler->filerStatus(); }
/** * Write Bitmap image * * @param filename is a pointer to a null terminated string that is the * path and filename name to the the bitmap file to be written. * * @return In the case that the bitmap is written true is returned. In * the case that a bitmap image is not already loaded or the write fails * for some reason false is returned. */ bool write(const char * filename) { if (!isLoaded_) { return false; } // Open BMP file FILE * fd = fopen(filename, "wb"); //FILE * fd; //fopen_s(&fd, filename, "wb"); // Opened OK if (fd != NULL) { // Write header fwrite((BitMapHeader *)this, sizeof(BitMapHeader), 1, fd); // Failed to write header if (ferror(fd)) { fclose(fd); return false; } // Write map info header fwrite((BitMapInfoHeader *)this, sizeof(BitMapInfoHeader), 1, fd); // Failed to write map info header if (ferror(fd)) { fclose(fd); return false; } // Write palate for 8 bits per pixel if(bitsPerPixel == 8) { fwrite( (char *)colors_, numColors_ * sizeof(ColorPalette), 1, fd); // Failed to write colors if (ferror(fd)) { fclose(fd); return false; } } long fPos = ftell(fd); while (fPos++ < offset) { fputc(0, fd); } for(int y = 0; y < height; y++) { for(int x = 0; x < width; x++) { // Read RGB values if (bitsPerPixel == 8) { fputc( colorIndex( pixels_[(y * width + x)]), fd); } else // 24 bit { fputc(pixels_[(y * width + x)].z, fd); fputc(pixels_[(y * width + x)].y, fd); fputc(pixels_[(y * width + x)].x, fd); if (ferror(fd)) { fclose(fd); return false; } } } // Add padding for(int x = 0; x < (4 - (3 * width) % 4) % 4; x++) { fputc(0, fd); } } return true; } return false; }
void SubToolBar::updateColor(QColor color) { int colNum = colorIndex(color); ConfigSettings::instance()->setValue("common", "color_index", colNum); emit currentColorChanged(color); }
void ColorBox::setColor(const QColor& c) { setCurrentIndex(colorIndex(c)); }