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

iShowU Instant 1.3.2 - Full-featured scr...
iShowU Instant gives you real-time screen recording like you've never seen before! It is the fastest, most feature-filled real-time screen capture tool from shinywhitebox yet. All of the features you... Read more
NeoFinder 7.5.1 - Catalog your external...
NeoFinder (formerly CDFinder) rapidly organizes your data, either on external or internal disks, or any other volumes. It catalogs and manages all your data, so you stay in control of your data... Read more
App Tamer 2.5 - Efficiently manage your...
App Tamer tames your processor-monopolizing apps and keeps them from chewing up excessive CPU time and battery life. Powered by a unique AutoStop feature, App Tamer stops each application when you... Read more
MainStage 3 3.4.4 - Live performance too...
Apple MainStage makes it easy to bring to the stage all the same instruments and effects that you love in your recording. Everything from the Sound Library and Smart Controls you're familiar with... Read more
iTubeDownloader 6.5.13 - Easily download...
iTubeDownloader is a powerful-yet-simple YouTube downloader for the masses. Because it contains a proprietary browser, you can browse YouTube like you normally would. When you see something you want... Read more
FileZilla 3.47.0 - Fast and reliable FTP...
FileZilla (ported from Windows) is a fast and reliable FTP client and server with lots of useful features and an intuitive interface. Version 3.47.0: Fixed regression loading advanced site... Read more
Transmit 5.6.3 - Excellent FTP/SFTP clie...
Transmit is an excellent FTP (file transfer protocol), SFTP, S3 (Amazon.com file hosting) and iDisk/WebDAV client that allows you to upload, download, and delete files over the internet. With the... Read more
Doomsday 2.2.2 - Play classic Doom on mo...
id Software's Doom pioneered the modern first-person shooter genre. Released in 1993, it was a quantum leap in game engine technology with fluid and - at the time - incredibly realistic 3D graphics.... Read more
Ableton Live 10.1.9 - Record music using...
Ableton Live lets you create and record music on your Mac. Use digital instruments, pre-recorded sounds, and sampled loops to arrange, produce, and perform your music like never before. Ableton Live... Read more
Maintenance 2.6.5 - System maintenance u...
Maintenance is a system maintenance and cleaning utility. It allows you to run miscellaneous tasks of system maintenance: Check the the structure of the disk Repair permissions Run periodic scripts... Read more

Latest Forum Discussions

See All

