TweetFollow Us on Twitter

Jul 98 Tips

Volume Number: 14 (1998)
Issue Number: 7
Column Tag: Tips & Tidbits

Jul 98 Tips & Tidbits

by Steve Sisak

Here is a code to draw rotated QuickDraw picture without QuickDraw GX.

You can find the project files at http://www.bekkoame.or.jp/~iimori/tmp/StdPix.hqx

//
//  Rotate QuickDraw picture with StdPix bottleneck procedure.
//
#include <ImageCompression.h>
#include <GXMath.h>         // fl(),ff() macros
#include <stdio.h>         // use SIOUX window to draw on

void    main()
{
enum {
      kBWSmallMacOSLogo   =   -16501,   // use MacOS Logo
      kSmallMacOSLogo     =   -16503,
      kBigMacOSLogo       =   -16506
};

      PicHandle                 picHnd   =   nil;
      ImageDescriptionHandle   descHnd   =   nil;

      printf("\n");            // initialize Toolbox
      ::SetPort(::FrontWindow());

      long      response;         // examine QuickTime existence
      OSErr   err =   ::Gestalt(gestaltQuickTime,&response);
      if   ( err )   goto rtn;

      CodecInfo   codecInfo;   // examine QuickDrawCodec existence
      err = ::GetCodecInfo(&codecInfo,kQuickDrawCodecType,anyCodec);
      if   ( err )   goto rtn;

      picHnd = ::GetPicture(kSmallMacOSLogo);
      if   (picHnd == nil)   goto rtn;

      ::HNoPurge((Handle)picHnd);
      ::DetachResource((Handle)picHnd);
      Rect      picRect = (**picHnd).picFrame;

      MatrixRecord      matrix;
      ::SetIdentityMatrix(&matrix);
      Rect    r(picRect);
      ::OffsetRect(&r,40 - r.left,40 - r.top);
      ::RectMatrix(&matrix,&picRect,&r);   // move to (40,40)
      ::RotateMatrix(&matrix,ff(30),         // rotate 30 degree
                              ff((r.left + r.right)/2),
                              ff((r.top + r.bottom)/2));

      descHnd =
(ImageDescriptionHandle)::NewHandleClear
                                             (sizeof(ImageDescription));
      if (descHnd == nil)   goto rtn;

      {
      ImageDescription&      desc = **descHnd;

            desc.idSize           = sizeof(ImageDescription);
            desc.cType            = kQuickDrawCodecType;
            desc.temporalQuality  = codecLosslessQuality;
            desc.spatialQuality   = codecLosslessQuality;
            desc.width            = picRect.right - picRect.left;
            desc.height           = picRect.bottom - picRect.top;
            desc.hRes             = ff(72);
            desc.vRes             = ff(72);
            desc.dataSize         = ::GetHandleSize((Handle)picHnd);
            desc.frameCount       = 1;
            desc.depth            = 32;
            desc.clutID           = -1;
      }

      ::HLock((Handle)picHnd);
      PixMap  pixMap;
      err = ::SetCompressedPixMapInfo
                        (&pixMap,descHnd,*(Handle)picHnd,0,nil,nil);
      if ( err )   goto rtn;

      StdPixUPP         uppStdPix;
      const CQDProcs   *CQDProcPtr = 
                                    ((CGrafPtr)qd.thePort)->grafProcs;
      if   ( CQDProcPtr ) {
            uppStdPix = (StdPixUPP)CQDProcPtr->newProc1;
      }else{
            CQDProcs         stdProcs;
            ::SetStdCProcs(&stdProcs);
            uppStdPix = (StdPixUPP)stdProcs.newProc1;
      }

CallStdPixProc(uppStdPix,&pixMap,&picRect,&matrix,ditherCopy,

nil,nil,nil,callOldBits|callStdBits);
rtn:
   if ( descHnd ) {
         ::DisposeHandle((Handle)descHnd);
      }
      if ( picHnd ) {
            ::KillPicture(picHnd);
      }
}

