2388 dstRowIndex := dstRowIndex + dstBytesPerRow. |
2390 dstRowIndex := dstRowIndex + dstBytesPerRow. |
2389 imgRowIndex := imgRowIndex + imgBytesPerRow. |
2391 imgRowIndex := imgRowIndex + imgBytesPerRow. |
2390 ]. |
2392 ]. |
2391 "/ draw the pixels (always MSB) |
2393 "/ draw the pixels (always MSB) |
2392 device |
2394 device |
2393 drawBits:dstData msb:true bitsPerPixel:32 depth:24 padding:32 |
2395 drawBits:dstData bitsPerPixel:32 depth:24 padding:32 |
|
2396 width:w height:h x:0 y:0 |
|
2397 into:(self drawableId) x:pX y:pY width:w height:h with:gcId. |
|
2398 ^ self. |
|
2399 ]. |
|
2400 bppDrawable == 24 ifTrue:[ |
|
2401 "/ data is coming as bytes in r,g,b order |
|
2402 dstRowIndex := 1. |
|
2403 imgRowIndex := 1. |
|
2404 |
|
2405 "/ draw "by hand" here |
|
2406 0 to:h-1 do:[:y | |
|
2407 dstIndex := dstRowIndex. |
|
2408 imgIndex := imgRowIndex. |
|
2409 0 to:w-1 do:[:x | |
|
2410 |rD "{Class: SmallInteger}" |
|
2411 gD "{Class: SmallInteger}" |
|
2412 bD "{Class: SmallInteger}" |
|
2413 rI "{Class: SmallInteger}" |
|
2414 gI "{Class: SmallInteger}" |
|
2415 bI "{Class: SmallInteger}" |
|
2416 aI "{Class: SmallInteger}" |
|
2417 aD "{Class: SmallInteger}" |
|
2418 nR "{Class: SmallInteger}" |
|
2419 nG "{Class: SmallInteger}" |
|
2420 nB "{Class: SmallInteger}"| |
|
2421 |
|
2422 rD := dstData at:(dstIndex+2). |
|
2423 gD := dstData at:(dstIndex+1). |
|
2424 bD := dstData at:(dstIndex+0). |
|
2425 |
|
2426 rI := imgData at:(imgIndex). |
|
2427 gI := imgData at:(imgIndex+1). |
|
2428 bI := imgData at:(imgIndex+2). |
|
2429 aI := imgData at:(imgIndex+3). |
|
2430 |
|
2431 aI == 255 ifTrue:[ |
|
2432 nR := rI. |
|
2433 nG := gI. |
|
2434 nB := bI. |
|
2435 ] ifFalse:[ |
|
2436 aI == 0 ifTrue:[ |
|
2437 nR := rD. |
|
2438 nG := gD. |
|
2439 nB := bD. |
|
2440 ] ifFalse:[ |
|
2441 aD := 255 - aI. |
|
2442 |
|
2443 nR := (((rI * aI)+(rD * aD)) // 255). |
|
2444 nG := (((gI * aI)+(gD * aD)) // 255). |
|
2445 nB := (((bI * aI)+(bD * aD)) // 255). |
|
2446 ]. |
|
2447 ]. |
|
2448 dstData at:(dstIndex+0) put:nR. |
|
2449 dstData at:(dstIndex+1) put:nG. |
|
2450 dstData at:(dstIndex+2) put:nB. |
|
2451 |
|
2452 dstIndex := dstIndex + 3. |
|
2453 imgIndex := imgIndex + 4. |
|
2454 ]. |
|
2455 dstRowIndex := dstRowIndex + dstBytesPerRow. |
|
2456 imgRowIndex := imgRowIndex + imgBytesPerRow. |
|
2457 ]. |
|
2458 "/ draw the pixels (always MSB) |
|
2459 device |
|
2460 drawBits:dstData bitsPerPixel:24 depth:24 padding:32 |
2394 width:w height:h x:0 y:0 |
2461 width:w height:h x:0 y:0 |
2395 into:(self drawableId) x:pX y:pY width:w height:h with:gcId. |
2462 into:(self drawableId) x:pX y:pY width:w height:h with:gcId. |
2396 ^ self. |
2463 ^ self. |
2397 ]. |
2464 ]. |
2398 self halt. |
2465 self halt. |