int JBMPFile::load(char* fileName) { JFileInputStream fis; try { JBITMAPFILEHEADER fileHeader; JBITMAPINFOHEADER infoHeader; JBITMAPCOREINFO coreInfo; JBlock pdata; JRGBQUAD *palette = null; uchar *image = null; int paletteCount, bitCount; int scanWidth, imageSize; fis.open(fileName); fis >> JBlock(FILEHEADERSIZE, (char*)&fileHeader); if (fileHeader.bfType != *(ushort*)"BM") return TYPE_ERR; fis >> JBlock(infoHeader.biSize); if (infoHeader.biSize == INFOHEADERSIZE) { fis >> JBlock(INFOHEADERSIZE-4, (char*)&infoHeader.biWidth); } else if (infoHeader.biSize == COREINFOSIZE) { fis >> JBlock(COREINFOSIZE-4, (char*)&coreInfo.bcWidth); infoHeader.biSize = INFOHEADERSIZE; infoHeader.biWidth = (int)coreInfo.bcWidth; infoHeader.biHeight = (int)coreInfo.bcHeight; infoHeader.biPlanes = coreInfo.bcPlanes; infoHeader.biBitCount = coreInfo.bcBitCount; infoHeader.biCompression = BI_RGB; infoHeader.biSizeImage = null; infoHeader.biXPelsPerMeter = null; infoHeader.biYPelsPerMeter = null; infoHeader.biClrUsed = null; infoHeader.biClrImportant = null; } else return TYPE_ERR;
void JBAddObj::engine(int n, JLinkObj& link) { JString oldv = value; inputSet(n).forEachChild(DoBAddEngin, (void**)&(value=JBlock())); if (value != oldv) broadcast(0); }
void CDisplay::GenerateNewBlockOrder() { bool placed[7]; for(int i = 0; i < 7; i++) placed[i] = false; for(int i = 0; i < 7; i++) { int r; do { r = rand() % 7; } while(placed[r]); placed[r] = true; switch(r) { case 0: BlockOrder[i] = IBlock(); break; case 1: BlockOrder[i] = OBlock(); break; case 2: BlockOrder[i] = TBlock(); break; case 3: BlockOrder[i] = LBlock(); break; case 4: BlockOrder[i] = JBlock(); break; case 5: BlockOrder[i] = SBlock(); break; case 6: BlockOrder[i] = ZBlock(); break; } BlockOrder[i]->Init(); BlockOrder[i]->SetColor((rand() % 5) + 1); } }
void JTNG4Obj::procCOM(uchar code) { cs.lock(); static char* prefix = "ABCD"; buf = JBlock(oseparators[osepCount])+ JBlock(code); if (code & 1) buf += JBlock(prefix[1])+JBlock(vi[IN_BCONFIG])+JBlock(vi[IN_B]); if (code & 2) buf += JBlock(prefix[2])+JBlock(vi[IN_CCONFIG])+JBlock(vi[IN_C]); if (code & 4) buf += JBlock(prefix[3])+JBlock(vi[IN_DCONFIG])+JBlock(vi[IN_D]); if (code & 0xF0) { buf += JBlock(prefix[0]); if (code & 16) buf += JBlock(vi[IN_A1]); if (code & 32) buf += JBlock(vi[IN_A2]); if (code & 64) buf += JBlock(vi[IN_A3]); if (code & 128) buf += JBlock(vi[IN_A4]); } if (extraInputCount > 0) buf += JBlock(extraInputCount, vi+IN_LAST); osepCount = (osepCount+1)%2; broadcast(OUT_COM); cs.unlock(); }