Hideaki Iimori
iimori@lib.bekkoame.or.jp

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Fantastical 2.4.3 - Create calendar even...
Fantastical 2 is the Mac calendar you'll actually enjoy using. Creating an event with Fantastical is quick, easy, and fun: Open Fantastical with a single click or keystroke Type in your event... Read more
Things 3.2.1 - Elegant personal task man...
Things is a task management solution that helps to organize your tasks in an elegant and intuitive way. Things combines powerful features with simplicity through the use of tags and its intelligent... Read more
A Better Finder Attributes 6.06 - Change...
A Better Finder Attributes is the ultimate file-tweaking tool for OS X. It combines photo-shooting date and file date changing along with a few unique tricks of its own. Change EXIF Timestamps at... Read more
MacCleanse 6.0.5 - $29.95
MacCleanse is the product of thousands of hours of intense research and development. It meticulously scans all of the nooks and crannies of a computer for unnecessary junk that can take up huge... Read more
Smultron 10.0.2 - Easy-to-use, powerful...
Smultron 10 is an elegant and powerful text editor that is easy to use. You can use Smultron 10 to create or edit any text document. Everything from a web page, a note or a script to any single piece... Read more
Capto 1.2.5 - $29.99
Capto (was Voila) is an easy-to-use app that takes capturing, recording, video and image editing to the next level. With an intelligent file manager and quick sharing options, Capto is perfect for... Read more
Cocktail 11.0.1 - General maintenance an...
Cocktail is a general purpose utility for macOS that lets you clean, repair and optimize your Mac. It is a powerful digital toolset that helps hundreds of thousands of Mac users around the world get... Read more
Sketch 47.1 - Design app for UX/UI for i...
Sketch is an innovative and fresh look at vector drawing. Its intentionally minimalist design is based upon a drawing space of unlimited size and layers, free of palettes, panels, menus, windows, and... Read more
Slack 2.8.2 - Collaborative communicatio...
Slack is a collaborative communication app that simplifies real-time messaging, archiving, and search for modern working teams. Version 2.8.2: A small release containing nothing but another Electron... Read more
Path Finder 7.6.1 - Powerful, award-winn...
Path Finder makes you a master of file management. Take full control over your file system. Save your time: compare and synchronize folders, view hidden files, use Dual Pane and full keyboard... Read more

