~clinton-blackmore/enchanting/with-sprites-for-the-nxt

« back to all changes in this revision

Viewing changes to FrontEnd/Classes/3-ScratchStageMorph.st

  • Committer: Clinton Blackmore
  • Date: 2011-04-23 20:09:45 UTC
  • Revision ID: clinton.blackmore@gmail.com-20110423200945-u36gz8729oq1f2jd
Double-size scaling somewhat works.  There are a number of neighbouring things that broke, and drawing in double-size does not always work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
448
448
! !
449
449
 
450
450
 
 
451
!ScratchStageMorph methodsFor: 'drawing' stamp: 'CWB 4/23/2011 08:44'!
 
452
deviceScaleFactor
 
453
        "Returns the scaling that the device species"
 
454
 
 
455
        | device |
 
456
 
 
457
        device _ ScriptableScratchMorph blockSpecSource.
 
458
 
 
459
        ^ device ifNotNil: [ device class displayScaleFactor ] ifNil: [ 1.0 ].
 
460
 
 
461
! !
 
462
 
451
463
!ScratchStageMorph methodsFor: 'drawing' stamp: 'jm 8/2/2006 18:24'!
452
464
drawOn: aCanvas
453
465
        "Draw myself if my visibility is > 0. If my visibility is 1, draw using the normal 'paint' mode. Otherwise, draw using 'alpha' resulting in a partially transparent rendering."
586
598
        ^ bounds
587
599
! !
588
600
 
589
 
!ScratchStageMorph methodsFor: 'drawing' stamp: 'CWB 4/21/2011 22:20'!
 
601
!ScratchStageMorph methodsFor: 'drawing' stamp: 'CWB 4/23/2011 08:46'!
590
602
fullDrawOn: aCanvas
591
603
        "Calls super fullDrawOn and then draws the frame shadow"
592
604
 
593
 
        | shadowOrigin topShadowExtent leftShadowExtent alphas uiScale device deviceScale finalScale |
594
 
 
595
 
        device _ ScriptableScratchMorph blockSpecSource.
596
 
 
597
 
        uiScale _ self isQuarterSize ifTrue: [ 0.5 ] ifFalse: [ 1.0 ].
598
 
        deviceScale _ device ifNotNil: [ device class displayScaleFactor ] ifNil: [ 1.0 ].
599
 
        finalScale _ deviceScale * uiScale.
 
605
        | shadowOrigin topShadowExtent leftShadowExtent alphas finalScale |
 
606
 
 
607
        finalScale _ self stageScaleFactor.
600
608
 
601
609
        (self isInWorld) ifTrue: [
602
610
                (finalScale = 0.5) ifTrue: [^ self drawQuarterSizeOn: aCanvas].
736
744
        ^ canvas form
737
745
! !
738
746
 
 
747
!ScratchStageMorph methodsFor: 'drawing' stamp: 'CWB 4/23/2011 08:49'!
 
748
stageScaleFactor
 
749
        "Returns a combined scale factor.
 
750
        Multiply the workpane extent (the actual image, in real pixels) by this scale
 
751
        to know the extent of the area to display the stage on."
 
752
 
 
753
        ^ self deviceScaleFactor * (self isQuarterSize ifTrue: [ 0.5 ] ifFalse: [ 1.0 ]).       
 
754
! !
 
755
 
739
756
!ScratchStageMorph methodsFor: 'drawing' stamp: 'tis 8/3/2006 16:06'!
740
757
stageShotForm
741
758
        "Answer a stage shot of me and my submorphs."