Changeset 3 in projects for visualisator/lochstreifen.c
- Timestamp:
- Jul 19, 2008, 2:16:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
visualisator/lochstreifen.c
r1 r3 157 157 l->d = 10; 158 158 l->data_length = 0; 159 l->data = NULL; 160 l->empty_start = 0; 161 l->empty_end = 0; 159 162 l->debug = 0; 160 163 l->hintergrund = NULL; // nicht zeichnen … … 168 171 l->spiegelung_hor = 0; 169 172 l->spiegelung_ver = 0; 173 l->highlight_byte = 0; 174 l->highlight_color = NULL; 170 175 lochstreifen_flush_only_start_area(l); 171 176 return l; … … 181 186 if(empty_start >= 0) l->empty_start = empty_start; 182 187 if(empty_end >= 0) l->empty_end = empty_end; 188 } 189 190 void lochstreifen_set_highlight(LOCHSTREIFEN* l, int byte_number) { 191 l->highlight_byte = byte_number; 192 if(l->highlight_color == NULL) 193 l->highlight_color = cairo_pattern_create_rgb(242/255, 255/255, 0); 183 194 } 184 195 … … 357 368 else if(byte > l->data_length) return -1; // im Emptyendbereich 358 369 else return byte; // im gueltigen Bereich -- Byte gefunden! 359 370 } 371 372 int lochstreifen_coordinate_by_byte(LOCHSTREIFEN *l, int byte) { 373 /** 374 * Anhang eines Bytes (fuers Datenarray, ab 0 zaehlend) wird -- abhaengig nach aktueller 375 * Ausrichtung des Lochstreifens -- die Koordinate des Bytes in der Dimension der 376 * Ausrichtung des Lochstreifens zurueckgegeben.. 377 * Liegt der Lochstreifen horizontal, so wird die x-Koordinate zurueckgegeben. Liegt er 378 * vertikal, dann die y-Koordinate. 379 * 380 **/ 381 int xy; 382 //if(lochstreifen_get_orientation(l)) { // horizontal = 1 | vertical = 0 383 xy = l->margin + l->abriss + (l->d + l->bspace) * (byte + l->empty_start); 384 //} 385 386 return xy; 387 // TODO! Richtige implementierung! 360 388 } 361 389 … … 375 403 x1 = l->only_start_x; y1 = l->only_start_y; 376 404 x2 = x1 + width; y2 = y1 + height; 377 405 378 406 /*int x1,y1,x2,y2,x3,y3,x4,y4; 379 407 x1 = l->only_start_x; y1 = l->only_start_y; … … 412 440 cairo_matrix_multiply(&matrix, &matrix, &temp); 413 441 } 414 442 415 443 //if(l->drehung > 0) { 416 444 /*cairo_matrix_rotate(&matrix, l->drehung/2 *M_PI); … … 428 456 cairo_set_matrix(cr, &matrix); 429 457 // -1, 0, 0, 1, width, 0 = spiegelung x-achse 430 458 431 459 //cairo_device_to_user(cr, (double*)&(l->only_start_x), (double*)&(l->only_start_y)); 432 460 cairo_device_to_user(cr, (double*)&(x1), (double*)&(y1)); … … 508 536 if(l->only_width != 0 && x > l->only_start_x + l->only_width) break; 509 537 538 // ggf. Byte hervorheben 539 if(byte == l->highlight_byte && l->highlight_color != NULL) { 540 cairo_set_source(cr, l->highlight_color); 541 cairo_rectangle(cr, x - l->bspace/2, l->margin, l->df*2 + l->bspace, height - 2*l->margin); 542 cairo_fill(cr); 543 } 544 510 545 // Bits des entsprechenden Bytes durchgehen 511 546 for(loch=0, y = l->margin + l->padding; loch < 8; y += l->d + l->hspace, loch++) {
Note: See TracChangeset
for help on using the changeset viewer.