Previous 199869 Revisions Next

r18407 Wednesday 10th October, 2012 at 12:30:15 UTC by hap
rendlay: added support for folding rects diagonally, allowing you to draw right-angled triangles (use <orientation> to flip/rotate them)
[src/emu]rendlay.c rendlay.h

trunk/src/emu/rendlay.c
r18406r18407
737737
738738   // rect nodes
739739   else if (strcmp(compnode.name, "rect") == 0)
740   {
740741      m_type = CTYPE_RECT;
742      m_foldrect = xml_get_attribute_int_with_subst(machine, compnode, "fold", 0);
743   }
741744
742745   // disk nodes
743746   else if (strcmp(compnode.name, "disk") == 0)
r18406r18407
853856
854857   // iterate over X and Y
855858   for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
856      for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
859   {
860      // if folded, find the right edge
861      UINT32 max_x = bounds.max_x;
862      if (m_foldrect == 1)
863         max_x = bounds.min_x + ((float)(y - bounds.min_y) / (float)(bounds.max_y - bounds.min_y)) * (float)(bounds.max_x - bounds.min_x) + 0.5;
864
865      for (UINT32 x = bounds.min_x; x <= max_x; x++)
857866      {
858867         UINT32 finalr = r;
859868         UINT32 finalg = g;
r18406r18407
871880         // store the target pixel, dividing the RGBA values by the overall scale factor
872881         dest.pix32(y, x) = MAKE_ARGB(0xff, finalr, finalg, finalb);
873882      }
883   }
874884}
875885
876886
trunk/src/emu/rendlay.h
r18406r18407
163163      astring            m_string;               // string for text components
164164      int               m_digits;               // number of digits for simple counters
165165      int               m_textalign;            // text alignment to box
166      int               m_foldrect;               // fold rect diagonally
166167      bitmap_argb32      m_bitmap[MAX_BITMAPS];      // source bitmap for images
167168      astring            m_dirname;               // directory name of image file (for lazy loading)
168169      emu_file *         m_file[MAX_BITMAPS];      // file object for reading image/alpha files

Previous 199869 Revisions Next


© 1997-2024 The MAME Team