Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. match =MMX, COMPOSITE_MODE {include 'blend_mmx.asm'}
  2. match =SSE, COMPOSITE_MODE {include 'blend_sse.asm'}
  3.  
  4. ;;============================================================================;;
  5. proc img.blend uses ebx esi edi, _bottom, _top, _xbottom, _ybottom, \ ;///////;;
  6.                                  _xtop, _ytop, _width, _height ;//////////////;;
  7. ;;----------------------------------------------------------------------------;;
  8. ;? Alpha blend _top image to _bottom one (both must be of type Image.bpp32)   ;;
  9. ;;----------------------------------------------------------------------------;;
  10. ;> _bottom = pointer to bottom image (will be changed)                        ;;
  11. ;> _top = pointer to top image (unchanged)                                    ;;
  12. ;> _xbottom = x coord inside _bottom image where to put _top image            ;;
  13. ;> _ybottom = y coord inside _bottom image where to put _top image            ;;
  14. ;> _xtop = x coord inside _top image to start from                            ;;
  15. ;> _ytop = y coord inside _top image to start from                            ;;
  16. ;> _width = width of _top image area to put to _bottom image                  ;;
  17. ;> _height = height of _top image area to put to _bottom image                ;;
  18. ;;----------------------------------------------------------------------------;;
  19. ;< eax = 0 (fail) / _bottom (ok)                                              ;;
  20. ;;============================================================================;;
  21.         mov     esi, [_top]
  22.         mov     edi, [_bottom]
  23.  
  24.         mov     eax, [esi+Image.Width]
  25.         sub     eax, [_width]
  26.         shl     eax, 2
  27.         push    eax
  28.  
  29.         mov     eax, [edi+Image.Width]
  30.         sub     eax, [_width]
  31.         shl     eax, 2
  32.         push    eax
  33.  
  34.         mov     eax, [_ytop]
  35.         imul    eax, [esi+Image.Width]
  36.         add     eax, [_xtop]
  37.         shl     eax, 2
  38.         mov     esi, [esi+Image.Data]
  39.         add     esi, eax
  40.  
  41.         mov     eax, [_ybottom]
  42.         imul    eax, [edi+Image.Width]
  43.         add     eax, [_xbottom]
  44.         shl     eax, 2
  45.         mov     edi, [edi+Image.Data]
  46.         add     edi, eax
  47.         stdcall xcf._.composite_rgb_00, [_width], [_height]
  48.         mov     eax, [_bottom]
  49.         ret
  50. endp
  51.  
  52.  
  53. xcf._.composite_table.begin:
  54.   .p00  dd 00, xcf._.composite_rgb_00, xcf._.composite_gray_00, xcf._.composite_indexed_00      ; Normal
  55.   .p01  dd 01, xcf._.composite_rgb_01, xcf._.composite_gray_01, xcf._.composite_gray_01         ; Dissolve      : random dithering to discrete alpha
  56. ;  .p02 dd 02, xcf._.composite_rgb_02, 0,                       xcf._.composite_indexed_02      ; Behind        : not selectable in the GIMP UI. not implemented
  57.   .p03  dd 03, xcf._.composite_rgb_03, xcf._.composite_rgb_03, xcf._.composite_indexed_00       ; Multiply
  58.   .p04  dd 04, xcf._.composite_rgb_04, xcf._.composite_rgb_04, xcf._.composite_indexed_00       ; Screen
  59.   .p05  dd 05, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00       ; Overlay
  60.   .p06  dd 06, xcf._.composite_rgb_06, xcf._.composite_rgb_06, xcf._.composite_indexed_00       ; Difference
  61.   .p07  dd 07, xcf._.composite_rgb_07, xcf._.composite_rgb_07, xcf._.composite_indexed_00       ; Addition
  62.   .p08  dd 08, xcf._.composite_rgb_08, xcf._.composite_rgb_08, xcf._.composite_indexed_00       ; Subtract
  63.   .p09  dd 09, xcf._.composite_rgb_09, xcf._.composite_rgb_09, xcf._.composite_indexed_00       ; Darken Only
  64.   .p10  dd 10, xcf._.composite_rgb_10, xcf._.composite_rgb_10, xcf._.composite_indexed_00       ; Lighten Only
  65.   .p11  dd 11, xcf._.composite_rgb_11, xcf._.composite_gray_00, xcf._.composite_indexed_00      ; Hue (H of HSV)
  66.   .p12  dd 12, xcf._.composite_rgb_12, xcf._.composite_gray_00, xcf._.composite_indexed_00      ; Saturation (S of HSV)
  67.   .p13  dd 13, xcf._.composite_rgb_13, xcf._.composite_gray_00, xcf._.composite_indexed_00      ; Color (H and S of HSL)
  68.   .p14  dd 14, xcf._.composite_rgb_14, xcf._.composite_gray_00, xcf._.composite_indexed_00      ; Value (V of HSV)
  69.   .p15  dd 15, xcf._.composite_rgb_15, xcf._.composite_rgb_15, xcf._.composite_indexed_00       ; Divide
  70.   .p16  dd 16, xcf._.composite_rgb_16, xcf._.composite_rgb_16, xcf._.composite_indexed_00       ; Dodge
  71.   .p17  dd 17, xcf._.composite_rgb_17, xcf._.composite_rgb_17, xcf._.composite_indexed_00       ; Burn
  72.   .p18  dd 18, xcf._.composite_rgb_18, xcf._.composite_rgb_18, xcf._.composite_indexed_00       ; Hard Light
  73.   .p19  dd 19, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00       ; Soft Light    : XCF >= 2 only ('soft light' == 'overlay')
  74.   .p20  dd 20, xcf._.composite_rgb_20, xcf._.composite_rgb_20, xcf._.composite_indexed_00       ; Grain Extract : XCF >= 2 only
  75.   .p21  dd 21, xcf._.composite_rgb_21, xcf._.composite_rgb_21, xcf._.composite_indexed_00       ; Grain Merge   : XCF >= 2 only
  76. xcf._.composite_table.end:
  77.