Skip to content
/ xw Public

an CoreAnimation layer engine on windows platform, some like core animation in cocoa frameworks. lightweight and c++.

Notifications You must be signed in to change notification settings

bbqz007/xw

Repository files navigation

xw

an animation layer engine on windows platform some like Core Animation in cocoa frameworks.


newest

img


img

photo below is shown for wall-behive.

img

PicInCN

ChangeLog

changelog

classes

NSObject

CALayer

CARootLayer (2021)

CATextLayer

CAAnimation

CGContext

NSAutoReleasePool

NSDispatcher (2021)

__strong

__weak

__autoreleasing

CGAffineTransform

use animation engine

  1. attach a CARootLayer to win32 window handle
  2. addSublayer() CALayer to this CARootLayer
  3. display() this CARootLayer in the win32 window's WM_PAINT wndproc.
  4. setFrame() while this win32 window's WM_SIZE etc.

two way to write animations

  1. use CAAnimation to commit() a animation job.

  2. implement your own CALayer, override the virtual method CALayer::applyAnimating() to control every frame.

properties of CALayer for animation

  1. Frame.

  2. opacity.

  3. transform matrix.

custom draw CALayer

  1. derived Layer from CALayer
  2. override the virtual method CALayer::drawInContext()

autorelease

  1. NSAutoreleasePoolAttachCurrentThread() before any _0_autorelease in the thread.

  2. scope between _0_autorelease and _1_autorelease

  3. NSObjects can use autorelease() method.

  4. NSAutoreleasePoolDettachCurrentThread() after any _1_autorelease in the thread.

lifetime

  1. all the NSObjects only allowed to be created by NSObject::allocT<Ty>(), any new or scoped creation would throw.
  2. release() by hand, or autorelease()
  3. use __strong<Ty>, it retain() when the pointer checks in and release() when the pointer checks out.

dispatch_queue

  1. implement as NSDispatcher which associate to HWND, and dispatch_async() to UI thread which the HWND belongs to.
  2. this NSDispatcher help you change CALayer in UI thread rather than a non UI thread.
  3. you should process process_dispatch_on_message() in the HWND's WM_NS_DIPATCH_NOTIRY wndporc.

performance

CGContextPolicy

  1. CGContextPolicyForceSpeed()
  2. CGContextPolicyPreferSpeed()
  3. CGContextPolicyDefault()
  4. CGContextPolicyBalance() img

projects

https://github.com/bbqz007/KTL img img

other associated demo

img

if you are behive a wall, click here

https://github.com/bbqz007/stock-drawing-assistant-tool

About

an CoreAnimation layer engine on windows platform, some like core animation in cocoa frameworks. lightweight and c++.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published