Returner 77 (Games)
Returner 77 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: Returner 77 is a cinematic space mystery puzzle game. You are in a giant alien spaceship hovering above Earth, after everything... | Read more »
Dune! guide - how to toe the line and ge...
Publisher Voodoo is at it again with an all new high score chaser -- Dune! In this fast-paced arcade game, you have to propel yourself along sand dunes, gaining enough momentum to jump above the line to score points, while making sure you have... | Read more »
The best deals on the App Store this wee...
Happy Tuesday, dear readers. Your favorite part of the week as officially arrived. It's time to take a look at the best deals in games. Things are admittedly a bit sparse, but there are a few diamonds in the rough to see you through if you're... | Read more »
Be the last person standing in Legacy of...
Yoozoo Games’ popular action MMO Legacy of Discord is getting a huge new update to celebrate its first anniversary. Perhaps the biggest change is the addition of an exciting survival mode titled Last Guardian. This new survival mode will pit you... | Read more »
Home Street guide - how to make friends...
From the creators of Food Street comes Home Street, a new simulation game that tasks you with building a social network and designing a beautiful home. It's a bit like The Sims, but you won't have to worry about the daily chores involved (feeding,... | Read more »
Color Ballz guide - how to bounce to the...
Color Ballz is an addictive new arcade title from Ketchapp Studios. It takes old school mechanics from games like Brickles and puts a fun twist on it. Your job? To catch balls with a paddle and send them back into a chute to be carried back to... | Read more »
Q&A: A-33 Studio explains why Combat...
When it comes to mobile FPS, it’s often tricky to get the fundamentals right on a platform lacking a physical controller, large display and hefty RAM. With Combat Squad: Project Wednesday, A-33 Studio bravely took on the challenge of making a... | Read more »
Taichi Panda 3: Dragon Hunter guide - ti...
Taichi Panda 3: Dragon Hunter launched this week to players all over the world. It's a beautiful mobile MMORPG that blends elements of Eastern and Western fantasy. It reminds us of a mix between World of Warcraft and Jade Empire. MMO's can have a... | Read more »
The best new games we played this week -...
Phew. It has been a week, but now it's time to relax, put your feet up, and enjoy some brand new mobile games. It was a bit of slow week, but there's still plenty of new titles to add to your collection. Here are four of our favorites. [Read... | Read more »
Yoink - Improved Drag and Drop (Product...
Yoink - Improved Drag and Drop 1.0 Device: iOS Universal Category: Productivity Price: $2.99, Version: 1.0 (iTunes) Description: Yoink for iPad and iPhone lets you easily and quickly store items you drag, copy or share, for later use... | Read more »

Price Scanner via MacPrices.net

13″ MacBook Pros on sale for up to $120 off M...
B&H Photo has 2017 13″ MacBook Pros in stock today and on sale for up to $120 off MSRP, each including free shipping plus NY & NJ sales tax only: – 13-inch 2.3GHz/128GB Space Gray MacBook... Read more
15″ MacBook Pros on sale for up to $200 off M...
B&H Photo has 15″ MacBook Pros on sale for up to $200 off MSRP. Shipping is free, and B&H charges sales tax in NY & NJ only: – 15″ 2.8GHz MacBook Pro Space Gray (MPTR2LL/A): $2249, $150... Read more
Roundup of Apple Certified Refurbished iMacs,...
Apple has a full line of Certified Refurbished 2017 21″ and 27″ iMacs available starting at $1019 and ranging up to $350 off original MSRP. Apple’s one-year warranty is standard, and shipping is free... Read more
Sale! 27″ 3.8GHz 5K iMac for $2098, save $201...
Amazon has the 27″ 3.8GHz 5K iMac (MNED2LL/A) on sale today for $2098 including free shipping. Their price is $201 off MSRP, and it’s the lowest price available for this model (Apple’s $1949... Read more
Sale! 10″ Apple WiFi iPad Pros for up to $100...
B&H Photo has 10.5″ WiFi iPad Pros in stock today and on sale for $50-$100 off MSRP. Each iPad includes free shipping, and B&H charges sales tax in NY & NJ only: – 10.5″ 64GB iPad Pro: $... Read more
Apple iMacs on sale for up to $130 off MSRP w...
B&H Photo has 21-inch and 27-inch iMacs in stock and on sale for up to $130 off MSRP including free shipping. B&H charges sales tax in NY & NJ only: – 27″ 3.8GHz iMac (MNED2LL/A): $2179 $... Read more
2017 3.5GHz 6-Core Mac Pro on sale for $2799,...
B&H Photo has the 2017 3.5GHz 6-Core Mac Pro (MD878LL/A) on sale today for $2799 including free shipping plus NY & NJ sales tax only . Their price is $200 off MSRP. Read more
12″ 1.2GHz Space Gray MacBook on sale for $11...
Amazon has the 2017 12″ 1.2GHz Space Gray Retina MacBook on sale for $100 off MSRP. Shipping is free: 12″ 1.2GHz Space Gray MacBook: $1199.99 $100 off MSRP Read more
Bare Bones Software Releases macOS High Sierr...
Bare Bones Software has announced the release and immediate availability of BBEdit 12.0, a significant upgrade to its professional strength text and code editor. BBEdit 12 introduces a new foundation... Read more
Yale Announces Availability of Apple HomeKit-...
Yale Locks & Hardware has announced that Apple HomeKit support for its Assure Lock family is available this month. The new Yale iM1 Network Module, which provides support for the Apple Home app... Read more

Jobs Board

*Apple* News Product Marketing Mgr., Publish...
Job Summary The Apple News Product Marketing Manager will work closely with a cross-functional group to assist in defining and marketing new features and services. Read more
Fraud Analyst, *Apple* Advertising Platform...
Job Summary Apple Ad Platforms has an opportunity to redefine advertising on mobile devices. Apple reaches hundreds of millions of iPhone, iPod touch, and iPad Read more
*Apple* Information Security - Security Data...
Job Summary This role is responsible for helping to strengthen Apple 's information security posture through the identification and curation of security event data. Read more
Lead *Apple* Solution Consultant - Apple In...
…develop a team of diverse partner employees focusing on excellence to deliver the Apple story. Even when you're not present, you will maintain a consistent influence Read more
watchOS Frameworks Engineering Manager, *App...
Job Summary Join the team that is shaping the future of software development for Apple Watch! Apple is looking for an exceptional software engineering leader to Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.