Giter VIP home page Giter VIP logo

xw's Introduction

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

xw's People

Contributors

bbqz007 avatar bbqz007z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xw's Issues

drawInContext should use frame rather than bounds

when you overload the drawInContext , you should use coordinate based on frame rather than bounds.

if you want to use the coordinate based on bounds, you should CGContextTranslateCTM(ctx, _frame._X, _frame._Y) at the beginning of the function and CGContextTranslateCTM(ctx, -_frame._X, -_frame._Y) at the end.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.