Creepy Little Monsters is a cute, monste...
Creepy Little Monsters is a retro throwback that sees you traversing tricky puzzle-platformer levels as a one-eyed monster. It aims to offer a fresh take on 80s and 90s classics of the genre, and it's out right now for iOS and Android. [Read more... | Read more »
Tyrant's Arena delivers intense her...
Tyrant's Arena is an intense midcore multiplayer actioner where you'll compete in tricky 3v3 matches to crush your opponents and earn neat rewards. It comes to us from developer Kroy Games, and it's now available for pre-registration on iOS and... | Read more »
Mobile Games Starter Kit
Over here at 148Apps, we regularly dive deep into the latest and greatest mobile games hitting the App Store, but that’s not always what people are looking for when searching for a new mobile game. Some folks just want to dip their toes into... | Read more »
Unresolved is a hard-hitting narrative a...
Ghofran Akil's Unresolved in an upcoming text-based adventure game that sees you playing as a mother attempting to find her disappeared husband during the Lebanese Civil War. [Read more] | Read more »
Marvel Strike Force introduces new brawl...
FoxNext's squad-based RPG Marvel Strike Force is set to receive some fresh characters from the X-Men and Iron Man series. They'll arrive as part of the game's latest update, which follows a sizable spending boycott on the title due to complaints... | Read more »
Speed Dating for Ghosts is a narrative a...
Speed Dating for Ghosts originally released on Steam back 2018, since then it has received honourable mentions for narrative during the Independent Games Festival. Now it's made its way over to iOS devices where it's available as a premium title... | Read more »
Fast-paced multiplayer title Tennis Star...
Tennis Stars: Ultimate Clash is the latest free-to-play tennis title to hit iOS and Android. It's said to be a fairly casual experience, offering easy-to-learn controls and fast-paced, mobile-friendly matches. [Read more] | Read more »
Super Mecha Champions' latest updat...
Super Mecha Champions' latest update sees the addition of a brand new character called R.E.D. Alongside that, there's news about the current season and a series of Emojis that have been added to the game. [Read more] | Read more »
Apple Arcade: Ranked - Top 50 [Updated 2...
In case you missed it, I am on a quest to rank every Apple Arcade game there is. [Read more] | Read more »
Apple Arcade: Ranked - 51+ [Updated 2.19...
This is part 2 of our Apple Arcade Ranking list. To see part 1, go here. To skip to part 3, click here. 51. Mini Motorways Description: [Read more] | Read more »

Price Scanner via MacPrices.net

B&H is again offering $100 discounts on M...
B&H Photo has 4-Core and 6-Core Mac minis on sale for $100 off Apple’s standard MSRP, with prices starting at only $699. Overnight shipping is free to many US addresses: – 3.6GHz Quad-Core mini... Read more
B&H Photo drops iMac prices, offers model...
B&H Photo has new 2019 21″ and 27″ 5K iMacs in stock today and on sale for up to $250 off Apple’s MSRP, with prices starting at only $999. These are the same iMacs sold by Apple in their retail... Read more
Flash sale! 11″ 64GB WiFi iPad Pro for $674,...
Walmart has the 11″ 64GB WiFi iPad Pro on sale on their online store today for $674. That’s $125 off Apple’s MSRP for this model and the cheapest price available from any Apple reseller. Choose free... Read more
Sale! Get the 256GB 13″ Silver MacBook Air fo...
Amazon has new 2019 13″ 1.6GHz/256GB MacBook Airs, in Silver, on sale today for only $999 shipped. Their price is $300 off Apple’s MSRP for this model, and it’s the cheapest price for a 256GB MacBook... Read more
Verizon offers free iPhone 7 to customers ope...
Verizon is offering a free 32GB iPhone 7 for new or existing customers who open a new line of service, no trade-in required. Cost of the phone is credited to your account monthly over 24 months. The... Read more
Sale! 10.5″ 256GB WiFi iPad Air for $549, $10...
Amazon has new 10.5″ 256GB WiFi iPad Airs, in Space Gray, on sale today for $549 shipped. Their price is $100 off Apple’s MSRP for this model, and it’s the cheapest price available from any Apple... Read more
Back on sale! Apple’s new Mac Pro for $5499,...
B&H Photo has the base 2019 Mac Pro (3.5GHz 8-Core Xeon, 32GB RAM, 256GB SSD) in stock today and on sale for $5499 including free overnight delivery to many addresses in the US. Their price is $... Read more
B&H offers $100 discount on base 13″ 1.4G...
B&H Photo has new 2019 13″ 1.4GHz MacBook Pros on sale for $100 off Apple’s MSRP today with prices starting at $1199. Overnight shipping is free to many addresses in the US. These are the same... Read more
Apple continues to offer Certified Refurbishe...
Apple has Certified Refurbished iPhone XS models available for up to $350 off MSRP, with prices starting at $699. Each iPhone is unlocked and comes with Apple’s standard one-year warranty and a new... Read more
Apple AirPods are on sale for $30 off today
Amazon has new 2019 Apple AirPods (non-Pro models) on sale today for $30 off MSRP, starting at $129. Shipping is free: – AirPods with Wireless Charging Case: $169 $30 off MSRP – AirPods with Charging... Read more

Jobs Board

Medical Assistant - *Apple* Valley Clinic -...
…professional, quality care to patients in the ambulatory setting at the M Health Fairview Apple Valley Clinic, located in Apple Valley, MN. Join the **M Health Read more
Geek Squad Advanced Repair *Apple* Professi...
**764652BR** **Job Title:** Geek Squad Advanced Repair Apple Professional **Job Category:** Store Associates **Store NUmber or Department:** 000245- Apple Read more
Medical Assistant - *Apple* Valley Clinic -...
…professional, quality care to patients in the ambulatory setting at the M Health Fairview Apple Valley Clinic, located in Apple Valley, MN. Join the **M Health Read more
Windows/ *Apple* Technical Support Engineer...
Windows/ Apple Technical Support Engineer McLean , VA , US Apply + Be you + Be Booz Allen + Be empowered + Learn More Job Description Location: McLean, VA, US Job Read more
Medical Assistant - *Apple* Valley Clinic -...
…professional, quality care to patients in the ambulatory setting at the M Health Fairview Apple Valley Clinic, located in Apple Valley, MN. Join the **M Health Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.